Fossil SCM

Improved documentation on the undo command. Have the mv command clear the undo stack.

drh 2019-12-03 13:06 trunk
Commit 3f8cdaa15ecc13e63a14f34fd9ca507e0fd94452586943ae92e8844a26493ed7
2 files changed +2 -1 +17 -6
+2 -1
--- src/add.c
+++ src/add.c
@@ -936,11 +936,11 @@
936936
zOrig = blob_str(&orig);
937937
nOrig = blob_size(&orig);
938938
db_prepare(&q,
939939
"SELECT pathname FROM vfile"
940940
" WHERE vid=%d"
941
- " AND (pathname='%q' %s OR (pathname>'%q/' %s AND pathname<'%q0' %s))"
941
+ " AND (pathname='%q' %s OR (pathname>'%q/' %s AND pathname<'%q0' %s))"
942942
" ORDER BY 1",
943943
vid, zOrig, filename_collation(), zOrig, filename_collation(),
944944
zOrig, filename_collation()
945945
);
946946
while( db_step(&q)==SQLITE_ROW ){
@@ -968,10 +968,11 @@
968968
const char *zTo = db_column_text(&q, 1);
969969
mv_one_file(vid, zFrom, zTo, dryRunFlag);
970970
if( moveFiles ) add_file_to_move(zFrom, zTo);
971971
}
972972
db_finalize(&q);
973
+ undo_reset();
973974
db_end_transaction(0);
974975
if( moveFiles ) process_files_to_move(dryRunFlag);
975976
}
976977
977978
/*
978979
--- src/add.c
+++ src/add.c
@@ -936,11 +936,11 @@
936 zOrig = blob_str(&orig);
937 nOrig = blob_size(&orig);
938 db_prepare(&q,
939 "SELECT pathname FROM vfile"
940 " WHERE vid=%d"
941 " AND (pathname='%q' %s OR (pathname>'%q/' %s AND pathname<'%q0' %s))"
942 " ORDER BY 1",
943 vid, zOrig, filename_collation(), zOrig, filename_collation(),
944 zOrig, filename_collation()
945 );
946 while( db_step(&q)==SQLITE_ROW ){
@@ -968,10 +968,11 @@
968 const char *zTo = db_column_text(&q, 1);
969 mv_one_file(vid, zFrom, zTo, dryRunFlag);
970 if( moveFiles ) add_file_to_move(zFrom, zTo);
971 }
972 db_finalize(&q);
 
973 db_end_transaction(0);
974 if( moveFiles ) process_files_to_move(dryRunFlag);
975 }
976
977 /*
978
--- src/add.c
+++ src/add.c
@@ -936,11 +936,11 @@
936 zOrig = blob_str(&orig);
937 nOrig = blob_size(&orig);
938 db_prepare(&q,
939 "SELECT pathname FROM vfile"
940 " WHERE vid=%d"
941 " AND (pathname='%q' %s OR (pathname>'%q/' %s AND pathname<'%q0' %s))"
942 " ORDER BY 1",
943 vid, zOrig, filename_collation(), zOrig, filename_collation(),
944 zOrig, filename_collation()
945 );
946 while( db_step(&q)==SQLITE_ROW ){
@@ -968,10 +968,11 @@
968 const char *zTo = db_column_text(&q, 1);
969 mv_one_file(vid, zFrom, zTo, dryRunFlag);
970 if( moveFiles ) add_file_to_move(zFrom, zTo);
971 }
972 db_finalize(&q);
973 undo_reset();
974 db_end_transaction(0);
975 if( moveFiles ) process_files_to_move(dryRunFlag);
976 }
977
978 /*
979
+17 -6
--- src/undo.c
+++ src/undo.c
@@ -423,31 +423,42 @@
423423
** COMMAND: redo*
424424
**
425425
** Usage: %fossil undo ?OPTIONS? ?FILENAME...?
426426
** or: %fossil redo ?OPTIONS? ?FILENAME...?
427427
**
428
-** Undo the changes to the working checkout caused by the most recent
429
-** of the following operations:
428
+** The undo command reverts the changes caused by the previous command
429
+** if the previous command is one of the following:
430430
**
431431
** (1) fossil update (5) fossil stash apply
432432
** (2) fossil merge (6) fossil stash drop
433433
** (3) fossil revert (7) fossil stash goto
434
-** (4) fossil stash pop
434
+** (4) fossil stash pop (8) fossil clean (*see note*)
435435
**
436
-** The "fossil clean" operation can also be undone; however, this is
437
-** currently limited to files that are less than 10MiB in size.
436
+** Note: The "fossil clean" command only saves state for files less than
437
+** 10MiB in size and so if fossil clean deleted files larger than that,
438
+** then "fossil undo" will not recover the larger files.
438439
**
439440
** If FILENAME is specified then restore the content of the named
440441
** file(s) but otherwise leave the update or merge or revert in effect.
441442
** The redo command undoes the effect of the most recent undo.
442443
**
443444
** If the -n|--dry-run option is present, no changes are made and instead
444445
** the undo or redo command explains what actions the undo or redo would
445446
** have done had the -n|--dry-run been omitted.
447
+**
448
+** If the most recent command is not one of those listed as undoable,
449
+** then the undo command might try to restore the state to be what it was
450
+** prior to the last undoable command, or it might be a no-op. If in
451
+** doubt about what the undo command will do, first run it with the -n
452
+** option.
446453
**
447454
** A single level of undo/redo is supported. The undo/redo stack
448
-** is cleared by the commit and checkout commands.
455
+** is cleared by the commit and checkout commands. Other commands may
456
+** or may not clear the undo stack.
457
+**
458
+** Future versions of Fossil might add new commands to the set of commands
459
+** that are undoable.
449460
**
450461
** Options:
451462
** -n|--dry-run do not make changes but show what would be done
452463
**
453464
** See also: commit, status
454465
--- src/undo.c
+++ src/undo.c
@@ -423,31 +423,42 @@
423 ** COMMAND: redo*
424 **
425 ** Usage: %fossil undo ?OPTIONS? ?FILENAME...?
426 ** or: %fossil redo ?OPTIONS? ?FILENAME...?
427 **
428 ** Undo the changes to the working checkout caused by the most recent
429 ** of the following operations:
430 **
431 ** (1) fossil update (5) fossil stash apply
432 ** (2) fossil merge (6) fossil stash drop
433 ** (3) fossil revert (7) fossil stash goto
434 ** (4) fossil stash pop
435 **
436 ** The "fossil clean" operation can also be undone; however, this is
437 ** currently limited to files that are less than 10MiB in size.
 
438 **
439 ** If FILENAME is specified then restore the content of the named
440 ** file(s) but otherwise leave the update or merge or revert in effect.
441 ** The redo command undoes the effect of the most recent undo.
442 **
443 ** If the -n|--dry-run option is present, no changes are made and instead
444 ** the undo or redo command explains what actions the undo or redo would
445 ** have done had the -n|--dry-run been omitted.
 
 
 
 
 
 
446 **
447 ** A single level of undo/redo is supported. The undo/redo stack
448 ** is cleared by the commit and checkout commands.
 
 
 
 
449 **
450 ** Options:
451 ** -n|--dry-run do not make changes but show what would be done
452 **
453 ** See also: commit, status
454
--- src/undo.c
+++ src/undo.c
@@ -423,31 +423,42 @@
423 ** COMMAND: redo*
424 **
425 ** Usage: %fossil undo ?OPTIONS? ?FILENAME...?
426 ** or: %fossil redo ?OPTIONS? ?FILENAME...?
427 **
428 ** The undo command reverts the changes caused by the previous command
429 ** if the previous command is one of the following:
430 **
431 ** (1) fossil update (5) fossil stash apply
432 ** (2) fossil merge (6) fossil stash drop
433 ** (3) fossil revert (7) fossil stash goto
434 ** (4) fossil stash pop (8) fossil clean (*see note*)
435 **
436 ** Note: The "fossil clean" command only saves state for files less than
437 ** 10MiB in size and so if fossil clean deleted files larger than that,
438 ** then "fossil undo" will not recover the larger files.
439 **
440 ** If FILENAME is specified then restore the content of the named
441 ** file(s) but otherwise leave the update or merge or revert in effect.
442 ** The redo command undoes the effect of the most recent undo.
443 **
444 ** If the -n|--dry-run option is present, no changes are made and instead
445 ** the undo or redo command explains what actions the undo or redo would
446 ** have done had the -n|--dry-run been omitted.
447 **
448 ** If the most recent command is not one of those listed as undoable,
449 ** then the undo command might try to restore the state to be what it was
450 ** prior to the last undoable command, or it might be a no-op. If in
451 ** doubt about what the undo command will do, first run it with the -n
452 ** option.
453 **
454 ** A single level of undo/redo is supported. The undo/redo stack
455 ** is cleared by the commit and checkout commands. Other commands may
456 ** or may not clear the undo stack.
457 **
458 ** Future versions of Fossil might add new commands to the set of commands
459 ** that are undoable.
460 **
461 ** Options:
462 ** -n|--dry-run do not make changes but show what would be done
463 **
464 ** See also: commit, status
465

Keyboard Shortcuts

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