| | @@ -25,39 +25,23 @@ |
| 25 | 25 | #include "cygsup.h" |
| 26 | 26 | |
| 27 | 27 | /* |
| 28 | 28 | ** WARNING: For Fossil version 1.x this value was always zero. For Fossil |
| 29 | 29 | ** 2.x, it will probably always be one. When this value is zero, |
| 30 | | -** files in the checkout will not be moved by the "mv" command. |
| 31 | | -** |
| 32 | | -** If the FOSSIL_ENABLE_LEGACY_MV_RM compile-time option is used, |
| 33 | | -** the "move-files" setting will be consulted instead of using |
| 34 | | -** this value. |
| 35 | | -** |
| 36 | | -** To retain the Fossil version 1.x behavior when using Fossil 2.x, |
| 37 | | -** the FOSSIL_ENABLE_LEGACY_MV_RM compile-time option must be used |
| 38 | | -** -AND- the "move-files" setting must be set to zero. |
| 39 | | -*/ |
| 40 | | -#ifndef FOSSIL_MV_CHECKOUT_FILE_ON_MV |
| 41 | | -#define FOSSIL_MV_CHECKOUT_FILE_ON_MV (0) |
| 42 | | -#endif |
| 43 | | - |
| 44 | | -/* |
| 45 | | -** WARNING: For Fossil version 1.x this value was always zero. For Fossil |
| 46 | | -** 2.x, it will probably always be one. When this value is zero, |
| 47 | | -** files in the checkout will not be removed by the "rm" command. |
| 48 | | -** |
| 49 | | -** If the FOSSIL_ENABLE_LEGACY_MV_RM compile-time option is used, |
| 50 | | -** the "remove-files" setting will be consulted instead of using |
| 51 | | -** this value. |
| 52 | | -** |
| 53 | | -** To retain the Fossil version 1.x behavior when using Fossil 2.x, |
| 54 | | -** the FOSSIL_ENABLE_LEGACY_MV_RM compile-time option must be used |
| 55 | | -** -AND- the "remove-files" setting must be set to zero. |
| 56 | | -*/ |
| 57 | | -#ifndef FOSSIL_RM_CHECKOUT_FILE_ON_RM |
| 58 | | -#define FOSSIL_RM_CHECKOUT_FILE_ON_RM (0) |
| 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 1.x behavior when using Fossil 2.x, |
| 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) |
| 59 | 43 | #endif |
| 60 | 44 | |
| 61 | 45 | /* |
| 62 | 46 | ** This routine returns the names of files in a working checkout that |
| 63 | 47 | ** are created by Fossil itself, and hence should not be added, deleted, |
| | @@ -414,26 +398,10 @@ |
| 414 | 398 | } |
| 415 | 399 | db_finalize(&remove); |
| 416 | 400 | db_multi_exec("DROP TABLE fremove;"); |
| 417 | 401 | } |
| 418 | 402 | |
| 419 | | -/* |
| 420 | | -** Capture the command-line --metadata-only option. |
| 421 | | -*/ |
| 422 | | -static const char *zMetadataOnly = 0; |
| 423 | | -void capture_metadata_only_option(void){ |
| 424 | | - if( zMetadataOnly==0 ){ |
| 425 | | - zMetadataOnly = find_option("metadata-only",0,1); |
| 426 | | - if( find_option("soft",0,0) && zMetadataOnly==0 ){ |
| 427 | | - zMetadataOnly = "1"; |
| 428 | | - } |
| 429 | | - if( find_option("hard",0,0) && zMetadataOnly==0 ){ |
| 430 | | - zMetadataOnly = "0"; |
| 431 | | - } |
| 432 | | - } |
| 433 | | -} |
| 434 | | - |
| 435 | 403 | /* |
| 436 | 404 | ** COMMAND: rm |
| 437 | 405 | ** COMMAND: delete |
| 438 | 406 | ** COMMAND: forget* |
| 439 | 407 | ** |
| | @@ -443,25 +411,21 @@ |
| 443 | 411 | ** |
| 444 | 412 | ** The 'rm' and 'delete' commands do NOT normally remove the files from |
| 445 | 413 | ** disk. They just mark the files as no longer being part of the project. |
| 446 | 414 | ** In other words, future changes to the named files will not be versioned. |
| 447 | 415 | ** However, the default behavior of this command may be overridden via the |
| 448 | | -** command line options listed below and/or the 'remove-files' setting. |
| 416 | +** command line options listed below and/or the 'mv-rm-files' setting. |
| 449 | 417 | ** |
| 450 | 418 | ** The 'forget' command never removes files from disk, even when the command |
| 451 | | -** line options and/or the 'remove-files' setting would otherwise require it |
| 419 | +** line options and/or the 'mv-rm-files' setting would otherwise require it |
| 452 | 420 | ** to do so. |
| 453 | 421 | ** |
| 454 | | -** WARNING: If either the "--metadata-only 0" or "--hard" option is |
| 455 | | -** specified -OR- the "remove-files" setting is non-zero, |
| 456 | | -** files WILL BE removed from disk as well. This does NOT |
| 457 | | -** apply to the 'forget' command. |
| 422 | +** WARNING: If the "--hard" option is specified -OR- the "mv-rm-files" |
| 423 | +** setting is non-zero, files WILL BE removed from disk as well. |
| 424 | +** This does NOT apply to the 'forget' command. |
| 458 | 425 | ** |
| 459 | 426 | ** Options: |
| 460 | | -** --metadata-only <BOOL> Non-zero to skip removing files from the |
| 461 | | -** checkout. Supersedes both the --soft and |
| 462 | | -** --hard options. |
| 463 | 427 | ** --soft Skip removing files from the checkout. |
| 464 | 428 | ** This supersedes the --hard option. |
| 465 | 429 | ** --hard Remove files from the checkout. |
| 466 | 430 | ** --case-sensitive <BOOL> Override the case-sensitive setting. |
| 467 | 431 | ** -n|--dry-run If given, display instead of run actions. |
| | @@ -474,26 +438,22 @@ |
| 474 | 438 | int dryRunFlag; |
| 475 | 439 | Stmt loop; |
| 476 | 440 | |
| 477 | 441 | dryRunFlag = find_option("dry-run","n",0)!=0; |
| 478 | 442 | |
| 479 | | - capture_metadata_only_option(); |
| 480 | | - |
| 481 | 443 | /* We should be done with options.. */ |
| 482 | 444 | verify_all_options(); |
| 483 | 445 | |
| 484 | 446 | db_must_be_within_tree(); |
| 485 | 447 | db_begin_transaction(); |
| 486 | 448 | if( g.argv[1][0]=='f' ){ /* i.e. "forget" */ |
| 487 | 449 | removeFiles = 0; |
| 488 | | - }else if( zMetadataOnly ){ |
| 489 | | - removeFiles = is_false(zMetadataOnly); |
| 490 | 450 | }else{ |
| 491 | 451 | #if FOSSIL_ENABLE_LEGACY_MV_RM |
| 492 | | - removeFiles = db_get_boolean("remove-files",0); |
| 452 | + removeFiles = db_get_boolean("mv-rm-files",0); |
| 493 | 453 | #else |
| 494 | | - removeFiles = FOSSIL_RM_CHECKOUT_FILE_ON_RM; |
| 454 | + removeFiles = FOSSIL_MV_RM_FILE; |
| 495 | 455 | #endif |
| 496 | 456 | } |
| 497 | 457 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)", |
| 498 | 458 | filename_collation()); |
| 499 | 459 | for(i=2; i<g.argc; i++){ |
| | @@ -826,25 +786,21 @@ |
| 826 | 786 | ** |
| 827 | 787 | ** The 'mv' command does NOT normally rename or move the files on disk. |
| 828 | 788 | ** This command merely records the fact that file names have changed so |
| 829 | 789 | ** that appropriate notations can be made at the next commit/check-in. |
| 830 | 790 | ** However, the default behavior of this command may be overridden via |
| 831 | | -** command line options listed below and/or the 'move-files' setting. |
| 791 | +** command line options listed below and/or the 'mv-rm-files' setting. |
| 832 | 792 | ** |
| 833 | 793 | ** The 'rename' command never renames or moves files on disk, even when the |
| 834 | | -** command line options and/or the 'move-files' setting would otherwise |
| 794 | +** command line options and/or the 'mv-rm-files' setting would otherwise |
| 835 | 795 | ** require it to do so. |
| 836 | 796 | ** |
| 837 | | -** WARNING: If either the "--metadata-only 0" or "--hard" option is |
| 838 | | -** specified -OR- the "move-files" setting is non-zero, |
| 839 | | -** files WILL BE renamed or moved on disk as well. This does |
| 840 | | -** NOT apply to the 'rename' command. |
| 797 | +** WARNING: If the "--hard" option is specified -OR- the "mv-rm-files" |
| 798 | +** setting is non-zero, files WILL BE renamed or moved on disk |
| 799 | +** as well. This does NOT apply to the 'rename' command. |
| 841 | 800 | ** |
| 842 | 801 | ** Options: |
| 843 | | -** --metadata-only <BOOL> Non-zero to skip moving files within the |
| 844 | | -** checkout. Supersedes both the --soft and |
| 845 | | -** --hard options. |
| 846 | 802 | ** --soft Skip moving files within the checkout. |
| 847 | 803 | ** This supersedes the --hard option. |
| 848 | 804 | ** --hard Move files within the checkout. |
| 849 | 805 | ** --case-sensitive <BOOL> Override the case-sensitive setting. |
| 850 | 806 | ** -n|--dry-run If given, display instead of run actions. |
| | @@ -861,12 +817,10 @@ |
| 861 | 817 | Stmt q; |
| 862 | 818 | |
| 863 | 819 | db_must_be_within_tree(); |
| 864 | 820 | dryRunFlag = find_option("dry-run","n",0)!=0; |
| 865 | 821 | |
| 866 | | - capture_metadata_only_option(); |
| 867 | | - |
| 868 | 822 | /* We should be done with options.. */ |
| 869 | 823 | verify_all_options(); |
| 870 | 824 | |
| 871 | 825 | vid = db_lget_int("checkout", 0); |
| 872 | 826 | if( vid==0 ){ |
| | @@ -877,17 +831,15 @@ |
| 877 | 831 | } |
| 878 | 832 | zDest = g.argv[g.argc-1]; |
| 879 | 833 | db_begin_transaction(); |
| 880 | 834 | if( g.argv[1][0]=='r' ){ /* i.e. "rename" */ |
| 881 | 835 | moveFiles = 0; |
| 882 | | - }else if( zMetadataOnly ){ |
| 883 | | - moveFiles = is_false(zMetadataOnly); |
| 884 | 836 | }else{ |
| 885 | 837 | #if FOSSIL_ENABLE_LEGACY_MV_RM |
| 886 | | - moveFiles = db_get_boolean("move-files",0); |
| 838 | + moveFiles = db_get_boolean("mv-rm-files",0); |
| 887 | 839 | #else |
| 888 | | - moveFiles = FOSSIL_MV_CHECKOUT_FILE_ON_MV; |
| 840 | + moveFiles = FOSSIL_MV_RM_FILE; |
| 889 | 841 | #endif |
| 890 | 842 | } |
| 891 | 843 | file_tree_name(zDest, &dest, 1); |
| 892 | 844 | db_multi_exec( |
| 893 | 845 | "UPDATE vfile SET origname=pathname WHERE origname IS NULL;" |
| 894 | 846 | |