Fossil SCM
For the update command, skip calls into the 'undo' subsystem when the -n (dry-run) flag is used.
Commit
d795eb0b6010d4c19b89601f63a9b39b3423919b
Parent
91ee04cf2718a47…
1 file changed
+5
-5
+5
-5
| --- src/update.c | ||
| +++ src/update.c | ||
| @@ -424,26 +424,26 @@ | ||
| 424 | 424 | fossil_print("ADD %s - overwrites an unmanaged file\n", zName); |
| 425 | 425 | nOverwrite++; |
| 426 | 426 | }else{ |
| 427 | 427 | fossil_print("ADD %s\n", zName); |
| 428 | 428 | } |
| 429 | - undo_save(zName); | |
| 429 | + if( !dryRunFlag && !internalUpdate ) undo_save(zName); | |
| 430 | 430 | if( !dryRunFlag ) vfile_to_disk(0, idt, 0, 0); |
| 431 | 431 | }else if( idt>0 && idv>0 && ridt!=ridv && (chnged==0 || deleted) ){ |
| 432 | 432 | /* The file is unedited. Change it to the target version */ |
| 433 | - undo_save(zName); | |
| 434 | 433 | if( deleted ){ |
| 435 | 434 | fossil_print("UPDATE %s - change to unmanaged file\n", zName); |
| 436 | 435 | }else{ |
| 437 | 436 | fossil_print("UPDATE %s\n", zName); |
| 438 | 437 | } |
| 438 | + if( !dryRunFlag && !internalUpdate ) undo_save(zName); | |
| 439 | 439 | if( !dryRunFlag ) vfile_to_disk(0, idt, 0, 0); |
| 440 | 440 | }else if( idt>0 && idv>0 && !deleted && file_wd_size(zFullPath)<0 ){ |
| 441 | 441 | /* The file missing from the local check-out. Restore it to the |
| 442 | 442 | ** version that appears in the target. */ |
| 443 | 443 | fossil_print("UPDATE %s\n", zName); |
| 444 | - undo_save(zName); | |
| 444 | + if( !dryRunFlag && !internalUpdate ) undo_save(zName); | |
| 445 | 445 | if( !dryRunFlag ) vfile_to_disk(0, idt, 0, 0); |
| 446 | 446 | }else if( idt==0 && idv>0 ){ |
| 447 | 447 | if( ridv==0 ){ |
| 448 | 448 | /* Added in current checkout. Continue to hold the file as |
| 449 | 449 | ** as an addition */ |
| @@ -454,11 +454,11 @@ | ||
| 454 | 454 | fossil_print("CONFLICT %s - edited locally but deleted by update\n", |
| 455 | 455 | zName); |
| 456 | 456 | nConflict++; |
| 457 | 457 | }else{ |
| 458 | 458 | fossil_print("REMOVE %s\n", zName); |
| 459 | - undo_save(zName); | |
| 459 | + if( !dryRunFlag && !internalUpdate ) undo_save(zName); | |
| 460 | 460 | if( !dryRunFlag ) file_delete(zFullPath); |
| 461 | 461 | } |
| 462 | 462 | }else if( idt>0 && idv>0 && ridt!=ridv && chnged ){ |
| 463 | 463 | /* Merge the changes in the current tree into the target version */ |
| 464 | 464 | Blob r, t, v; |
| @@ -471,11 +471,11 @@ | ||
| 471 | 471 | if( islinkv || islinkt /* || file_wd_islink(zFullPath) */ ){ |
| 472 | 472 | fossil_print("***** Cannot merge symlink %s\n", zNewName); |
| 473 | 473 | nConflict++; |
| 474 | 474 | }else{ |
| 475 | 475 | unsigned mergeFlags = dryRunFlag ? MERGE_DRYRUN : 0; |
| 476 | - undo_save(zName); | |
| 476 | + if( !dryRunFlag && !internalUpdate ) undo_save(zName); | |
| 477 | 477 | content_get(ridt, &t); |
| 478 | 478 | content_get(ridv, &v); |
| 479 | 479 | rc = merge_3way(&v, zFullPath, &t, &r, mergeFlags); |
| 480 | 480 | if( rc>=0 ){ |
| 481 | 481 | if( !dryRunFlag ){ |
| 482 | 482 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -424,26 +424,26 @@ | |
| 424 | fossil_print("ADD %s - overwrites an unmanaged file\n", zName); |
| 425 | nOverwrite++; |
| 426 | }else{ |
| 427 | fossil_print("ADD %s\n", zName); |
| 428 | } |
| 429 | undo_save(zName); |
| 430 | if( !dryRunFlag ) vfile_to_disk(0, idt, 0, 0); |
| 431 | }else if( idt>0 && idv>0 && ridt!=ridv && (chnged==0 || deleted) ){ |
| 432 | /* The file is unedited. Change it to the target version */ |
| 433 | undo_save(zName); |
| 434 | if( deleted ){ |
| 435 | fossil_print("UPDATE %s - change to unmanaged file\n", zName); |
| 436 | }else{ |
| 437 | fossil_print("UPDATE %s\n", zName); |
| 438 | } |
| 439 | if( !dryRunFlag ) vfile_to_disk(0, idt, 0, 0); |
| 440 | }else if( idt>0 && idv>0 && !deleted && file_wd_size(zFullPath)<0 ){ |
| 441 | /* The file missing from the local check-out. Restore it to the |
| 442 | ** version that appears in the target. */ |
| 443 | fossil_print("UPDATE %s\n", zName); |
| 444 | undo_save(zName); |
| 445 | if( !dryRunFlag ) vfile_to_disk(0, idt, 0, 0); |
| 446 | }else if( idt==0 && idv>0 ){ |
| 447 | if( ridv==0 ){ |
| 448 | /* Added in current checkout. Continue to hold the file as |
| 449 | ** as an addition */ |
| @@ -454,11 +454,11 @@ | |
| 454 | fossil_print("CONFLICT %s - edited locally but deleted by update\n", |
| 455 | zName); |
| 456 | nConflict++; |
| 457 | }else{ |
| 458 | fossil_print("REMOVE %s\n", zName); |
| 459 | undo_save(zName); |
| 460 | if( !dryRunFlag ) file_delete(zFullPath); |
| 461 | } |
| 462 | }else if( idt>0 && idv>0 && ridt!=ridv && chnged ){ |
| 463 | /* Merge the changes in the current tree into the target version */ |
| 464 | Blob r, t, v; |
| @@ -471,11 +471,11 @@ | |
| 471 | if( islinkv || islinkt /* || file_wd_islink(zFullPath) */ ){ |
| 472 | fossil_print("***** Cannot merge symlink %s\n", zNewName); |
| 473 | nConflict++; |
| 474 | }else{ |
| 475 | unsigned mergeFlags = dryRunFlag ? MERGE_DRYRUN : 0; |
| 476 | undo_save(zName); |
| 477 | content_get(ridt, &t); |
| 478 | content_get(ridv, &v); |
| 479 | rc = merge_3way(&v, zFullPath, &t, &r, mergeFlags); |
| 480 | if( rc>=0 ){ |
| 481 | if( !dryRunFlag ){ |
| 482 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -424,26 +424,26 @@ | |
| 424 | fossil_print("ADD %s - overwrites an unmanaged file\n", zName); |
| 425 | nOverwrite++; |
| 426 | }else{ |
| 427 | fossil_print("ADD %s\n", zName); |
| 428 | } |
| 429 | if( !dryRunFlag && !internalUpdate ) undo_save(zName); |
| 430 | if( !dryRunFlag ) vfile_to_disk(0, idt, 0, 0); |
| 431 | }else if( idt>0 && idv>0 && ridt!=ridv && (chnged==0 || deleted) ){ |
| 432 | /* The file is unedited. Change it to the target version */ |
| 433 | if( deleted ){ |
| 434 | fossil_print("UPDATE %s - change to unmanaged file\n", zName); |
| 435 | }else{ |
| 436 | fossil_print("UPDATE %s\n", zName); |
| 437 | } |
| 438 | if( !dryRunFlag && !internalUpdate ) undo_save(zName); |
| 439 | if( !dryRunFlag ) vfile_to_disk(0, idt, 0, 0); |
| 440 | }else if( idt>0 && idv>0 && !deleted && file_wd_size(zFullPath)<0 ){ |
| 441 | /* The file missing from the local check-out. Restore it to the |
| 442 | ** version that appears in the target. */ |
| 443 | fossil_print("UPDATE %s\n", zName); |
| 444 | if( !dryRunFlag && !internalUpdate ) undo_save(zName); |
| 445 | if( !dryRunFlag ) vfile_to_disk(0, idt, 0, 0); |
| 446 | }else if( idt==0 && idv>0 ){ |
| 447 | if( ridv==0 ){ |
| 448 | /* Added in current checkout. Continue to hold the file as |
| 449 | ** as an addition */ |
| @@ -454,11 +454,11 @@ | |
| 454 | fossil_print("CONFLICT %s - edited locally but deleted by update\n", |
| 455 | zName); |
| 456 | nConflict++; |
| 457 | }else{ |
| 458 | fossil_print("REMOVE %s\n", zName); |
| 459 | if( !dryRunFlag && !internalUpdate ) undo_save(zName); |
| 460 | if( !dryRunFlag ) file_delete(zFullPath); |
| 461 | } |
| 462 | }else if( idt>0 && idv>0 && ridt!=ridv && chnged ){ |
| 463 | /* Merge the changes in the current tree into the target version */ |
| 464 | Blob r, t, v; |
| @@ -471,11 +471,11 @@ | |
| 471 | if( islinkv || islinkt /* || file_wd_islink(zFullPath) */ ){ |
| 472 | fossil_print("***** Cannot merge symlink %s\n", zNewName); |
| 473 | nConflict++; |
| 474 | }else{ |
| 475 | unsigned mergeFlags = dryRunFlag ? MERGE_DRYRUN : 0; |
| 476 | if( !dryRunFlag && !internalUpdate ) undo_save(zName); |
| 477 | content_get(ridt, &t); |
| 478 | content_get(ridv, &v); |
| 479 | rc = merge_3way(&v, zFullPath, &t, &r, mergeFlags); |
| 480 | if( rc>=0 ){ |
| 481 | if( !dryRunFlag ){ |
| 482 |