Fossil SCM
Leave the -original, -baseline, and -merge files around when an update or merge conflicts due to binary files.
Commit
471044f66417daddc61cd0b16b3208da43e9de65
Parent
116694817391b3d…
2 files changed
+10
-4
+1
-1
+10
-4
| --- src/merge3.c | ||
| +++ src/merge3.c | ||
| @@ -395,25 +395,29 @@ | ||
| 395 | 395 | Blob *pV2, /* Version merging from (yours) */ |
| 396 | 396 | Blob *pOut /* Output written here */ |
| 397 | 397 | ){ |
| 398 | 398 | Blob v1; /* Content of zV1 */ |
| 399 | 399 | int rc; /* Return code of subroutines and this routine */ |
| 400 | + char *zPivot; /* Name of the pivot file */ | |
| 401 | + char *zOrig; /* Name of the original content file */ | |
| 402 | + char *zOther; /* Name of the merge file */ | |
| 400 | 403 | |
| 401 | 404 | blob_read_from_file(&v1, zV1); |
| 402 | 405 | rc = blob_merge(pPivot, &v1, pV2, pOut); |
| 403 | - if( rc>0 ){ | |
| 404 | - char *zPivot; /* Name of the pivot file */ | |
| 405 | - char *zOrig; /* Name of the original content file */ | |
| 406 | - char *zOther; /* Name of the merge file */ | |
| 406 | + if( rc!=0 ){ | |
| 407 | 407 | const char *zGMerge; /* Name of the gmerge command */ |
| 408 | 408 | |
| 409 | 409 | zPivot = file_newname(zV1, "baseline", 1); |
| 410 | 410 | blob_write_to_file(pPivot, zPivot); |
| 411 | 411 | zOrig = file_newname(zV1, "original", 1); |
| 412 | 412 | blob_write_to_file(&v1, zOrig); |
| 413 | 413 | zOther = file_newname(zV1, "merge", 1); |
| 414 | 414 | blob_write_to_file(pV2, zOther); |
| 415 | + } | |
| 416 | + if( rc>0 ){ | |
| 417 | + const char *zGMerge; /* Name of the gmerge command */ | |
| 418 | + | |
| 415 | 419 | zGMerge = db_get("gmerge-command", 0); |
| 416 | 420 | if( zGMerge && zGMerge[0] ){ |
| 417 | 421 | char *zOut; /* Temporary output file */ |
| 418 | 422 | char *zCmd; /* Command to invoke */ |
| 419 | 423 | const char *azSubst[8]; /* Strings to be substituted */ |
| @@ -434,12 +438,14 @@ | ||
| 434 | 438 | file_delete(zOut); |
| 435 | 439 | } |
| 436 | 440 | fossil_free(zCmd); |
| 437 | 441 | fossil_free(zOut); |
| 438 | 442 | } |
| 443 | + } | |
| 444 | + if( rc!=0 ){ | |
| 439 | 445 | fossil_free(zPivot); |
| 440 | 446 | fossil_free(zOrig); |
| 441 | 447 | fossil_free(zOther); |
| 442 | 448 | } |
| 443 | 449 | blob_reset(&v1); |
| 444 | 450 | return rc; |
| 445 | 451 | } |
| 446 | 452 |
| --- src/merge3.c | |
| +++ src/merge3.c | |
| @@ -395,25 +395,29 @@ | |
| 395 | Blob *pV2, /* Version merging from (yours) */ |
| 396 | Blob *pOut /* Output written here */ |
| 397 | ){ |
| 398 | Blob v1; /* Content of zV1 */ |
| 399 | int rc; /* Return code of subroutines and this routine */ |
| 400 | |
| 401 | blob_read_from_file(&v1, zV1); |
| 402 | rc = blob_merge(pPivot, &v1, pV2, pOut); |
| 403 | if( rc>0 ){ |
| 404 | char *zPivot; /* Name of the pivot file */ |
| 405 | char *zOrig; /* Name of the original content file */ |
| 406 | char *zOther; /* Name of the merge file */ |
| 407 | const char *zGMerge; /* Name of the gmerge command */ |
| 408 | |
| 409 | zPivot = file_newname(zV1, "baseline", 1); |
| 410 | blob_write_to_file(pPivot, zPivot); |
| 411 | zOrig = file_newname(zV1, "original", 1); |
| 412 | blob_write_to_file(&v1, zOrig); |
| 413 | zOther = file_newname(zV1, "merge", 1); |
| 414 | blob_write_to_file(pV2, zOther); |
| 415 | zGMerge = db_get("gmerge-command", 0); |
| 416 | if( zGMerge && zGMerge[0] ){ |
| 417 | char *zOut; /* Temporary output file */ |
| 418 | char *zCmd; /* Command to invoke */ |
| 419 | const char *azSubst[8]; /* Strings to be substituted */ |
| @@ -434,12 +438,14 @@ | |
| 434 | file_delete(zOut); |
| 435 | } |
| 436 | fossil_free(zCmd); |
| 437 | fossil_free(zOut); |
| 438 | } |
| 439 | fossil_free(zPivot); |
| 440 | fossil_free(zOrig); |
| 441 | fossil_free(zOther); |
| 442 | } |
| 443 | blob_reset(&v1); |
| 444 | return rc; |
| 445 | } |
| 446 |
| --- src/merge3.c | |
| +++ src/merge3.c | |
| @@ -395,25 +395,29 @@ | |
| 395 | Blob *pV2, /* Version merging from (yours) */ |
| 396 | Blob *pOut /* Output written here */ |
| 397 | ){ |
| 398 | Blob v1; /* Content of zV1 */ |
| 399 | int rc; /* Return code of subroutines and this routine */ |
| 400 | char *zPivot; /* Name of the pivot file */ |
| 401 | char *zOrig; /* Name of the original content file */ |
| 402 | char *zOther; /* Name of the merge file */ |
| 403 | |
| 404 | blob_read_from_file(&v1, zV1); |
| 405 | rc = blob_merge(pPivot, &v1, pV2, pOut); |
| 406 | if( rc!=0 ){ |
| 407 | const char *zGMerge; /* Name of the gmerge command */ |
| 408 | |
| 409 | zPivot = file_newname(zV1, "baseline", 1); |
| 410 | blob_write_to_file(pPivot, zPivot); |
| 411 | zOrig = file_newname(zV1, "original", 1); |
| 412 | blob_write_to_file(&v1, zOrig); |
| 413 | zOther = file_newname(zV1, "merge", 1); |
| 414 | blob_write_to_file(pV2, zOther); |
| 415 | } |
| 416 | if( rc>0 ){ |
| 417 | const char *zGMerge; /* Name of the gmerge command */ |
| 418 | |
| 419 | zGMerge = db_get("gmerge-command", 0); |
| 420 | if( zGMerge && zGMerge[0] ){ |
| 421 | char *zOut; /* Temporary output file */ |
| 422 | char *zCmd; /* Command to invoke */ |
| 423 | const char *azSubst[8]; /* Strings to be substituted */ |
| @@ -434,12 +438,14 @@ | |
| 438 | file_delete(zOut); |
| 439 | } |
| 440 | fossil_free(zCmd); |
| 441 | fossil_free(zOut); |
| 442 | } |
| 443 | } |
| 444 | if( rc!=0 ){ |
| 445 | fossil_free(zPivot); |
| 446 | fossil_free(zOrig); |
| 447 | fossil_free(zOther); |
| 448 | } |
| 449 | blob_reset(&v1); |
| 450 | return rc; |
| 451 | } |
| 452 |
+1
-1
| --- src/update.c | ||
| +++ src/update.c | ||
| @@ -474,11 +474,11 @@ | ||
| 474 | 474 | if( nConflict ){ |
| 475 | 475 | if( internalUpdate ){ |
| 476 | 476 | internalConflictCnt = nConflict; |
| 477 | 477 | nConflict = 0; |
| 478 | 478 | }else{ |
| 479 | - fossil_print("WARNING: %d merge conflicts", nConflict); | |
| 479 | + fossil_warning("WARNING: %d merge conflicts", nConflict); | |
| 480 | 480 | } |
| 481 | 481 | } |
| 482 | 482 | if( nOverwrite ){ |
| 483 | 483 | fossil_warning("WARNING: %d unmanaged files were overwritten", |
| 484 | 484 | nOverwrite); |
| 485 | 485 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -474,11 +474,11 @@ | |
| 474 | if( nConflict ){ |
| 475 | if( internalUpdate ){ |
| 476 | internalConflictCnt = nConflict; |
| 477 | nConflict = 0; |
| 478 | }else{ |
| 479 | fossil_print("WARNING: %d merge conflicts", nConflict); |
| 480 | } |
| 481 | } |
| 482 | if( nOverwrite ){ |
| 483 | fossil_warning("WARNING: %d unmanaged files were overwritten", |
| 484 | nOverwrite); |
| 485 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -474,11 +474,11 @@ | |
| 474 | if( nConflict ){ |
| 475 | if( internalUpdate ){ |
| 476 | internalConflictCnt = nConflict; |
| 477 | nConflict = 0; |
| 478 | }else{ |
| 479 | fossil_warning("WARNING: %d merge conflicts", nConflict); |
| 480 | } |
| 481 | } |
| 482 | if( nOverwrite ){ |
| 483 | fossil_warning("WARNING: %d unmanaged files were overwritten", |
| 484 | nOverwrite); |
| 485 |