Fossil SCM

Enhance the "fossil 3-way-merge" command to output a warning in the event of merge conflicts.

drh 2017-05-13 18:00 trunk
Commit 9e17c686f57e82e784d065c3a13bdd60987791f479d28816f451bb9ba7a4caca
1 file changed +3 -1
+3 -1
--- src/merge3.c
+++ src/merge3.c
@@ -368,10 +368,11 @@
368368
** fossil commit
369369
**
370370
*/
371371
void delta_3waymerge_cmd(void){
372372
Blob pivot, v1, v2, merged;
373
+ int nConflict;
373374
374375
/* We should be done with options.. */
375376
verify_all_options();
376377
377378
if( g.argc!=6 ){
@@ -384,18 +385,19 @@
384385
fossil_fatal("cannot read %s", g.argv[3]);
385386
}
386387
if( blob_read_from_file(&v2, g.argv[4])<0 ){
387388
fossil_fatal("cannot read %s", g.argv[4]);
388389
}
389
- blob_merge(&pivot, &v1, &v2, &merged);
390
+ nConflict = blob_merge(&pivot, &v1, &v2, &merged);
390391
if( blob_write_to_file(&merged, g.argv[5])<blob_size(&merged) ){
391392
fossil_fatal("cannot write %s", g.argv[4]);
392393
}
393394
blob_reset(&pivot);
394395
blob_reset(&v1);
395396
blob_reset(&v2);
396397
blob_reset(&merged);
398
+ if( nConflict>0 ) fossil_warning("WARNING: %d merge conflicts", nConflict);
397399
}
398400
399401
/*
400402
** aSubst is an array of string pairs. The first element of each pair is
401403
** a string that begins with %. The second element is a replacement for that
402404
--- src/merge3.c
+++ src/merge3.c
@@ -368,10 +368,11 @@
368 ** fossil commit
369 **
370 */
371 void delta_3waymerge_cmd(void){
372 Blob pivot, v1, v2, merged;
 
373
374 /* We should be done with options.. */
375 verify_all_options();
376
377 if( g.argc!=6 ){
@@ -384,18 +385,19 @@
384 fossil_fatal("cannot read %s", g.argv[3]);
385 }
386 if( blob_read_from_file(&v2, g.argv[4])<0 ){
387 fossil_fatal("cannot read %s", g.argv[4]);
388 }
389 blob_merge(&pivot, &v1, &v2, &merged);
390 if( blob_write_to_file(&merged, g.argv[5])<blob_size(&merged) ){
391 fossil_fatal("cannot write %s", g.argv[4]);
392 }
393 blob_reset(&pivot);
394 blob_reset(&v1);
395 blob_reset(&v2);
396 blob_reset(&merged);
 
397 }
398
399 /*
400 ** aSubst is an array of string pairs. The first element of each pair is
401 ** a string that begins with %. The second element is a replacement for that
402
--- src/merge3.c
+++ src/merge3.c
@@ -368,10 +368,11 @@
368 ** fossil commit
369 **
370 */
371 void delta_3waymerge_cmd(void){
372 Blob pivot, v1, v2, merged;
373 int nConflict;
374
375 /* We should be done with options.. */
376 verify_all_options();
377
378 if( g.argc!=6 ){
@@ -384,18 +385,19 @@
385 fossil_fatal("cannot read %s", g.argv[3]);
386 }
387 if( blob_read_from_file(&v2, g.argv[4])<0 ){
388 fossil_fatal("cannot read %s", g.argv[4]);
389 }
390 nConflict = blob_merge(&pivot, &v1, &v2, &merged);
391 if( blob_write_to_file(&merged, g.argv[5])<blob_size(&merged) ){
392 fossil_fatal("cannot write %s", g.argv[4]);
393 }
394 blob_reset(&pivot);
395 blob_reset(&v1);
396 blob_reset(&v2);
397 blob_reset(&merged);
398 if( nConflict>0 ) fossil_warning("WARNING: %d merge conflicts", nConflict);
399 }
400
401 /*
402 ** aSubst is an array of string pairs. The first element of each pair is
403 ** a string that begins with %. The second element is a replacement for that
404

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button