| | @@ -406,10 +406,17 @@ |
| 406 | 406 | } |
| 407 | 407 | } |
| 408 | 408 | return blob_str(&x); |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | +#if INTERFACE |
| 412 | +/* |
| 413 | +** Flags to the 3-way merger |
| 414 | +*/ |
| 415 | +#define MERGE_DRYRUN 0x0001 |
| 416 | +#endif |
| 417 | + |
| 411 | 418 | |
| 412 | 419 | /* |
| 413 | 420 | ** This routine is a wrapper around blob_merge() with the following |
| 414 | 421 | ** enhancements: |
| 415 | 422 | ** |
| | @@ -428,29 +435,30 @@ |
| 428 | 435 | */ |
| 429 | 436 | int merge_3way( |
| 430 | 437 | Blob *pPivot, /* Common ancestor (older) */ |
| 431 | 438 | const char *zV1, /* Name of file for version merging into (mine) */ |
| 432 | 439 | Blob *pV2, /* Version merging from (yours) */ |
| 433 | | - Blob *pOut /* Output written here */ |
| 440 | + Blob *pOut, /* Output written here */ |
| 441 | + unsigned mergeFlags /* Flags that control operation */ |
| 434 | 442 | ){ |
| 435 | 443 | Blob v1; /* Content of zV1 */ |
| 436 | 444 | int rc; /* Return code of subroutines and this routine */ |
| 437 | 445 | char *zPivot; /* Name of the pivot file */ |
| 438 | 446 | char *zOrig; /* Name of the original content file */ |
| 439 | 447 | char *zOther; /* Name of the merge file */ |
| 440 | 448 | |
| 441 | 449 | blob_read_from_file(&v1, zV1); |
| 442 | 450 | rc = blob_merge(pPivot, &v1, pV2, pOut); |
| 443 | | - if( rc!=0 ){ |
| 451 | + if( rc!=0 && (mergeFlags & MERGE_DRYRUN)==0 ){ |
| 444 | 452 | zPivot = file_newname(zV1, "baseline", 1); |
| 445 | 453 | blob_write_to_file(pPivot, zPivot); |
| 446 | 454 | zOrig = file_newname(zV1, "original", 1); |
| 447 | 455 | blob_write_to_file(&v1, zOrig); |
| 448 | 456 | zOther = file_newname(zV1, "merge", 1); |
| 449 | 457 | blob_write_to_file(pV2, zOther); |
| 450 | 458 | } |
| 451 | | - if( rc>0 ){ |
| 459 | + if( rc>0 && (mergeFlags & MERGE_DRYRUN)==0 ){ |
| 452 | 460 | const char *zGMerge; /* Name of the gmerge command */ |
| 453 | 461 | |
| 454 | 462 | zGMerge = db_get("gmerge-command", 0); |
| 455 | 463 | if( zGMerge && zGMerge[0] ){ |
| 456 | 464 | char *zOut; /* Temporary output file */ |
| | @@ -474,13 +482,13 @@ |
| 474 | 482 | } |
| 475 | 483 | fossil_free(zCmd); |
| 476 | 484 | fossil_free(zOut); |
| 477 | 485 | } |
| 478 | 486 | } |
| 479 | | - if( rc!=0 ){ |
| 487 | + if( rc!=0 && (mergeFlags & MERGE_DRYRUN)==0 ){ |
| 480 | 488 | fossil_free(zPivot); |
| 481 | 489 | fossil_free(zOrig); |
| 482 | 490 | fossil_free(zOther); |
| 483 | 491 | } |
| 484 | 492 | blob_reset(&v1); |
| 485 | 493 | return rc; |
| 486 | 494 | } |
| 487 | 495 | |