Fossil SCM

Add the 'fossil all clean' and 'fossil all extra' sub-commands. Add -whatif option to the 'fossil clean' command that has the same effect as -dry-run, primarily for use with 'fossil all clean' since the all command itself uses the -dry-run option.

mistachkin 2013-10-17 22:16 trunk merge
Commit d30e5a4835243dded1b5f358de87955b50ad7059
+41 -3
--- src/allrepo.c
+++ src/allrepo.c
@@ -58,19 +58,23 @@
5858
}
5959
}
6060
static void collect_argument_value(Blob *pExtra, const char *zArg){
6161
const char *zValue = find_option(zArg, 0, 1);
6262
if( zValue ){
63
- blob_appendf(pExtra, " --%s %s", zArg, zValue);
63
+ if( zValue[0] ){
64
+ blob_appendf(pExtra, " --%s %s", zArg, zValue);
65
+ }else{
66
+ blob_appendf(pExtra, " --%s \"\"", zArg);
67
+ }
6468
}
6569
}
6670
6771
6872
/*
6973
** COMMAND: all
7074
**
71
-** Usage: %fossil all (changes|ignore|list|ls|pull|push|rebuild|sync)
75
+** Usage: %fossil all (changes|clean|extra|ignore|list|ls|pull|push|rebuild|sync)
7276
**
7377
** The ~/.fossil file records the location of all repositories for a
7478
** user. This command performs certain operations on all repositories
7579
** that can be useful before or after a period of disconnected operation.
7680
**
@@ -78,10 +82,19 @@
7882
** %LOCALAPPDATA%, %APPDATA% or %HOMEPATH%.
7983
**
8084
** Available operations are:
8185
**
8286
** 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 -dry-run option to
91
+** carefully review the local checkouts to be operated upon
92
+** and the -whatif option to carefully review the files to
93
+** be deleted beforehand is highly recommended.
94
+**
95
+** extra Shows extra files from all local checkouts
8396
**
8497
** ignore Arguments are repositories that should be ignored
8598
** by subsequent list, pull, push, rebuild, and sync.
8699
** The -c|--ckout option causes the listed local checkouts
87100
** to be ignored instead.
@@ -125,20 +138,45 @@
125138
if( !dryRunFlag ){
126139
dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
127140
}
128141
129142
if( g.argc<3 ){
130
- usage("changes|ignore|list|ls|pull|push|rebuild|sync");
143
+ usage("changes|clean|extra|ignore|list|ls|pull|push|rebuild|sync");
131144
}
132145
n = strlen(g.argv[2]);
133146
db_open_config(1);
134147
blob_zero(&extra);
135148
zCmd = g.argv[2];
136149
if( g.zLogin ) blob_appendf(&extra, " -U %s", g.zLogin);
137150
if( strncmp(zCmd, "list", n)==0 || strncmp(zCmd,"ls",n)==0 ){
138151
zCmd = "list";
139152
useCheckouts = find_option("ckout","c",0)!=0;
153
+ }else if( strncmp(zCmd, "clean", n)==0 ){
154
+ zCmd = "clean --chdir";
155
+ collect_argument(&extra, "allckouts",0);
156
+ collect_argument_value(&extra, "case-sensitive");
157
+ collect_argument_value(&extra, "clean");
158
+ collect_argument(&extra, "dirsonly",0);
159
+ collect_argument(&extra, "dotfiles",0);
160
+ collect_argument(&extra, "emptydirs",0);
161
+ collect_argument(&extra, "force","f");
162
+ collect_argument_value(&extra, "ignore");
163
+ collect_argument_value(&extra, "keep");
164
+ collect_argument(&extra, "temp",0);
165
+ collect_argument(&extra, "verbose","v");
166
+ collect_argument(&extra, "whatif",0);
167
+ useCheckouts = 1;
168
+ }else if( strncmp(zCmd, "extra", n)==0 ){
169
+ zCmd = "extra --chdir";
170
+ collect_argument(&extra, "abs-paths",0);
171
+ collect_argument_value(&extra, "case-sensitive");
172
+ collect_argument(&extra, "dotfiles",0);
173
+ collect_argument_value(&extra, "ignore");
174
+ collect_argument(&extra, "rel-paths",0);
175
+ useCheckouts = 1;
176
+ stopOnError = 0;
177
+ quiet = 1;
140178
}else if( strncmp(zCmd, "push", n)==0 ){
141179
zCmd = "push -autourl -R";
142180
collect_argument(&extra, "verbose","v");
143181
}else if( strncmp(zCmd, "pull", n)==0 ){
144182
zCmd = "pull -autourl -R";
145183
--- src/allrepo.c
+++ src/allrepo.c
@@ -58,19 +58,23 @@
58 }
59 }
60 static void collect_argument_value(Blob *pExtra, const char *zArg){
61 const char *zValue = find_option(zArg, 0, 1);
62 if( zValue ){
63 blob_appendf(pExtra, " --%s %s", zArg, zValue);
 
 
 
 
64 }
65 }
66
67
68 /*
69 ** COMMAND: all
70 **
71 ** Usage: %fossil all (changes|ignore|list|ls|pull|push|rebuild|sync)
72 **
73 ** The ~/.fossil file records the location of all repositories for a
74 ** user. This command performs certain operations on all repositories
75 ** that can be useful before or after a period of disconnected operation.
76 **
@@ -78,10 +82,19 @@
78 ** %LOCALAPPDATA%, %APPDATA% or %HOMEPATH%.
79 **
80 ** Available operations are:
81 **
82 ** changes Shows all local checkouts that have uncommitted changes
 
 
 
 
 
 
 
 
 
83 **
84 ** ignore Arguments are repositories that should be ignored
85 ** by subsequent list, pull, push, rebuild, and sync.
86 ** The -c|--ckout option causes the listed local checkouts
87 ** to be ignored instead.
@@ -125,20 +138,45 @@
125 if( !dryRunFlag ){
126 dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
127 }
128
129 if( g.argc<3 ){
130 usage("changes|ignore|list|ls|pull|push|rebuild|sync");
131 }
132 n = strlen(g.argv[2]);
133 db_open_config(1);
134 blob_zero(&extra);
135 zCmd = g.argv[2];
136 if( g.zLogin ) blob_appendf(&extra, " -U %s", g.zLogin);
137 if( strncmp(zCmd, "list", n)==0 || strncmp(zCmd,"ls",n)==0 ){
138 zCmd = "list";
139 useCheckouts = find_option("ckout","c",0)!=0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140 }else if( strncmp(zCmd, "push", n)==0 ){
141 zCmd = "push -autourl -R";
142 collect_argument(&extra, "verbose","v");
143 }else if( strncmp(zCmd, "pull", n)==0 ){
144 zCmd = "pull -autourl -R";
145
--- src/allrepo.c
+++ src/allrepo.c
@@ -58,19 +58,23 @@
58 }
59 }
60 static void collect_argument_value(Blob *pExtra, const char *zArg){
61 const char *zValue = find_option(zArg, 0, 1);
62 if( zValue ){
63 if( zValue[0] ){
64 blob_appendf(pExtra, " --%s %s", zArg, zValue);
65 }else{
66 blob_appendf(pExtra, " --%s \"\"", zArg);
67 }
68 }
69 }
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 **
@@ -78,10 +82,19 @@
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 -dry-run option to
91 ** carefully review the local checkouts to be operated upon
92 ** and the -whatif option to carefully review the files to
93 ** be deleted beforehand is highly recommended.
94 **
95 ** extra Shows extra files from all local checkouts
96 **
97 ** ignore Arguments are repositories that should be ignored
98 ** by subsequent list, pull, push, rebuild, and sync.
99 ** The -c|--ckout option causes the listed local checkouts
100 ** to be ignored instead.
@@ -125,20 +138,45 @@
138 if( !dryRunFlag ){
139 dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
140 }
141
142 if( g.argc<3 ){
143 usage("changes|clean|extra|ignore|list|ls|pull|push|rebuild|sync");
144 }
145 n = strlen(g.argv[2]);
146 db_open_config(1);
147 blob_zero(&extra);
148 zCmd = g.argv[2];
149 if( g.zLogin ) blob_appendf(&extra, " -U %s", g.zLogin);
150 if( strncmp(zCmd, "list", n)==0 || strncmp(zCmd,"ls",n)==0 ){
151 zCmd = "list";
152 useCheckouts = find_option("ckout","c",0)!=0;
153 }else if( strncmp(zCmd, "clean", n)==0 ){
154 zCmd = "clean --chdir";
155 collect_argument(&extra, "allckouts",0);
156 collect_argument_value(&extra, "case-sensitive");
157 collect_argument_value(&extra, "clean");
158 collect_argument(&extra, "dirsonly",0);
159 collect_argument(&extra, "dotfiles",0);
160 collect_argument(&extra, "emptydirs",0);
161 collect_argument(&extra, "force","f");
162 collect_argument_value(&extra, "ignore");
163 collect_argument_value(&extra, "keep");
164 collect_argument(&extra, "temp",0);
165 collect_argument(&extra, "verbose","v");
166 collect_argument(&extra, "whatif",0);
167 useCheckouts = 1;
168 }else if( strncmp(zCmd, "extra", n)==0 ){
169 zCmd = "extra --chdir";
170 collect_argument(&extra, "abs-paths",0);
171 collect_argument_value(&extra, "case-sensitive");
172 collect_argument(&extra, "dotfiles",0);
173 collect_argument_value(&extra, "ignore");
174 collect_argument(&extra, "rel-paths",0);
175 useCheckouts = 1;
176 stopOnError = 0;
177 quiet = 1;
178 }else if( strncmp(zCmd, "push", n)==0 ){
179 zCmd = "push -autourl -R";
180 collect_argument(&extra, "verbose","v");
181 }else if( strncmp(zCmd, "pull", n)==0 ){
182 zCmd = "pull -autourl -R";
183
+41 -3
--- src/allrepo.c
+++ src/allrepo.c
@@ -58,19 +58,23 @@
5858
}
5959
}
6060
static void collect_argument_value(Blob *pExtra, const char *zArg){
6161
const char *zValue = find_option(zArg, 0, 1);
6262
if( zValue ){
63
- blob_appendf(pExtra, " --%s %s", zArg, zValue);
63
+ if( zValue[0] ){
64
+ blob_appendf(pExtra, " --%s %s", zArg, zValue);
65
+ }else{
66
+ blob_appendf(pExtra, " --%s \"\"", zArg);
67
+ }
6468
}
6569
}
6670
6771
6872
/*
6973
** COMMAND: all
7074
**
71
-** Usage: %fossil all (changes|ignore|list|ls|pull|push|rebuild|sync)
75
+** Usage: %fossil all (changes|clean|extra|ignore|list|ls|pull|push|rebuild|sync)
7276
**
7377
** The ~/.fossil file records the location of all repositories for a
7478
** user. This command performs certain operations on all repositories
7579
** that can be useful before or after a period of disconnected operation.
7680
**
@@ -78,10 +82,19 @@
7882
** %LOCALAPPDATA%, %APPDATA% or %HOMEPATH%.
7983
**
8084
** Available operations are:
8185
**
8286
** 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 -dry-run option to
91
+** carefully review the local checkouts to be operated upon
92
+** and the -whatif option to carefully review the files to
93
+** be deleted beforehand is highly recommended.
94
+**
95
+** extra Shows extra files from all local checkouts
8396
**
8497
** ignore Arguments are repositories that should be ignored
8598
** by subsequent list, pull, push, rebuild, and sync.
8699
** The -c|--ckout option causes the listed local checkouts
87100
** to be ignored instead.
@@ -125,20 +138,45 @@
125138
if( !dryRunFlag ){
126139
dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
127140
}
128141
129142
if( g.argc<3 ){
130
- usage("changes|ignore|list|ls|pull|push|rebuild|sync");
143
+ usage("changes|clean|extra|ignore|list|ls|pull|push|rebuild|sync");
131144
}
132145
n = strlen(g.argv[2]);
133146
db_open_config(1);
134147
blob_zero(&extra);
135148
zCmd = g.argv[2];
136149
if( g.zLogin ) blob_appendf(&extra, " -U %s", g.zLogin);
137150
if( strncmp(zCmd, "list", n)==0 || strncmp(zCmd,"ls",n)==0 ){
138151
zCmd = "list";
139152
useCheckouts = find_option("ckout","c",0)!=0;
153
+ }else if( strncmp(zCmd, "clean", n)==0 ){
154
+ zCmd = "clean --chdir";
155
+ collect_argument(&extra, "allckouts",0);
156
+ collect_argument_value(&extra, "case-sensitive");
157
+ collect_argument_value(&extra, "clean");
158
+ collect_argument(&extra, "dirsonly",0);
159
+ collect_argument(&extra, "dotfiles",0);
160
+ collect_argument(&extra, "emptydirs",0);
161
+ collect_argument(&extra, "force","f");
162
+ collect_argument_value(&extra, "ignore");
163
+ collect_argument_value(&extra, "keep");
164
+ collect_argument(&extra, "temp",0);
165
+ collect_argument(&extra, "verbose","v");
166
+ collect_argument(&extra, "whatif",0);
167
+ useCheckouts = 1;
168
+ }else if( strncmp(zCmd, "extra", n)==0 ){
169
+ zCmd = "extra --chdir";
170
+ collect_argument(&extra, "abs-paths",0);
171
+ collect_argument_value(&extra, "case-sensitive");
172
+ collect_argument(&extra, "dotfiles",0);
173
+ collect_argument_value(&extra, "ignore");
174
+ collect_argument(&extra, "rel-paths",0);
175
+ useCheckouts = 1;
176
+ stopOnError = 0;
177
+ quiet = 1;
140178
}else if( strncmp(zCmd, "push", n)==0 ){
141179
zCmd = "push -autourl -R";
142180
collect_argument(&extra, "verbose","v");
143181
}else if( strncmp(zCmd, "pull", n)==0 ){
144182
zCmd = "pull -autourl -R";
145183
--- src/allrepo.c
+++ src/allrepo.c
@@ -58,19 +58,23 @@
58 }
59 }
60 static void collect_argument_value(Blob *pExtra, const char *zArg){
61 const char *zValue = find_option(zArg, 0, 1);
62 if( zValue ){
63 blob_appendf(pExtra, " --%s %s", zArg, zValue);
 
 
 
 
64 }
65 }
66
67
68 /*
69 ** COMMAND: all
70 **
71 ** Usage: %fossil all (changes|ignore|list|ls|pull|push|rebuild|sync)
72 **
73 ** The ~/.fossil file records the location of all repositories for a
74 ** user. This command performs certain operations on all repositories
75 ** that can be useful before or after a period of disconnected operation.
76 **
@@ -78,10 +82,19 @@
78 ** %LOCALAPPDATA%, %APPDATA% or %HOMEPATH%.
79 **
80 ** Available operations are:
81 **
82 ** changes Shows all local checkouts that have uncommitted changes
 
 
 
 
 
 
 
 
 
83 **
84 ** ignore Arguments are repositories that should be ignored
85 ** by subsequent list, pull, push, rebuild, and sync.
86 ** The -c|--ckout option causes the listed local checkouts
87 ** to be ignored instead.
@@ -125,20 +138,45 @@
125 if( !dryRunFlag ){
126 dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
127 }
128
129 if( g.argc<3 ){
130 usage("changes|ignore|list|ls|pull|push|rebuild|sync");
131 }
132 n = strlen(g.argv[2]);
133 db_open_config(1);
134 blob_zero(&extra);
135 zCmd = g.argv[2];
136 if( g.zLogin ) blob_appendf(&extra, " -U %s", g.zLogin);
137 if( strncmp(zCmd, "list", n)==0 || strncmp(zCmd,"ls",n)==0 ){
138 zCmd = "list";
139 useCheckouts = find_option("ckout","c",0)!=0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140 }else if( strncmp(zCmd, "push", n)==0 ){
141 zCmd = "push -autourl -R";
142 collect_argument(&extra, "verbose","v");
143 }else if( strncmp(zCmd, "pull", n)==0 ){
144 zCmd = "pull -autourl -R";
145
--- src/allrepo.c
+++ src/allrepo.c
@@ -58,19 +58,23 @@
58 }
59 }
60 static void collect_argument_value(Blob *pExtra, const char *zArg){
61 const char *zValue = find_option(zArg, 0, 1);
62 if( zValue ){
63 if( zValue[0] ){
64 blob_appendf(pExtra, " --%s %s", zArg, zValue);
65 }else{
66 blob_appendf(pExtra, " --%s \"\"", zArg);
67 }
68 }
69 }
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 **
@@ -78,10 +82,19 @@
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 -dry-run option to
91 ** carefully review the local checkouts to be operated upon
92 ** and the -whatif option to carefully review the files to
93 ** be deleted beforehand is highly recommended.
94 **
95 ** extra Shows extra files from all local checkouts
96 **
97 ** ignore Arguments are repositories that should be ignored
98 ** by subsequent list, pull, push, rebuild, and sync.
99 ** The -c|--ckout option causes the listed local checkouts
100 ** to be ignored instead.
@@ -125,20 +138,45 @@
138 if( !dryRunFlag ){
139 dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
140 }
141
142 if( g.argc<3 ){
143 usage("changes|clean|extra|ignore|list|ls|pull|push|rebuild|sync");
144 }
145 n = strlen(g.argv[2]);
146 db_open_config(1);
147 blob_zero(&extra);
148 zCmd = g.argv[2];
149 if( g.zLogin ) blob_appendf(&extra, " -U %s", g.zLogin);
150 if( strncmp(zCmd, "list", n)==0 || strncmp(zCmd,"ls",n)==0 ){
151 zCmd = "list";
152 useCheckouts = find_option("ckout","c",0)!=0;
153 }else if( strncmp(zCmd, "clean", n)==0 ){
154 zCmd = "clean --chdir";
155 collect_argument(&extra, "allckouts",0);
156 collect_argument_value(&extra, "case-sensitive");
157 collect_argument_value(&extra, "clean");
158 collect_argument(&extra, "dirsonly",0);
159 collect_argument(&extra, "dotfiles",0);
160 collect_argument(&extra, "emptydirs",0);
161 collect_argument(&extra, "force","f");
162 collect_argument_value(&extra, "ignore");
163 collect_argument_value(&extra, "keep");
164 collect_argument(&extra, "temp",0);
165 collect_argument(&extra, "verbose","v");
166 collect_argument(&extra, "whatif",0);
167 useCheckouts = 1;
168 }else if( strncmp(zCmd, "extra", n)==0 ){
169 zCmd = "extra --chdir";
170 collect_argument(&extra, "abs-paths",0);
171 collect_argument_value(&extra, "case-sensitive");
172 collect_argument(&extra, "dotfiles",0);
173 collect_argument_value(&extra, "ignore");
174 collect_argument(&extra, "rel-paths",0);
175 useCheckouts = 1;
176 stopOnError = 0;
177 quiet = 1;
178 }else if( strncmp(zCmd, "push", n)==0 ){
179 zCmd = "push -autourl -R";
180 collect_argument(&extra, "verbose","v");
181 }else if( strncmp(zCmd, "pull", n)==0 ){
182 zCmd = "pull -autourl -R";
183
--- src/checkin.c
+++ src/checkin.c
@@ -550,10 +550,13 @@
550550
551551
dryRunFlag = find_option("dry-run","n",0)!=0;
552552
if( !dryRunFlag ){
553553
dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
554554
}
555
+ if( !dryRunFlag ){
556
+ dryRunFlag = find_option("whatif",0,0)!=0;
557
+ }
555558
allFileFlag = allDirFlag = find_option("force","f",0)!=0;
556559
dirsOnlyFlag = find_option("dirsonly",0,0)!=0;
557560
emptyDirsFlag = find_option("emptydirs","d",0)!=0 || dirsOnlyFlag;
558561
if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
559562
if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
560563
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button