Fossil SCM
Improved documentation on the undo command. Have the mv command clear the undo stack.
Commit
3f8cdaa15ecc13e63a14f34fd9ca507e0fd94452586943ae92e8844a26493ed7
Parent
cad57db96e8c4c5…
2 files changed
+2
-1
+17
-6
+2
-1
| --- src/add.c | ||
| +++ src/add.c | ||
| @@ -936,11 +936,11 @@ | ||
| 936 | 936 | zOrig = blob_str(&orig); |
| 937 | 937 | nOrig = blob_size(&orig); |
| 938 | 938 | db_prepare(&q, |
| 939 | 939 | "SELECT pathname FROM vfile" |
| 940 | 940 | " 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))" | |
| 942 | 942 | " ORDER BY 1", |
| 943 | 943 | vid, zOrig, filename_collation(), zOrig, filename_collation(), |
| 944 | 944 | zOrig, filename_collation() |
| 945 | 945 | ); |
| 946 | 946 | while( db_step(&q)==SQLITE_ROW ){ |
| @@ -968,10 +968,11 @@ | ||
| 968 | 968 | const char *zTo = db_column_text(&q, 1); |
| 969 | 969 | mv_one_file(vid, zFrom, zTo, dryRunFlag); |
| 970 | 970 | if( moveFiles ) add_file_to_move(zFrom, zTo); |
| 971 | 971 | } |
| 972 | 972 | db_finalize(&q); |
| 973 | + undo_reset(); | |
| 973 | 974 | db_end_transaction(0); |
| 974 | 975 | if( moveFiles ) process_files_to_move(dryRunFlag); |
| 975 | 976 | } |
| 976 | 977 | |
| 977 | 978 | /* |
| 978 | 979 |
| --- 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 @@ | ||
| 423 | 423 | ** COMMAND: redo* |
| 424 | 424 | ** |
| 425 | 425 | ** Usage: %fossil undo ?OPTIONS? ?FILENAME...? |
| 426 | 426 | ** or: %fossil redo ?OPTIONS? ?FILENAME...? |
| 427 | 427 | ** |
| 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: | |
| 430 | 430 | ** |
| 431 | 431 | ** (1) fossil update (5) fossil stash apply |
| 432 | 432 | ** (2) fossil merge (6) fossil stash drop |
| 433 | 433 | ** (3) fossil revert (7) fossil stash goto |
| 434 | -** (4) fossil stash pop | |
| 434 | +** (4) fossil stash pop (8) fossil clean (*see note*) | |
| 435 | 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. | |
| 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. | |
| 438 | 439 | ** |
| 439 | 440 | ** If FILENAME is specified then restore the content of the named |
| 440 | 441 | ** file(s) but otherwise leave the update or merge or revert in effect. |
| 441 | 442 | ** The redo command undoes the effect of the most recent undo. |
| 442 | 443 | ** |
| 443 | 444 | ** If the -n|--dry-run option is present, no changes are made and instead |
| 444 | 445 | ** the undo or redo command explains what actions the undo or redo would |
| 445 | 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. | |
| 446 | 453 | ** |
| 447 | 454 | ** 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. | |
| 449 | 460 | ** |
| 450 | 461 | ** Options: |
| 451 | 462 | ** -n|--dry-run do not make changes but show what would be done |
| 452 | 463 | ** |
| 453 | 464 | ** See also: commit, status |
| 454 | 465 |
| --- 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 |