Fossil SCM

For the update command, skip calls into the 'undo' subsystem when the -n (dry-run) flag is used.

mistachkin 2015-07-15 19:38 trunk
Commit d795eb0b6010d4c19b89601f63a9b39b3423919b
1 file changed +5 -5
+5 -5
--- src/update.c
+++ src/update.c
@@ -424,26 +424,26 @@
424424
fossil_print("ADD %s - overwrites an unmanaged file\n", zName);
425425
nOverwrite++;
426426
}else{
427427
fossil_print("ADD %s\n", zName);
428428
}
429
- undo_save(zName);
429
+ if( !dryRunFlag && !internalUpdate ) undo_save(zName);
430430
if( !dryRunFlag ) vfile_to_disk(0, idt, 0, 0);
431431
}else if( idt>0 && idv>0 && ridt!=ridv && (chnged==0 || deleted) ){
432432
/* The file is unedited. Change it to the target version */
433
- undo_save(zName);
434433
if( deleted ){
435434
fossil_print("UPDATE %s - change to unmanaged file\n", zName);
436435
}else{
437436
fossil_print("UPDATE %s\n", zName);
438437
}
438
+ if( !dryRunFlag && !internalUpdate ) undo_save(zName);
439439
if( !dryRunFlag ) vfile_to_disk(0, idt, 0, 0);
440440
}else if( idt>0 && idv>0 && !deleted && file_wd_size(zFullPath)<0 ){
441441
/* The file missing from the local check-out. Restore it to the
442442
** version that appears in the target. */
443443
fossil_print("UPDATE %s\n", zName);
444
- undo_save(zName);
444
+ if( !dryRunFlag && !internalUpdate ) undo_save(zName);
445445
if( !dryRunFlag ) vfile_to_disk(0, idt, 0, 0);
446446
}else if( idt==0 && idv>0 ){
447447
if( ridv==0 ){
448448
/* Added in current checkout. Continue to hold the file as
449449
** as an addition */
@@ -454,11 +454,11 @@
454454
fossil_print("CONFLICT %s - edited locally but deleted by update\n",
455455
zName);
456456
nConflict++;
457457
}else{
458458
fossil_print("REMOVE %s\n", zName);
459
- undo_save(zName);
459
+ if( !dryRunFlag && !internalUpdate ) undo_save(zName);
460460
if( !dryRunFlag ) file_delete(zFullPath);
461461
}
462462
}else if( idt>0 && idv>0 && ridt!=ridv && chnged ){
463463
/* Merge the changes in the current tree into the target version */
464464
Blob r, t, v;
@@ -471,11 +471,11 @@
471471
if( islinkv || islinkt /* || file_wd_islink(zFullPath) */ ){
472472
fossil_print("***** Cannot merge symlink %s\n", zNewName);
473473
nConflict++;
474474
}else{
475475
unsigned mergeFlags = dryRunFlag ? MERGE_DRYRUN : 0;
476
- undo_save(zName);
476
+ if( !dryRunFlag && !internalUpdate ) undo_save(zName);
477477
content_get(ridt, &t);
478478
content_get(ridv, &v);
479479
rc = merge_3way(&v, zFullPath, &t, &r, mergeFlags);
480480
if( rc>=0 ){
481481
if( !dryRunFlag ){
482482
--- 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

Keyboard Shortcuts

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