Fossil SCM
Enhance the "fossil 3-way-merge" command to output a warning in the event of merge conflicts.
Commit
9e17c686f57e82e784d065c3a13bdd60987791f479d28816f451bb9ba7a4caca
Parent
8e27a5a084a55f1…
1 file changed
+3
-1
+3
-1
| --- src/merge3.c | ||
| +++ src/merge3.c | ||
| @@ -368,10 +368,11 @@ | ||
| 368 | 368 | ** fossil commit |
| 369 | 369 | ** |
| 370 | 370 | */ |
| 371 | 371 | void delta_3waymerge_cmd(void){ |
| 372 | 372 | Blob pivot, v1, v2, merged; |
| 373 | + int nConflict; | |
| 373 | 374 | |
| 374 | 375 | /* We should be done with options.. */ |
| 375 | 376 | verify_all_options(); |
| 376 | 377 | |
| 377 | 378 | if( g.argc!=6 ){ |
| @@ -384,18 +385,19 @@ | ||
| 384 | 385 | fossil_fatal("cannot read %s", g.argv[3]); |
| 385 | 386 | } |
| 386 | 387 | if( blob_read_from_file(&v2, g.argv[4])<0 ){ |
| 387 | 388 | fossil_fatal("cannot read %s", g.argv[4]); |
| 388 | 389 | } |
| 389 | - blob_merge(&pivot, &v1, &v2, &merged); | |
| 390 | + nConflict = blob_merge(&pivot, &v1, &v2, &merged); | |
| 390 | 391 | if( blob_write_to_file(&merged, g.argv[5])<blob_size(&merged) ){ |
| 391 | 392 | fossil_fatal("cannot write %s", g.argv[4]); |
| 392 | 393 | } |
| 393 | 394 | blob_reset(&pivot); |
| 394 | 395 | blob_reset(&v1); |
| 395 | 396 | blob_reset(&v2); |
| 396 | 397 | blob_reset(&merged); |
| 398 | + if( nConflict>0 ) fossil_warning("WARNING: %d merge conflicts", nConflict); | |
| 397 | 399 | } |
| 398 | 400 | |
| 399 | 401 | /* |
| 400 | 402 | ** aSubst is an array of string pairs. The first element of each pair is |
| 401 | 403 | ** a string that begins with %. The second element is a replacement for that |
| 402 | 404 |
| --- 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 |