Merge (conflicts)

Sally realizes that C99 has a bool type that should have been used.

no_boys_allowed sally$ svn diff
Index: pb.c
===================================================================
--- pb.c    (revision 19)
+++ pb.c    (working copy)
@@ -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
             {

no_boys_allowed sally$ svn commit -m "use the bool type"
Sending        no_boys_allowed/pb.c
Transmitting file data .
Committed revision 21.

Meanwhile, Harry has been grumbling about Sally’s butchering of the Queen’s English and decides to correct the spelling of the word “favourite”.

trunk harry$ svn diff
Index: pb.c
===================================================================
--- pb.c    (revision 20)
+++ pb.c    (working copy)
@@ -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.

trunk harry$ svn commit -m "fixed spelling error"
Sending        trunk/pb.c
Transmitting file data .
Committed revision 22.

And to once again merge Sally’s changes into trunk.

trunk harry$ cd ..

lottery harry$ svn update
U    branches/no_boys_allowed/pb.c
Updated to revision 22.

lottery harry$ cd trunk

trunk harry$ svn merge ../branches/no_boys_allowed/
Conflict discovered in 'pb.c'.
Select: (p) postpone, (df) diff-full, (e) edit,
        (mc) mine-conflict, (tc) theirs-conflict,
        (s) show all options: 

Crikey! Conflicts in pb.c again.

trunk harry$ svn diff
Index: pb.c
===================================================================
--- pb.c    (revision 22)
+++ pb.c    (working copy)
@@ -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;
+<<<<<<< .working
     int favourite = 0;  // this should be a bool
+=======
+    bool favorite = false;
+>>>>>>> .merge-right.r22
 
     for (int i=1; i<argc; i++)
     {
@@ -67,7 +72,11 @@
         {
             if (0 == strcmp(arg, "-favourite"))
             {
+<<<<<<< .working
                 favourite = 1;
+=======
+                favorite = true;
+>>>>>>> .merge-right.r22
             }
             else
             {

Now this is a sticky wicket! Harry quickly realises this conflict needs to be resolved manually by keeping the proper spelling but converting the type to bool like Sally did.

trunk harry$ svn diff

Property changes on: .
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /branches/no_boys_allowed:r20-22

Index: pb.c
===================================================================
--- pb.c    (revision 22)
+++ pb.c    (working copy)
@@ -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.

trunk harry$ svn resolve --accept=working pb.c
Resolved conflicted state of 'pb.c'

trunk harry$ svn commit -m "merge, conflicts fixed"
Sending        trunk
Sending        trunk/pb.c
Transmitting file data .
Committed revision 23.

And all of Futilisoft’s customers lived happily ever after.