Sometimes I wish the conflict notation was something like:

#error BEGIN MERGE CONFLICT

Instead of

<<<<<<< BEGIN MERGE CONFLICT

But I know that would only work in C/C++/C#.  I just wish there was some way 
that the compiler could tell me about the merge conflict more clearly instead 
of hunting for a syntax error side effect.

RW 

Ron Wilson, Engineering Project Lead
(o) 434.455.6453, (m) 434.851.1612, www.harris.com

HARRIS CORPORATION   |   RF Communications Division     assuredcommunicationsT

> -----Original Message-----
> From: [email protected] [mailto:fossil-users-
> [email protected]] On Behalf Of Ramon Ribó
> Sent: Wednesday, December 15, 2010 10:18 AM
> To: [email protected]
> Subject: Re: [fossil-users] Merge conflict notation
> 
> Why do not compact the 3 lines into one line?
> 
> 
> RR
> 
> 2010/12/15 Zach Todd <[email protected]>:
> > I have updated some of the merge conflict code to provide a little more
> detail.  Below is an example of this update in action.
> >
> > 0
> > 1
> > 2
> > 3
> > <<<<<<< BEGIN MERGE CONFLICT
> > <<<<<<< 89aba65d8683d417a305cc784afb82489617c665
> > <<<<<<< initial checkin
> > 444
> > ============================
> > <<<<<<< 8715f5bdc8de7d01fa9bc975d199ec5fe332c6da
> > <<<<<<< new branch checkin
> > 999
> >>>>>>>> END MERGE CONFLICT
> > 5
> > 6
> > 7
> > 8
> > 9
> >
> > This change could hopefully provide some quick context on conflicts.
>  Below is the diff of the Fossil source that drives this new behavior.
>  Any thoughts on this idea?
> >
> > Index: src/merge.c
> > ===================================================================
> > --- src/merge.c
> > +++ src/merge.c
> > @@ -274,11 +274,11 @@
> >     blob_read_from_file(&v, zFullPath);
> >     if( isBinary ){
> >       rc = -1;
> >       blob_zero(&r);
> >     }else{
> > -      rc = blob_merge(&p, &m, &v, &r);
> > +      rc = blob_merge(&p, &m, &v, &r, vid, mid);
> >     }
> >     if( rc>=0 ){
> >       blob_write_to_file(&r, zFullPath);
> >       if( rc>0 ){
> >         printf("***** %d merge conflicts in %s\n", rc, zName);
> >
> > Index: src/merge3.c
> > ===================================================================
> > --- src/merge3.c
> > +++ src/merge3.c
> > @@ -144,20 +144,32 @@
> >  ** The return is 0 upon complete success. If any input file is binary,
> >  ** -1 is returned and pOut is unmodified.  If there are merge
> >  ** conflicts, the merge proceeds as best as it can and the number
> >  ** of conflicts is returns
> >  */
> > -int blob_merge(Blob *pPivot, Blob *pV1, Blob *pV2, Blob *pOut){
> > +int blob_merge(Blob *pPivot, Blob *pV1, Blob *pV2, Blob *pOut, int vid,
> int mid){
> >   int *aC1;              /* Changes from pPivot to pV1 */
> >   int *aC2;              /* Changes from pPivot to pV2 */
> >   int i1, i2;            /* Index into aC1[] and aC2[] */
> >   int nCpy, nDel, nIns;  /* Number of lines to copy, delete, or insert
> */
> >   int limit1, limit2;    /* Sizes of aC1[] and aC2[] */
> >   int nConflict = 0;     /* Number of merge conflicts seen so far */
> > +
> > +  char *zLeft  = (char*)malloc(512);
> > +  char *zRight = (char*)malloc(512);
> > +
> >   static const char zBegin[] = "<<<<<<< BEGIN MERGE CONFLICT\n";
> >   static const char zMid[]   = "============================\n";
> >   static const char zEnd[]   = ">>>>>>> END MERGE CONFLICT\n";
> > +
> > +  char *zLeftComment  = db_text(0, "SELECT comment FROM event where
> objid=%d", vid);
> > +  char *zRightComment = db_text(0, "SELECT comment FROM event where
> objid=%d", mid);
> > +  char *zLeftUuid     = db_text(0, "SELECT uuid FROM blob WHERE
> rid=%d", vid);
> > +  char *zRightUuid    = db_text(0, "SELECT uuid FROM blob WHERE
> rid=%d", mid);
> > +
> > +  snprintf(zLeft,  512, "<<<<<<< %s\n<<<<<<< %s\n", zLeftUuid,
> zLeftComment);
> > +  snprintf(zRight, 512, "<<<<<<< %s\n<<<<<<< %s\n", zRightUuid,
> zRightComment);
> >
> >   blob_zero(pOut);         /* Merge results stored in pOut */
> >
> >   /* Compute the edits that occur from pPivot => pV1 (into aC1)
> >   ** and pPivot => pV2 (into aC2).  Each of the aC1 and aC2 arrays is
> > @@ -259,12 +271,14 @@
> >       while( !ends_at_CPY(&aC1[i1], sz) || !ends_at_CPY(&aC2[i2], sz) ){
> >         sz++;
> >       }
> >       DEBUG( printf("CONFLICT %d\n", sz); )
> >       blob_appendf(pOut, zBegin);
> > +      blob_appendf(pOut, zLeft);
> >       i1 = output_one_side(pOut, pV1, aC1, i1, sz);
> >       blob_appendf(pOut, zMid);
> > +      blob_appendf(pOut, zRight);
> >       i2 = output_one_side(pOut, pV2, aC2, i2, sz);
> >       blob_appendf(pOut, zEnd);
> >       blob_copy_lines(0, pPivot, sz);
> >     }
> >
> > @@ -290,10 +304,12 @@
> >     blob_copy_lines(pOut, pV2, aC2[i2+2]);
> >   }
> >
> >   free(aC1);
> >   free(aC2);
> > +  free(zLeft);
> > +  free(zRight);
> >   return nConflict;
> >  }
> >
> >  /*
> >  ** COMMAND:  test-3-way-merge
> > @@ -316,15 +332,15 @@
> >   }
> >   if( blob_read_from_file(&v2, g.argv[4])<0 ){
> >     fprintf(stderr,"cannot read %s\n", g.argv[4]);
> >     fossil_exit(1);
> >   }
> > -  blob_merge(&pivot, &v1, &v2, &merged);
> > +  blob_merge(&pivot, &v1, &v2, &merged, 0, 0);
> >   if( blob_write_to_file(&merged, g.argv[5])<blob_size(&merged) ){
> >     fprintf(stderr,"cannot write %s\n", g.argv[4]);
> >     fossil_exit(1);
> >   }
> >   blob_reset(&pivot);
> >   blob_reset(&v1);
> >   blob_reset(&v2);
> >   blob_reset(&merged);
> >  }
> >
> > Index: src/update.c
> > ===================================================================
> > --- src/update.c
> > +++ src/update.c
> > @@ -263,11 +263,11 @@
> >       undo_save(zName);
> >       content_get(ridt, &t);
> >       content_get(ridv, &v);
> >       blob_zero(&e);
> >       blob_read_from_file(&e, zFullPath);
> > -      rc = blob_merge(&v, &e, &t, &r);
> > +      rc = blob_merge(&v, &e, &t, &r, vid, tid);
> >       if( rc>=0 ){
> >         if( !nochangeFlag ) blob_write_to_file(&r, zFullPath);
> >         if( rc>0 ){
> >           printf("***** %d merge conflicts in %s\n", rc, zName);
> >         }
> >
> > _______________________________________________
> > fossil-users mailing list
> > [email protected]
> > http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
> >
> _______________________________________________
> fossil-users mailing list
> [email protected]
> http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to