Fossil SCM
Add the 'fossil all clean' command. Add -whatif option to the 'fossil clean' command, primarily for use with 'fossil all clean'.
Commit
4e7753c8a1358a56be2ecd8a8cb72cbe9e54558f
Parent
aca6db8f2b5d99d…
2 files changed
+23
-2
+3
+23
-2
| --- src/allrepo.c | ||
| +++ src/allrepo.c | ||
| @@ -70,11 +70,11 @@ | ||
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | /* |
| 73 | 73 | ** COMMAND: all |
| 74 | 74 | ** |
| 75 | -** Usage: %fossil all (changes|extra|ignore|list|ls|pull|push|rebuild|sync) | |
| 75 | +** Usage: %fossil all (changes|clean|extra|ignore|list|ls|pull|push|rebuild|sync) | |
| 76 | 76 | ** |
| 77 | 77 | ** The ~/.fossil file records the location of all repositories for a |
| 78 | 78 | ** user. This command performs certain operations on all repositories |
| 79 | 79 | ** that can be useful before or after a period of disconnected operation. |
| 80 | 80 | ** |
| @@ -82,10 +82,16 @@ | ||
| 82 | 82 | ** %LOCALAPPDATA%, %APPDATA% or %HOMEPATH%. |
| 83 | 83 | ** |
| 84 | 84 | ** Available operations are: |
| 85 | 85 | ** |
| 86 | 86 | ** changes Shows all local checkouts that have uncommitted changes |
| 87 | +** | |
| 88 | +** clean Delete all "extra" files in all local checkouts. Extreme | |
| 89 | +** caution should be exercised with this command because its | |
| 90 | +** effects cannot be undone. Use of the -whatif option to | |
| 91 | +** carefully review the files to be deleted beforehand is | |
| 92 | +** highly recommended. | |
| 87 | 93 | ** |
| 88 | 94 | ** extra Shows extra files from all local checkouts |
| 89 | 95 | ** |
| 90 | 96 | ** ignore Arguments are repositories that should be ignored |
| 91 | 97 | ** by subsequent list, pull, push, rebuild, and sync. |
| @@ -128,20 +134,35 @@ | ||
| 128 | 134 | if( !dryRunFlag ){ |
| 129 | 135 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 130 | 136 | } |
| 131 | 137 | |
| 132 | 138 | if( g.argc<3 ){ |
| 133 | - usage("changes|extra|ignore|list|ls|pull|push|rebuild|sync"); | |
| 139 | + usage("changes|clean|extra|ignore|list|ls|pull|push|rebuild|sync"); | |
| 134 | 140 | } |
| 135 | 141 | n = strlen(g.argv[2]); |
| 136 | 142 | db_open_config(1); |
| 137 | 143 | blob_zero(&extra); |
| 138 | 144 | zCmd = g.argv[2]; |
| 139 | 145 | if( g.zLogin ) blob_appendf(&extra, " -U %s", g.zLogin); |
| 140 | 146 | if( strncmp(zCmd, "list", n)==0 || strncmp(zCmd,"ls",n)==0 ){ |
| 141 | 147 | zCmd = "list"; |
| 142 | 148 | useCheckouts = find_option("ckout","c",0)!=0; |
| 149 | + }else if( strncmp(zCmd, "clean", n)==0 ){ | |
| 150 | + zCmd = "clean --chdir"; | |
| 151 | + collect_argument(&extra, "allckouts",0); | |
| 152 | + collect_argument_value(&extra, "case-sensitive"); | |
| 153 | + collect_argument_value(&extra, "clean"); | |
| 154 | + collect_argument(&extra, "dirsonly",0); | |
| 155 | + collect_argument(&extra, "dotfiles",0); | |
| 156 | + collect_argument(&extra, "emptydirs",0); | |
| 157 | + collect_argument(&extra, "force","f"); | |
| 158 | + collect_argument_value(&extra, "ignore"); | |
| 159 | + collect_argument_value(&extra, "keep"); | |
| 160 | + collect_argument(&extra, "temp",0); | |
| 161 | + collect_argument(&extra, "verbose","v"); | |
| 162 | + collect_argument(&extra, "whatif",0); | |
| 163 | + useCheckouts = 1; | |
| 143 | 164 | }else if( strncmp(zCmd, "extra", n)==0 ){ |
| 144 | 165 | zCmd = "extra --chdir"; |
| 145 | 166 | collect_argument(&extra, "abs-paths",0); |
| 146 | 167 | collect_argument_value(&extra, "case-sensitive"); |
| 147 | 168 | collect_argument(&extra, "dotfiles",0); |
| 148 | 169 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -70,11 +70,11 @@ | |
| 70 | |
| 71 | |
| 72 | /* |
| 73 | ** COMMAND: all |
| 74 | ** |
| 75 | ** Usage: %fossil all (changes|extra|ignore|list|ls|pull|push|rebuild|sync) |
| 76 | ** |
| 77 | ** The ~/.fossil file records the location of all repositories for a |
| 78 | ** user. This command performs certain operations on all repositories |
| 79 | ** that can be useful before or after a period of disconnected operation. |
| 80 | ** |
| @@ -82,10 +82,16 @@ | |
| 82 | ** %LOCALAPPDATA%, %APPDATA% or %HOMEPATH%. |
| 83 | ** |
| 84 | ** Available operations are: |
| 85 | ** |
| 86 | ** changes Shows all local checkouts that have uncommitted changes |
| 87 | ** |
| 88 | ** extra Shows extra files from all local checkouts |
| 89 | ** |
| 90 | ** ignore Arguments are repositories that should be ignored |
| 91 | ** by subsequent list, pull, push, rebuild, and sync. |
| @@ -128,20 +134,35 @@ | |
| 128 | if( !dryRunFlag ){ |
| 129 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 130 | } |
| 131 | |
| 132 | if( g.argc<3 ){ |
| 133 | usage("changes|extra|ignore|list|ls|pull|push|rebuild|sync"); |
| 134 | } |
| 135 | n = strlen(g.argv[2]); |
| 136 | db_open_config(1); |
| 137 | blob_zero(&extra); |
| 138 | zCmd = g.argv[2]; |
| 139 | if( g.zLogin ) blob_appendf(&extra, " -U %s", g.zLogin); |
| 140 | if( strncmp(zCmd, "list", n)==0 || strncmp(zCmd,"ls",n)==0 ){ |
| 141 | zCmd = "list"; |
| 142 | useCheckouts = find_option("ckout","c",0)!=0; |
| 143 | }else if( strncmp(zCmd, "extra", n)==0 ){ |
| 144 | zCmd = "extra --chdir"; |
| 145 | collect_argument(&extra, "abs-paths",0); |
| 146 | collect_argument_value(&extra, "case-sensitive"); |
| 147 | collect_argument(&extra, "dotfiles",0); |
| 148 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -70,11 +70,11 @@ | |
| 70 | |
| 71 | |
| 72 | /* |
| 73 | ** COMMAND: all |
| 74 | ** |
| 75 | ** Usage: %fossil all (changes|clean|extra|ignore|list|ls|pull|push|rebuild|sync) |
| 76 | ** |
| 77 | ** The ~/.fossil file records the location of all repositories for a |
| 78 | ** user. This command performs certain operations on all repositories |
| 79 | ** that can be useful before or after a period of disconnected operation. |
| 80 | ** |
| @@ -82,10 +82,16 @@ | |
| 82 | ** %LOCALAPPDATA%, %APPDATA% or %HOMEPATH%. |
| 83 | ** |
| 84 | ** Available operations are: |
| 85 | ** |
| 86 | ** changes Shows all local checkouts that have uncommitted changes |
| 87 | ** |
| 88 | ** clean Delete all "extra" files in all local checkouts. Extreme |
| 89 | ** caution should be exercised with this command because its |
| 90 | ** effects cannot be undone. Use of the -whatif option to |
| 91 | ** carefully review the files to be deleted beforehand is |
| 92 | ** highly recommended. |
| 93 | ** |
| 94 | ** extra Shows extra files from all local checkouts |
| 95 | ** |
| 96 | ** ignore Arguments are repositories that should be ignored |
| 97 | ** by subsequent list, pull, push, rebuild, and sync. |
| @@ -128,20 +134,35 @@ | |
| 134 | if( !dryRunFlag ){ |
| 135 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 136 | } |
| 137 | |
| 138 | if( g.argc<3 ){ |
| 139 | usage("changes|clean|extra|ignore|list|ls|pull|push|rebuild|sync"); |
| 140 | } |
| 141 | n = strlen(g.argv[2]); |
| 142 | db_open_config(1); |
| 143 | blob_zero(&extra); |
| 144 | zCmd = g.argv[2]; |
| 145 | if( g.zLogin ) blob_appendf(&extra, " -U %s", g.zLogin); |
| 146 | if( strncmp(zCmd, "list", n)==0 || strncmp(zCmd,"ls",n)==0 ){ |
| 147 | zCmd = "list"; |
| 148 | useCheckouts = find_option("ckout","c",0)!=0; |
| 149 | }else if( strncmp(zCmd, "clean", n)==0 ){ |
| 150 | zCmd = "clean --chdir"; |
| 151 | collect_argument(&extra, "allckouts",0); |
| 152 | collect_argument_value(&extra, "case-sensitive"); |
| 153 | collect_argument_value(&extra, "clean"); |
| 154 | collect_argument(&extra, "dirsonly",0); |
| 155 | collect_argument(&extra, "dotfiles",0); |
| 156 | collect_argument(&extra, "emptydirs",0); |
| 157 | collect_argument(&extra, "force","f"); |
| 158 | collect_argument_value(&extra, "ignore"); |
| 159 | collect_argument_value(&extra, "keep"); |
| 160 | collect_argument(&extra, "temp",0); |
| 161 | collect_argument(&extra, "verbose","v"); |
| 162 | collect_argument(&extra, "whatif",0); |
| 163 | useCheckouts = 1; |
| 164 | }else if( strncmp(zCmd, "extra", n)==0 ){ |
| 165 | zCmd = "extra --chdir"; |
| 166 | collect_argument(&extra, "abs-paths",0); |
| 167 | collect_argument_value(&extra, "case-sensitive"); |
| 168 | collect_argument(&extra, "dotfiles",0); |
| 169 |
+3
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -550,10 +550,13 @@ | ||
| 550 | 550 | |
| 551 | 551 | dryRunFlag = find_option("dry-run","n",0)!=0; |
| 552 | 552 | if( !dryRunFlag ){ |
| 553 | 553 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 554 | 554 | } |
| 555 | + if( !dryRunFlag ){ | |
| 556 | + dryRunFlag = find_option("whatif",0,0)!=0; | |
| 557 | + } | |
| 555 | 558 | allFileFlag = allDirFlag = find_option("force","f",0)!=0; |
| 556 | 559 | dirsOnlyFlag = find_option("dirsonly",0,0)!=0; |
| 557 | 560 | emptyDirsFlag = find_option("emptydirs","d",0)!=0 || dirsOnlyFlag; |
| 558 | 561 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 559 | 562 | if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; |
| 560 | 563 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -550,10 +550,13 @@ | |
| 550 | |
| 551 | dryRunFlag = find_option("dry-run","n",0)!=0; |
| 552 | if( !dryRunFlag ){ |
| 553 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 554 | } |
| 555 | allFileFlag = allDirFlag = find_option("force","f",0)!=0; |
| 556 | dirsOnlyFlag = find_option("dirsonly",0,0)!=0; |
| 557 | emptyDirsFlag = find_option("emptydirs","d",0)!=0 || dirsOnlyFlag; |
| 558 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 559 | if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; |
| 560 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -550,10 +550,13 @@ | |
| 550 | |
| 551 | dryRunFlag = find_option("dry-run","n",0)!=0; |
| 552 | if( !dryRunFlag ){ |
| 553 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 554 | } |
| 555 | if( !dryRunFlag ){ |
| 556 | dryRunFlag = find_option("whatif",0,0)!=0; |
| 557 | } |
| 558 | allFileFlag = allDirFlag = find_option("force","f",0)!=0; |
| 559 | dirsOnlyFlag = find_option("dirsonly",0,0)!=0; |
| 560 | emptyDirsFlag = find_option("emptydirs","d",0)!=0 || dirsOnlyFlag; |
| 561 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 562 | if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; |
| 563 |