Sally realizes that C99 has a bool
type that should have been used.
lottery sally$ vv diff === ================ === Modified: File @/src/pb.c --- @/src/pb.c a35acfb35567f64a2e20ef246ae44aef89a904bd +++ @/src/pb.c 2011/05/31 16:59:35.000 +0000 @@ -2,6 +2,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <stdbool.h> #define LUCKY_NUMBER 7 #define MAX_WHITE_BALL 59 @@ -35,7 +36,7 @@ { int balls[6]; int count_balls = 0; - int favorite = 0; // this should be a bool + bool favorite = false; for (int i=1; i<argc; i++) { @@ -45,7 +46,7 @@ { if (0 == strcmp(arg, "-favorite")) { - favorite = 1; + favorite = true; } else {
And she commits the change to her private branch.
lottery sally$ vv commit -m "use the bool type" revision: 24:1bb6c0d46c06d7575f39ca82210e586ff56a0ad4 branch: no_boys_allowed who: sally when: 2011/05/31 12:00:28.819 -0500 comment: use the bool type parent: 21:69f50e32759eef176403ca0c019fb1af73145fb9 lottery sally$ vv push Pushing to http://server.futilisoft.com:8080/repos/lottery: Pushing... Done.
Meanwhile, Harry has been grumbling about Sally’s butchering of the Queen’s English and decides to correct the spelling of the word “favourite”.
lottery harry$ vv diff === ================ === Modified: File @/src/pb.c --- @/src/pb.c cde51a1d39996efe6e24608d908d9ae9ec93c869 +++ @/src/pb.c 2011/05/31 17:01:23.000 +0000 @@ -57,7 +57,7 @@ { int balls[6]; int count_balls = 0; - int favorite = 0; // this should be a bool + int favourite = 0; // this should be a bool for (int i=1; i<argc; i++) { @@ -65,9 +65,9 @@ if ('-' == arg[0]) { - if (0 == strcmp(arg, "-favorite")) + if (0 == strcmp(arg, "-favourite")) { - favorite = 1; + favourite = 1; } else { @@ -108,7 +108,7 @@ result = result * 2; } - if (favorite) + if (favourite) { result = result * 2; } @@ -118,7 +118,7 @@ return 0; usage_error: - fprintf(stderr, "Usage: %s [-favorite] (5 white balls) power_ball\n", argv[0]); + fprintf(stderr, "Usage: %s [-favourite] (5 white balls) power_ball\n", argv[0]); return -1; }
Feeling quite chuffed about his pedantry, Harry proceeds to commit the change.
lottery harry$ vv commit -m "fixed spelling error" revision: 24:54bc95bef02726d647ce3f3f741048b852c22bef branch: master who: harry when: 2011/05/31 12:02:12.841 -0500 comment: fixed spelling error parent: 23:31d8497141637a90feeb38f16ac9ff9454673e3d
lottery harry$ vv pull Pulling from http://server.futilisoft.com:8080/repos/lottery: Pulling... Done. lottery harry$ vv heads revision: 25:1bb6c0d46c06d7575f39ca82210e586ff56a0ad4 branch: no_boys_allowed who: sally when: 2011/05/31 12:00:28.819 -0500 comment: use the bool type parent: 22:69f50e32759eef176403ca0c019fb1af73145fb9 revision: 24:54bc95bef02726d647ce3f3f741048b852c22bef branch: master who: harry when: 2011/05/31 12:02:12.841 -0500 comment: fixed spelling error parent: 23:31d8497141637a90feeb38f16ac9ff9454673e3d
And to once again merge Sally’s changes into master.
lottery harry$ vv merge -b no_boys_allowed 1 updated, 0 deleted, 0 added, 1 merged, 1 unresolved lottery harry$ vv st Modified: @/src/pb.c Found: @/pb Conflict: @/src/pb.c # content conflict # Use the 'vv resolve' command to view more details # about your conflicts or to resolve them. lottery harry$ vv resolve list Unresolved contents conflict on File: @/src/pb.c Baseline Path: @/src/pb.c Problem: Merge couldn't generate the item's contents. Cause(s): Edit/Edit: Changes to item's contents in different branches conflict. Possible Contents: (use 'view' or 'diff' to examine) ancestor baseline other merge: automatically merged from 'baseline' and 'other' with ':merge' working
Crikey! Conflicts in pb.c
again.
lottery harry$ vv diff === ================ === Modified: File @/src/pb.c --- @/src/pb.c 4a36fdc1601f2b9b586b9239f0dd3c928722a00c +++ @/src/pb.c 2011/05/31 17:03:17.000 +0000 @@ -2,6 +2,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <stdbool.h> #define LUCKY_NUMBER 7 #define MAX_WHITE_BALL 59 @@ -57,7 +58,11 @@ { int balls[6]; int count_balls = 0; +<<<<<<< Baseline: BASELINE~pb.c: /Users/harry/lottery/.sgdrawer/t/merge_20110531_0/pb.c... int favourite = 0; // this should be a bool +======= + bool favorite = false; +>>>>>>> Other: OTHER~pb.c: /Users/harry/lottery/.sgdrawer/t/merge_20110531_0/pb.c... for (int i=1; i<argc; i++) { @@ -67,7 +72,11 @@ { if (0 == strcmp(arg, "-favourite")) { +<<<<<<< Baseline: BASELINE~pb.c: /Users/harry/lottery/.sgdrawer/t/merge_20110531_0/pb.c... favourite = 1; +======= + favorite = true; +>>>>>>> Other: OTHER~pb.c: /Users/harry/lottery/.sgdrawer/t/merge_20110531_0/pb.c... } else {
Now that needs a bit of guntering. Harry quickly realises this conflict
needs to be resolved manually by keeping the proper spelling
but converting the type to bool
like Sally did.
lottery harry$ vv diff === ================ === Modified: File @/src/pb.c --- @/src/pb.c 4a36fdc1601f2b9b586b9239f0dd3c928722a00c +++ @/src/pb.c 2011/05/31 17:06:24.000 +0000 @@ -2,6 +2,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <stdbool.h> #define LUCKY_NUMBER 7 #define MAX_WHITE_BALL 59 @@ -57,7 +58,7 @@ { int balls[6]; int count_balls = 0; - int favourite = 0; // this should be a bool + bool favourite = false; for (int i=1; i<argc; i++) { @@ -67,7 +68,7 @@ { if (0 == strcmp(arg, "-favourite")) { - favourite = 1; + favourite = true; } else {
After manually merging the changes, Harry proceeds to resolve the conflict and commit the merge.
lottery harry$ vv resolve accept working src/pb.c Accepted 'working' value for 'contents' conflict on File: @/src/pb.c lottery harry$ vv commit -m "merge, conflicts fixed" revision: 26:96f8aed89a5d16970c7d4e87b6a96e7d481ed3e9 branch: master who: harry when: 2011/05/31 12:07:29.931 -0500 comment: merge, conflicts fixed parent: 25:1bb6c0d46c06d7575f39ca82210e586ff56a0ad4 parent: 24:54bc95bef02726d647ce3f3f741048b852c22bef lottery harry$ vv push Pushing to http://server.futilisoft.com:8080/repos/lottery: Pushing... Done.
And all of Futilisoft’s customers lived happily ever after.