Fossil SCM

Add the "fossil all info" command.

drh 2014-07-16 23:01 trunk
Commit 3f9ff2a9fadf2a2e3d78a870c14859c8cba8f1ab
1 file changed +19 -2
+19 -2
--- src/allrepo.c
+++ src/allrepo.c
@@ -107,10 +107,12 @@
107107
**
108108
** ignore Arguments are repositories that should be ignored by
109109
** subsequent clean, extras, list, pull, push, rebuild, and
110110
** sync operations. The -c|--ckout option causes the listed
111111
** local checkouts to be ignored instead.
112
+**
113
+** info Run the "info" command on all repositories.
112114
**
113115
** list | ls Display the location of all repositories. The -c|--ckout
114116
** option causes all local checkouts to be listed instead.
115117
**
116118
** pull Run a "pull" operation on all repositories. Only the
@@ -155,10 +157,11 @@
155157
int dryRunFlag = 0;
156158
int showFile = find_option("showfile",0,0)!=0;
157159
int stopOnError = find_option("dontstop",0,0)==0;
158160
int rc;
159161
int nToDel = 0;
162
+ int showLabel = 0;
160163
161164
dryRunFlag = find_option("dry-run","n",0)!=0;
162165
if( !dryRunFlag ){
163166
dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
164167
}
@@ -258,32 +261,40 @@
258261
}
259262
fossil_free(zSql);
260263
}
261264
db_end_transaction(0);
262265
return;
266
+ }else if( strncmp(zCmd, "info", n)==0 ){
267
+ zCmd = "info";
268
+ showLabel = 1;
269
+ quiet = 1;
263270
}else{
264271
fossil_fatal("\"all\" subcommand should be one of: "
265272
"changes clean extras ignore list ls push pull rebuild sync");
266273
}
267274
verify_all_options();
268275
zFossil = quoteFilename(g.nameOfExe);
276
+ db_multi_exec("CREATE TEMP TABLE repolist(name,tag);");
269277
if( useCheckouts ){
270
- db_prepare(&q,
278
+ db_multi_exec(
279
+ "INSERT INTO repolist "
271280
"SELECT DISTINCT substr(name, 7), name COLLATE nocase"
272281
" FROM global_config"
273282
" WHERE substr(name, 1, 6)=='ckout:'"
274283
" ORDER BY 1"
275284
);
276285
}else{
277
- db_prepare(&q,
286
+ db_multi_exec(
287
+ "INSERT INTO repolist "
278288
"SELECT DISTINCT substr(name, 6), name COLLATE nocase"
279289
" FROM global_config"
280290
" WHERE substr(name, 1, 5)=='repo:'"
281291
" ORDER BY 1"
282292
);
283293
}
284294
db_multi_exec("CREATE TEMP TABLE todel(x TEXT)");
295
+ db_prepare(&q, "SELECT name, tag FROM repolist ORDER BY 1");
285296
while( db_step(&q)==SQLITE_ROW ){
286297
const char *zFilename = db_column_text(&q, 0);
287298
if( file_access(zFilename, F_OK)
288299
|| !file_is_canonical(zFilename)
289300
|| (useCheckouts && file_isdir(zFilename)!=1)
@@ -300,10 +311,16 @@
300311
zFilename);
301312
}
302313
zQFilename = quoteFilename(zFilename);
303314
zSyscmd = mprintf("%s %s %s%s",
304315
zFossil, zCmd, zQFilename, blob_str(&extra));
316
+ if( showLabel ){
317
+ int len = (int)strlen(zFilename);
318
+ int nStar = 80 - (len + 15);
319
+ if( nStar<2 ) nStar = 1;
320
+ fossil_print("%.13c %s %.*c\n", '*', zFilename, nStar, '*');
321
+ }
305322
if( !quiet || dryRunFlag ){
306323
fossil_print("%s\n", zSyscmd);
307324
fflush(stdout);
308325
}
309326
rc = dryRunFlag ? 0 : fossil_system(zSyscmd);
310327
--- src/allrepo.c
+++ src/allrepo.c
@@ -107,10 +107,12 @@
107 **
108 ** ignore Arguments are repositories that should be ignored by
109 ** subsequent clean, extras, list, pull, push, rebuild, and
110 ** sync operations. The -c|--ckout option causes the listed
111 ** local checkouts to be ignored instead.
 
 
112 **
113 ** list | ls Display the location of all repositories. The -c|--ckout
114 ** option causes all local checkouts to be listed instead.
115 **
116 ** pull Run a "pull" operation on all repositories. Only the
@@ -155,10 +157,11 @@
155 int dryRunFlag = 0;
156 int showFile = find_option("showfile",0,0)!=0;
157 int stopOnError = find_option("dontstop",0,0)==0;
158 int rc;
159 int nToDel = 0;
 
160
161 dryRunFlag = find_option("dry-run","n",0)!=0;
162 if( !dryRunFlag ){
163 dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
164 }
@@ -258,32 +261,40 @@
258 }
259 fossil_free(zSql);
260 }
261 db_end_transaction(0);
262 return;
 
 
 
 
263 }else{
264 fossil_fatal("\"all\" subcommand should be one of: "
265 "changes clean extras ignore list ls push pull rebuild sync");
266 }
267 verify_all_options();
268 zFossil = quoteFilename(g.nameOfExe);
 
269 if( useCheckouts ){
270 db_prepare(&q,
 
271 "SELECT DISTINCT substr(name, 7), name COLLATE nocase"
272 " FROM global_config"
273 " WHERE substr(name, 1, 6)=='ckout:'"
274 " ORDER BY 1"
275 );
276 }else{
277 db_prepare(&q,
 
278 "SELECT DISTINCT substr(name, 6), name COLLATE nocase"
279 " FROM global_config"
280 " WHERE substr(name, 1, 5)=='repo:'"
281 " ORDER BY 1"
282 );
283 }
284 db_multi_exec("CREATE TEMP TABLE todel(x TEXT)");
 
285 while( db_step(&q)==SQLITE_ROW ){
286 const char *zFilename = db_column_text(&q, 0);
287 if( file_access(zFilename, F_OK)
288 || !file_is_canonical(zFilename)
289 || (useCheckouts && file_isdir(zFilename)!=1)
@@ -300,10 +311,16 @@
300 zFilename);
301 }
302 zQFilename = quoteFilename(zFilename);
303 zSyscmd = mprintf("%s %s %s%s",
304 zFossil, zCmd, zQFilename, blob_str(&extra));
 
 
 
 
 
 
305 if( !quiet || dryRunFlag ){
306 fossil_print("%s\n", zSyscmd);
307 fflush(stdout);
308 }
309 rc = dryRunFlag ? 0 : fossil_system(zSyscmd);
310
--- src/allrepo.c
+++ src/allrepo.c
@@ -107,10 +107,12 @@
107 **
108 ** ignore Arguments are repositories that should be ignored by
109 ** subsequent clean, extras, list, pull, push, rebuild, and
110 ** sync operations. The -c|--ckout option causes the listed
111 ** local checkouts to be ignored instead.
112 **
113 ** info Run the "info" command on all repositories.
114 **
115 ** list | ls Display the location of all repositories. The -c|--ckout
116 ** option causes all local checkouts to be listed instead.
117 **
118 ** pull Run a "pull" operation on all repositories. Only the
@@ -155,10 +157,11 @@
157 int dryRunFlag = 0;
158 int showFile = find_option("showfile",0,0)!=0;
159 int stopOnError = find_option("dontstop",0,0)==0;
160 int rc;
161 int nToDel = 0;
162 int showLabel = 0;
163
164 dryRunFlag = find_option("dry-run","n",0)!=0;
165 if( !dryRunFlag ){
166 dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
167 }
@@ -258,32 +261,40 @@
261 }
262 fossil_free(zSql);
263 }
264 db_end_transaction(0);
265 return;
266 }else if( strncmp(zCmd, "info", n)==0 ){
267 zCmd = "info";
268 showLabel = 1;
269 quiet = 1;
270 }else{
271 fossil_fatal("\"all\" subcommand should be one of: "
272 "changes clean extras ignore list ls push pull rebuild sync");
273 }
274 verify_all_options();
275 zFossil = quoteFilename(g.nameOfExe);
276 db_multi_exec("CREATE TEMP TABLE repolist(name,tag);");
277 if( useCheckouts ){
278 db_multi_exec(
279 "INSERT INTO repolist "
280 "SELECT DISTINCT substr(name, 7), name COLLATE nocase"
281 " FROM global_config"
282 " WHERE substr(name, 1, 6)=='ckout:'"
283 " ORDER BY 1"
284 );
285 }else{
286 db_multi_exec(
287 "INSERT INTO repolist "
288 "SELECT DISTINCT substr(name, 6), name COLLATE nocase"
289 " FROM global_config"
290 " WHERE substr(name, 1, 5)=='repo:'"
291 " ORDER BY 1"
292 );
293 }
294 db_multi_exec("CREATE TEMP TABLE todel(x TEXT)");
295 db_prepare(&q, "SELECT name, tag FROM repolist ORDER BY 1");
296 while( db_step(&q)==SQLITE_ROW ){
297 const char *zFilename = db_column_text(&q, 0);
298 if( file_access(zFilename, F_OK)
299 || !file_is_canonical(zFilename)
300 || (useCheckouts && file_isdir(zFilename)!=1)
@@ -300,10 +311,16 @@
311 zFilename);
312 }
313 zQFilename = quoteFilename(zFilename);
314 zSyscmd = mprintf("%s %s %s%s",
315 zFossil, zCmd, zQFilename, blob_str(&extra));
316 if( showLabel ){
317 int len = (int)strlen(zFilename);
318 int nStar = 80 - (len + 15);
319 if( nStar<2 ) nStar = 1;
320 fossil_print("%.13c %s %.*c\n", '*', zFilename, nStar, '*');
321 }
322 if( !quiet || dryRunFlag ){
323 fossil_print("%s\n", zSyscmd);
324 fflush(stdout);
325 }
326 rc = dryRunFlag ? 0 : fossil_system(zSyscmd);
327

Keyboard Shortcuts

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