| | @@ -22,10 +22,28 @@ |
| 22 | 22 | #include "add.h" |
| 23 | 23 | #include <assert.h> |
| 24 | 24 | #include <dirent.h> |
| 25 | 25 | #include "cygsup.h" |
| 26 | 26 | |
| 27 | +/* |
| 28 | +** WARNING: For Fossil version x.x this value was always zero. For Fossil-NG |
| 29 | +** it will probably always be one. When this value is zero, |
| 30 | +** files in the checkout will not be moved by the "mv" command and |
| 31 | +** files in the checkout will not be removed by the "rm" command. |
| 32 | +** |
| 33 | +** If the FOSSIL_ENABLE_LEGACY_MV_RM compile-time option is used, |
| 34 | +** the "mv-rm-files" setting will be consulted instead of using |
| 35 | +** this value. |
| 36 | +** |
| 37 | +** To retain the Fossil version 2.x behavior when using Fossil-NG |
| 38 | +** the FOSSIL_ENABLE_LEGACY_MV_RM compile-time option must be used |
| 39 | +** -AND- the "mv-rm-files" setting must be set to zero. |
| 40 | +*/ |
| 41 | +#ifndef FOSSIL_MV_RM_FILE |
| 42 | +#define FOSSIL_MV_RM_FILE (0) |
| 43 | +#endif |
| 44 | + |
| 27 | 45 | /* |
| 28 | 46 | ** This routine returns the names of files in a working checkout that |
| 29 | 47 | ** are created by Fossil itself, and hence should not be added, deleted, |
| 30 | 48 | ** or merge, and should be omitted from "clean" and "extras" lists. |
| 31 | 49 | ** |
| | @@ -406,17 +424,20 @@ |
| 406 | 424 | ** Remove one or more files or directories from the repository. |
| 407 | 425 | ** |
| 408 | 426 | ** The 'rm' and 'delete' commands do NOT normally remove the files from |
| 409 | 427 | ** disk. They just mark the files as no longer being part of the project. |
| 410 | 428 | ** In other words, future changes to the named files will not be versioned. |
| 411 | | -** However, the default behavior of this command may be overridden using |
| 412 | | -** the --hard or --soft command line options or by changing the |
| 413 | | -** 'mv-rm-files' setting. |
| 429 | +** However, the default behavior of this command may be overridden via the |
| 430 | +** command line options listed below and/or the 'mv-rm-files' setting. |
| 414 | 431 | ** |
| 415 | 432 | ** The 'forget' command never removes files from disk, even when the command |
| 416 | 433 | ** line options and/or the 'mv-rm-files' setting would otherwise require it |
| 417 | 434 | ** to do so. |
| 435 | +** |
| 436 | +** WARNING: If the "--hard" option is specified -OR- the "mv-rm-files" |
| 437 | +** setting is non-zero, files WILL BE removed from disk as well. |
| 438 | +** This does NOT apply to the 'forget' command. |
| 418 | 439 | ** |
| 419 | 440 | ** Options: |
| 420 | 441 | ** --soft Skip removing files from the checkout. |
| 421 | 442 | ** This supersedes the --hard option. |
| 422 | 443 | ** --hard Remove files from the checkout. |
| | @@ -447,11 +468,15 @@ |
| 447 | 468 | }else if( softFlag ){ |
| 448 | 469 | removeFiles = 0; |
| 449 | 470 | }else if( hardFlag ){ |
| 450 | 471 | removeFiles = 1; |
| 451 | 472 | }else{ |
| 473 | +#if FOSSIL_ENABLE_LEGACY_MV_RM |
| 452 | 474 | removeFiles = db_get_boolean("mv-rm-files",0); |
| 475 | +#else |
| 476 | + removeFiles = FOSSIL_MV_RM_FILE; |
| 477 | +#endif |
| 453 | 478 | } |
| 454 | 479 | db_multi_exec("CREATE TEMP TABLE sfile(pathname TEXT PRIMARY KEY %s)", |
| 455 | 480 | filename_collation()); |
| 456 | 481 | for(i=2; i<g.argc; i++){ |
| 457 | 482 | Blob treeName; |
| | @@ -806,17 +831,21 @@ |
| 806 | 831 | ** Move or rename one or more files or directories within the repository tree. |
| 807 | 832 | ** You can either rename a file or directory or move it to another subdirectory. |
| 808 | 833 | ** |
| 809 | 834 | ** The 'mv' command does NOT normally rename or move the files on disk. |
| 810 | 835 | ** This command merely records the fact that file names have changed so |
| 811 | | -** that appropriate notations can be made at the next commit/check-in. |
| 812 | | -** This behavior can be changed using the --hard or --soft command-line |
| 813 | | -** options or by changing the 'mv-rm-files' setting. |
| 836 | +** that appropriate notations can be made at the next commit/check-in. |
| 837 | +** However, the default behavior of this command may be overridden via |
| 838 | +** command line options listed below and/or the 'mv-rm-files' setting. |
| 814 | 839 | ** |
| 815 | 840 | ** The 'rename' command never renames or moves files on disk, even when the |
| 816 | 841 | ** command line options and/or the 'mv-rm-files' setting would otherwise |
| 817 | 842 | ** require it to do so. |
| 843 | +** |
| 844 | +** WARNING: If the "--hard" option is specified -OR- the "mv-rm-files" |
| 845 | +** setting is non-zero, files WILL BE renamed or moved on disk |
| 846 | +** as well. This does NOT apply to the 'rename' command. |
| 818 | 847 | ** |
| 819 | 848 | ** Options: |
| 820 | 849 | ** --soft Skip moving files within the checkout. |
| 821 | 850 | ** This supersedes the --hard option. |
| 822 | 851 | ** --hard Move files within the checkout. |
| | @@ -860,11 +889,15 @@ |
| 860 | 889 | }else if( softFlag ){ |
| 861 | 890 | moveFiles = 0; |
| 862 | 891 | }else if( hardFlag ){ |
| 863 | 892 | moveFiles = 1; |
| 864 | 893 | }else{ |
| 894 | +#if FOSSIL_ENABLE_LEGACY_MV_RM |
| 865 | 895 | moveFiles = db_get_boolean("mv-rm-files",0); |
| 896 | +#else |
| 897 | + moveFiles = FOSSIL_MV_RM_FILE; |
| 898 | +#endif |
| 866 | 899 | } |
| 867 | 900 | file_tree_name(zDest, &dest, 0, 1); |
| 868 | 901 | db_multi_exec( |
| 869 | 902 | "UPDATE vfile SET origname=pathname WHERE origname IS NULL;" |
| 870 | 903 | ); |
| 871 | 904 | |