Merge (no conflicts)

Meanwhile, over in the master branch, Harry decides the white balls should be sorted before analysing them, because that’s how they get shown on the idiot’s lantern.

lottery harry$ vv diff
=== ================
===   Modified: File @/src/pb.c
--- @/src/pb.c  5649f2644a495ba4bf4d2a23d9a28e5c30064cd5
+++ @/src/pb.c  2011/05/31 16:44:53.000 +0000
@@ -6,6 +6,25 @@
 #define MAX_WHITE_BALL 59
 #define MAX_POWER_BALL 39
 
+static int my_sort_func(const void* p1, const void* p2)
+{
+    int v1 = *((int *) p1);
+    int v2 = *((int *) p2);
+
+    if (v1 < v2)
+    {
+        return -1;
+    }
+    else if (v1 > v2)
+    {
+        return 1;
+    }
+    else
+    {
+        return 0;
+    }
+}
+
 int calculate_result(int white_balls[5], int power_ball)
 {
     for (int i=0; i<5; i++)
@@ -27,6 +46,8 @@
         return -1;
     }
 
+    qsort(white_balls, 5, sizeof(int), my_sort_func);
+
     return 0;
 }

And he commits the change.

lottery harry$ vv commit -m "sort the white balls"

    revision:  19:e1ff5a3d4def8a5b45179f5326f68367b2f270c9
      branch:  master
         who:  harry
        when:  2011/05/31 11:46:01.784 -0500
     comment:  sort the white balls
      parent:  17:d934a35fc8eda4fec7cb6b0d049e3881cd0e4a1d

But now he’s curious about what Sally has been doing. She said he wasn’t allowed to commit to her branch but she didn’t say anything about looking at it.

lottery harry$ vv heads

    revision:  18:37939b07309af8232c44048ca0a1633c982b7506
      branch:  no_boys_allowed
         who:  sally
        when:  2011/05/31 11:41:37.432 -0500
     comment:  add -favorite and cleanup some other stuff
      parent:  17:d934a35fc8eda4fec7cb6b0d049e3881cd0e4a1d

    revision:  19:e1ff5a3d4def8a5b45179f5326f68367b2f270c9
      branch:  master
         who:  harry
        when:  2011/05/31 11:46:01.784 -0500
     comment:  sort the white balls
      parent:  17:d934a35fc8eda4fec7cb6b0d049e3881cd0e4a1d
...

Interesting. She added the “favorite” feature. Harry decides he wants that. So he asks Veracity to merge stuff from Sally’s branch into master.

lottery harry$ vv merge -r 37939b07309af8232c44048ca0a1633c982b7506
1 updated, 0 deleted, 0 added, 1 merged, 0 unresolved

Harry used -r 37939b07309a… here. He could also have used -r 18 (the local revision number) or -b no_boys_allowed (the head of Sally’s branch).

Top Ho! Harry examines pb.c and discovers that it was merged correctly. Sally’s “favorite” changes are there and his qsort changes are as well. So he compiles the code, runs a quick test, and commits the merge.

lottery harry$ make
gcc -std=c99 -Wall -Wextra -Werror pb.c -o pb

lottery harry$ ./pb -favorite 5 3 33 22 7 31
0 percent chance of winning

lottery harry$ vv commit -m "merge changes from sally"

    revision:  20:68f12175bcda2296298f6b0f30da326341976356
      branch:  master
         who:  harry
        when:  2011/05/31 11:49:49.565 -0500
     comment:  merge changes from sally
      parent:  18:37939b07309af8232c44048ca0a1633c982b7506
      parent:  19:e1ff5a3d4def8a5b45179f5326f68367b2f270c9

lottery harry$ vv push
Pushing to http://server.futilisoft.com:8080/repos/lottery:
Pushing... Done.