Fossil SCM
Remove unnecessary code from the "fossil clean" command.
Commit
fc871543374db6fac3053e70a6af205f23c4e751
Parent
16ab6ee852cdebb…
2 files changed
+3
-18
+3
-18
+3
-18
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -683,11 +683,11 @@ | ||
| 683 | 683 | ** -v|--verbose Show all files as they are removed. |
| 684 | 684 | ** |
| 685 | 685 | ** See also: addremove, extras, status |
| 686 | 686 | */ |
| 687 | 687 | void clean_cmd(void){ |
| 688 | - int allFileFlag, allDirFlag, dryRunFlag, verboseFlag; | |
| 688 | + int allFileFlag, dryRunFlag, verboseFlag; | |
| 689 | 689 | int emptyDirsFlag, dirsOnlyFlag; |
| 690 | 690 | unsigned scanFlags = 0; |
| 691 | 691 | int verilyFlag = 0; |
| 692 | 692 | const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag; |
| 693 | 693 | Glob *pIgnore, *pKeep, *pClean; |
| @@ -698,11 +698,11 @@ | ||
| 698 | 698 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 699 | 699 | } |
| 700 | 700 | if( !dryRunFlag ){ |
| 701 | 701 | dryRunFlag = find_option("whatif",0,0)!=0; |
| 702 | 702 | } |
| 703 | - allFileFlag = allDirFlag = find_option("force","f",0)!=0; | |
| 703 | + allFileFlag = find_option("force","f",0)!=0; | |
| 704 | 704 | dirsOnlyFlag = find_option("dirsonly",0,0)!=0; |
| 705 | 705 | emptyDirsFlag = find_option("emptydirs","d",0)!=0 || dirsOnlyFlag; |
| 706 | 706 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 707 | 707 | if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; |
| 708 | 708 | if( find_option("allckouts",0,0)!=0 ) scanFlags |= SCAN_NESTED; |
| @@ -710,11 +710,11 @@ | ||
| 710 | 710 | verboseFlag = find_option("verbose","v",0)!=0; |
| 711 | 711 | zKeepFlag = find_option("keep",0,1); |
| 712 | 712 | zCleanFlag = find_option("clean",0,1); |
| 713 | 713 | db_must_be_within_tree(); |
| 714 | 714 | if( find_option("verily","x",0)!=0 ){ |
| 715 | - verilyFlag = allFileFlag = allDirFlag = 1; | |
| 715 | + verilyFlag = allFileFlag = 1; | |
| 716 | 716 | emptyDirsFlag = 1; |
| 717 | 717 | scanFlags |= SCAN_ALL; |
| 718 | 718 | zCleanFlag = 0; |
| 719 | 719 | } |
| 720 | 720 | if( zIgnoreFlag==0 && !verilyFlag ){ |
| @@ -802,25 +802,10 @@ | ||
| 802 | 802 | fossil_print("KEPT directory \"%s\" not removed (due to --keep" |
| 803 | 803 | " or \"keep-glob\")\n", zName+nRoot); |
| 804 | 804 | } |
| 805 | 805 | continue; |
| 806 | 806 | } |
| 807 | - if( !allDirFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){ | |
| 808 | - Blob ans; | |
| 809 | - char cReply; | |
| 810 | - char *prompt = mprintf("Remove empty directory \"%s\" (a=all/y/N)? ", | |
| 811 | - zName+nRoot); | |
| 812 | - prompt_user(prompt, &ans); | |
| 813 | - cReply = blob_str(&ans)[0]; | |
| 814 | - if( cReply=='a' || cReply=='A' ){ | |
| 815 | - allDirFlag = 1; | |
| 816 | - }else if( cReply!='y' && cReply!='Y' ){ | |
| 817 | - blob_reset(&ans); | |
| 818 | - continue; | |
| 819 | - } | |
| 820 | - blob_reset(&ans); | |
| 821 | - } | |
| 822 | 807 | if( dryRunFlag || file_rmdir(zName)==0 ){ |
| 823 | 808 | if( verboseFlag || dryRunFlag ){ |
| 824 | 809 | fossil_print("Removed unmanaged directory: %s\n", zName+nRoot); |
| 825 | 810 | } |
| 826 | 811 | }else if( verboseFlag ){ |
| 827 | 812 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -683,11 +683,11 @@ | |
| 683 | ** -v|--verbose Show all files as they are removed. |
| 684 | ** |
| 685 | ** See also: addremove, extras, status |
| 686 | */ |
| 687 | void clean_cmd(void){ |
| 688 | int allFileFlag, allDirFlag, dryRunFlag, verboseFlag; |
| 689 | int emptyDirsFlag, dirsOnlyFlag; |
| 690 | unsigned scanFlags = 0; |
| 691 | int verilyFlag = 0; |
| 692 | const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag; |
| 693 | Glob *pIgnore, *pKeep, *pClean; |
| @@ -698,11 +698,11 @@ | |
| 698 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 699 | } |
| 700 | if( !dryRunFlag ){ |
| 701 | dryRunFlag = find_option("whatif",0,0)!=0; |
| 702 | } |
| 703 | allFileFlag = allDirFlag = find_option("force","f",0)!=0; |
| 704 | dirsOnlyFlag = find_option("dirsonly",0,0)!=0; |
| 705 | emptyDirsFlag = find_option("emptydirs","d",0)!=0 || dirsOnlyFlag; |
| 706 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 707 | if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; |
| 708 | if( find_option("allckouts",0,0)!=0 ) scanFlags |= SCAN_NESTED; |
| @@ -710,11 +710,11 @@ | |
| 710 | verboseFlag = find_option("verbose","v",0)!=0; |
| 711 | zKeepFlag = find_option("keep",0,1); |
| 712 | zCleanFlag = find_option("clean",0,1); |
| 713 | db_must_be_within_tree(); |
| 714 | if( find_option("verily","x",0)!=0 ){ |
| 715 | verilyFlag = allFileFlag = allDirFlag = 1; |
| 716 | emptyDirsFlag = 1; |
| 717 | scanFlags |= SCAN_ALL; |
| 718 | zCleanFlag = 0; |
| 719 | } |
| 720 | if( zIgnoreFlag==0 && !verilyFlag ){ |
| @@ -802,25 +802,10 @@ | |
| 802 | fossil_print("KEPT directory \"%s\" not removed (due to --keep" |
| 803 | " or \"keep-glob\")\n", zName+nRoot); |
| 804 | } |
| 805 | continue; |
| 806 | } |
| 807 | if( !allDirFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){ |
| 808 | Blob ans; |
| 809 | char cReply; |
| 810 | char *prompt = mprintf("Remove empty directory \"%s\" (a=all/y/N)? ", |
| 811 | zName+nRoot); |
| 812 | prompt_user(prompt, &ans); |
| 813 | cReply = blob_str(&ans)[0]; |
| 814 | if( cReply=='a' || cReply=='A' ){ |
| 815 | allDirFlag = 1; |
| 816 | }else if( cReply!='y' && cReply!='Y' ){ |
| 817 | blob_reset(&ans); |
| 818 | continue; |
| 819 | } |
| 820 | blob_reset(&ans); |
| 821 | } |
| 822 | if( dryRunFlag || file_rmdir(zName)==0 ){ |
| 823 | if( verboseFlag || dryRunFlag ){ |
| 824 | fossil_print("Removed unmanaged directory: %s\n", zName+nRoot); |
| 825 | } |
| 826 | }else if( verboseFlag ){ |
| 827 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -683,11 +683,11 @@ | |
| 683 | ** -v|--verbose Show all files as they are removed. |
| 684 | ** |
| 685 | ** See also: addremove, extras, status |
| 686 | */ |
| 687 | void clean_cmd(void){ |
| 688 | int allFileFlag, dryRunFlag, verboseFlag; |
| 689 | int emptyDirsFlag, dirsOnlyFlag; |
| 690 | unsigned scanFlags = 0; |
| 691 | int verilyFlag = 0; |
| 692 | const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag; |
| 693 | Glob *pIgnore, *pKeep, *pClean; |
| @@ -698,11 +698,11 @@ | |
| 698 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 699 | } |
| 700 | if( !dryRunFlag ){ |
| 701 | dryRunFlag = find_option("whatif",0,0)!=0; |
| 702 | } |
| 703 | allFileFlag = find_option("force","f",0)!=0; |
| 704 | dirsOnlyFlag = find_option("dirsonly",0,0)!=0; |
| 705 | emptyDirsFlag = find_option("emptydirs","d",0)!=0 || dirsOnlyFlag; |
| 706 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 707 | if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; |
| 708 | if( find_option("allckouts",0,0)!=0 ) scanFlags |= SCAN_NESTED; |
| @@ -710,11 +710,11 @@ | |
| 710 | verboseFlag = find_option("verbose","v",0)!=0; |
| 711 | zKeepFlag = find_option("keep",0,1); |
| 712 | zCleanFlag = find_option("clean",0,1); |
| 713 | db_must_be_within_tree(); |
| 714 | if( find_option("verily","x",0)!=0 ){ |
| 715 | verilyFlag = allFileFlag = 1; |
| 716 | emptyDirsFlag = 1; |
| 717 | scanFlags |= SCAN_ALL; |
| 718 | zCleanFlag = 0; |
| 719 | } |
| 720 | if( zIgnoreFlag==0 && !verilyFlag ){ |
| @@ -802,25 +802,10 @@ | |
| 802 | fossil_print("KEPT directory \"%s\" not removed (due to --keep" |
| 803 | " or \"keep-glob\")\n", zName+nRoot); |
| 804 | } |
| 805 | continue; |
| 806 | } |
| 807 | if( dryRunFlag || file_rmdir(zName)==0 ){ |
| 808 | if( verboseFlag || dryRunFlag ){ |
| 809 | fossil_print("Removed unmanaged directory: %s\n", zName+nRoot); |
| 810 | } |
| 811 | }else if( verboseFlag ){ |
| 812 |
+3
-18
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -683,11 +683,11 @@ | ||
| 683 | 683 | ** -v|--verbose Show all files as they are removed. |
| 684 | 684 | ** |
| 685 | 685 | ** See also: addremove, extras, status |
| 686 | 686 | */ |
| 687 | 687 | void clean_cmd(void){ |
| 688 | - int allFileFlag, allDirFlag, dryRunFlag, verboseFlag; | |
| 688 | + int allFileFlag, dryRunFlag, verboseFlag; | |
| 689 | 689 | int emptyDirsFlag, dirsOnlyFlag; |
| 690 | 690 | unsigned scanFlags = 0; |
| 691 | 691 | int verilyFlag = 0; |
| 692 | 692 | const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag; |
| 693 | 693 | Glob *pIgnore, *pKeep, *pClean; |
| @@ -698,11 +698,11 @@ | ||
| 698 | 698 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 699 | 699 | } |
| 700 | 700 | if( !dryRunFlag ){ |
| 701 | 701 | dryRunFlag = find_option("whatif",0,0)!=0; |
| 702 | 702 | } |
| 703 | - allFileFlag = allDirFlag = find_option("force","f",0)!=0; | |
| 703 | + allFileFlag = find_option("force","f",0)!=0; | |
| 704 | 704 | dirsOnlyFlag = find_option("dirsonly",0,0)!=0; |
| 705 | 705 | emptyDirsFlag = find_option("emptydirs","d",0)!=0 || dirsOnlyFlag; |
| 706 | 706 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 707 | 707 | if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; |
| 708 | 708 | if( find_option("allckouts",0,0)!=0 ) scanFlags |= SCAN_NESTED; |
| @@ -710,11 +710,11 @@ | ||
| 710 | 710 | verboseFlag = find_option("verbose","v",0)!=0; |
| 711 | 711 | zKeepFlag = find_option("keep",0,1); |
| 712 | 712 | zCleanFlag = find_option("clean",0,1); |
| 713 | 713 | db_must_be_within_tree(); |
| 714 | 714 | if( find_option("verily","x",0)!=0 ){ |
| 715 | - verilyFlag = allFileFlag = allDirFlag = 1; | |
| 715 | + verilyFlag = allFileFlag = 1; | |
| 716 | 716 | emptyDirsFlag = 1; |
| 717 | 717 | scanFlags |= SCAN_ALL; |
| 718 | 718 | zCleanFlag = 0; |
| 719 | 719 | } |
| 720 | 720 | if( zIgnoreFlag==0 && !verilyFlag ){ |
| @@ -802,25 +802,10 @@ | ||
| 802 | 802 | fossil_print("KEPT directory \"%s\" not removed (due to --keep" |
| 803 | 803 | " or \"keep-glob\")\n", zName+nRoot); |
| 804 | 804 | } |
| 805 | 805 | continue; |
| 806 | 806 | } |
| 807 | - if( !allDirFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){ | |
| 808 | - Blob ans; | |
| 809 | - char cReply; | |
| 810 | - char *prompt = mprintf("Remove empty directory \"%s\" (a=all/y/N)? ", | |
| 811 | - zName+nRoot); | |
| 812 | - prompt_user(prompt, &ans); | |
| 813 | - cReply = blob_str(&ans)[0]; | |
| 814 | - if( cReply=='a' || cReply=='A' ){ | |
| 815 | - allDirFlag = 1; | |
| 816 | - }else if( cReply!='y' && cReply!='Y' ){ | |
| 817 | - blob_reset(&ans); | |
| 818 | - continue; | |
| 819 | - } | |
| 820 | - blob_reset(&ans); | |
| 821 | - } | |
| 822 | 807 | if( dryRunFlag || file_rmdir(zName)==0 ){ |
| 823 | 808 | if( verboseFlag || dryRunFlag ){ |
| 824 | 809 | fossil_print("Removed unmanaged directory: %s\n", zName+nRoot); |
| 825 | 810 | } |
| 826 | 811 | }else if( verboseFlag ){ |
| 827 | 812 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -683,11 +683,11 @@ | |
| 683 | ** -v|--verbose Show all files as they are removed. |
| 684 | ** |
| 685 | ** See also: addremove, extras, status |
| 686 | */ |
| 687 | void clean_cmd(void){ |
| 688 | int allFileFlag, allDirFlag, dryRunFlag, verboseFlag; |
| 689 | int emptyDirsFlag, dirsOnlyFlag; |
| 690 | unsigned scanFlags = 0; |
| 691 | int verilyFlag = 0; |
| 692 | const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag; |
| 693 | Glob *pIgnore, *pKeep, *pClean; |
| @@ -698,11 +698,11 @@ | |
| 698 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 699 | } |
| 700 | if( !dryRunFlag ){ |
| 701 | dryRunFlag = find_option("whatif",0,0)!=0; |
| 702 | } |
| 703 | allFileFlag = allDirFlag = find_option("force","f",0)!=0; |
| 704 | dirsOnlyFlag = find_option("dirsonly",0,0)!=0; |
| 705 | emptyDirsFlag = find_option("emptydirs","d",0)!=0 || dirsOnlyFlag; |
| 706 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 707 | if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; |
| 708 | if( find_option("allckouts",0,0)!=0 ) scanFlags |= SCAN_NESTED; |
| @@ -710,11 +710,11 @@ | |
| 710 | verboseFlag = find_option("verbose","v",0)!=0; |
| 711 | zKeepFlag = find_option("keep",0,1); |
| 712 | zCleanFlag = find_option("clean",0,1); |
| 713 | db_must_be_within_tree(); |
| 714 | if( find_option("verily","x",0)!=0 ){ |
| 715 | verilyFlag = allFileFlag = allDirFlag = 1; |
| 716 | emptyDirsFlag = 1; |
| 717 | scanFlags |= SCAN_ALL; |
| 718 | zCleanFlag = 0; |
| 719 | } |
| 720 | if( zIgnoreFlag==0 && !verilyFlag ){ |
| @@ -802,25 +802,10 @@ | |
| 802 | fossil_print("KEPT directory \"%s\" not removed (due to --keep" |
| 803 | " or \"keep-glob\")\n", zName+nRoot); |
| 804 | } |
| 805 | continue; |
| 806 | } |
| 807 | if( !allDirFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){ |
| 808 | Blob ans; |
| 809 | char cReply; |
| 810 | char *prompt = mprintf("Remove empty directory \"%s\" (a=all/y/N)? ", |
| 811 | zName+nRoot); |
| 812 | prompt_user(prompt, &ans); |
| 813 | cReply = blob_str(&ans)[0]; |
| 814 | if( cReply=='a' || cReply=='A' ){ |
| 815 | allDirFlag = 1; |
| 816 | }else if( cReply!='y' && cReply!='Y' ){ |
| 817 | blob_reset(&ans); |
| 818 | continue; |
| 819 | } |
| 820 | blob_reset(&ans); |
| 821 | } |
| 822 | if( dryRunFlag || file_rmdir(zName)==0 ){ |
| 823 | if( verboseFlag || dryRunFlag ){ |
| 824 | fossil_print("Removed unmanaged directory: %s\n", zName+nRoot); |
| 825 | } |
| 826 | }else if( verboseFlag ){ |
| 827 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -683,11 +683,11 @@ | |
| 683 | ** -v|--verbose Show all files as they are removed. |
| 684 | ** |
| 685 | ** See also: addremove, extras, status |
| 686 | */ |
| 687 | void clean_cmd(void){ |
| 688 | int allFileFlag, dryRunFlag, verboseFlag; |
| 689 | int emptyDirsFlag, dirsOnlyFlag; |
| 690 | unsigned scanFlags = 0; |
| 691 | int verilyFlag = 0; |
| 692 | const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag; |
| 693 | Glob *pIgnore, *pKeep, *pClean; |
| @@ -698,11 +698,11 @@ | |
| 698 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 699 | } |
| 700 | if( !dryRunFlag ){ |
| 701 | dryRunFlag = find_option("whatif",0,0)!=0; |
| 702 | } |
| 703 | allFileFlag = find_option("force","f",0)!=0; |
| 704 | dirsOnlyFlag = find_option("dirsonly",0,0)!=0; |
| 705 | emptyDirsFlag = find_option("emptydirs","d",0)!=0 || dirsOnlyFlag; |
| 706 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 707 | if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; |
| 708 | if( find_option("allckouts",0,0)!=0 ) scanFlags |= SCAN_NESTED; |
| @@ -710,11 +710,11 @@ | |
| 710 | verboseFlag = find_option("verbose","v",0)!=0; |
| 711 | zKeepFlag = find_option("keep",0,1); |
| 712 | zCleanFlag = find_option("clean",0,1); |
| 713 | db_must_be_within_tree(); |
| 714 | if( find_option("verily","x",0)!=0 ){ |
| 715 | verilyFlag = allFileFlag = 1; |
| 716 | emptyDirsFlag = 1; |
| 717 | scanFlags |= SCAN_ALL; |
| 718 | zCleanFlag = 0; |
| 719 | } |
| 720 | if( zIgnoreFlag==0 && !verilyFlag ){ |
| @@ -802,25 +802,10 @@ | |
| 802 | fossil_print("KEPT directory \"%s\" not removed (due to --keep" |
| 803 | " or \"keep-glob\")\n", zName+nRoot); |
| 804 | } |
| 805 | continue; |
| 806 | } |
| 807 | if( dryRunFlag || file_rmdir(zName)==0 ){ |
| 808 | if( verboseFlag || dryRunFlag ){ |
| 809 | fossil_print("Removed unmanaged directory: %s\n", zName+nRoot); |
| 810 | } |
| 811 | }else if( verboseFlag ){ |
| 812 |