Fossil SCM
Add the "fossil all info" command.
Commit
3f9ff2a9fadf2a2e3d78a870c14859c8cba8f1ab
Parent
bcb7c7a9b1e9470…
1 file changed
+19
-2
+19
-2
| --- src/allrepo.c | ||
| +++ src/allrepo.c | ||
| @@ -107,10 +107,12 @@ | ||
| 107 | 107 | ** |
| 108 | 108 | ** ignore Arguments are repositories that should be ignored by |
| 109 | 109 | ** subsequent clean, extras, list, pull, push, rebuild, and |
| 110 | 110 | ** sync operations. The -c|--ckout option causes the listed |
| 111 | 111 | ** local checkouts to be ignored instead. |
| 112 | +** | |
| 113 | +** info Run the "info" command on all repositories. | |
| 112 | 114 | ** |
| 113 | 115 | ** list | ls Display the location of all repositories. The -c|--ckout |
| 114 | 116 | ** option causes all local checkouts to be listed instead. |
| 115 | 117 | ** |
| 116 | 118 | ** pull Run a "pull" operation on all repositories. Only the |
| @@ -155,10 +157,11 @@ | ||
| 155 | 157 | int dryRunFlag = 0; |
| 156 | 158 | int showFile = find_option("showfile",0,0)!=0; |
| 157 | 159 | int stopOnError = find_option("dontstop",0,0)==0; |
| 158 | 160 | int rc; |
| 159 | 161 | int nToDel = 0; |
| 162 | + int showLabel = 0; | |
| 160 | 163 | |
| 161 | 164 | dryRunFlag = find_option("dry-run","n",0)!=0; |
| 162 | 165 | if( !dryRunFlag ){ |
| 163 | 166 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 164 | 167 | } |
| @@ -258,32 +261,40 @@ | ||
| 258 | 261 | } |
| 259 | 262 | fossil_free(zSql); |
| 260 | 263 | } |
| 261 | 264 | db_end_transaction(0); |
| 262 | 265 | return; |
| 266 | + }else if( strncmp(zCmd, "info", n)==0 ){ | |
| 267 | + zCmd = "info"; | |
| 268 | + showLabel = 1; | |
| 269 | + quiet = 1; | |
| 263 | 270 | }else{ |
| 264 | 271 | fossil_fatal("\"all\" subcommand should be one of: " |
| 265 | 272 | "changes clean extras ignore list ls push pull rebuild sync"); |
| 266 | 273 | } |
| 267 | 274 | verify_all_options(); |
| 268 | 275 | zFossil = quoteFilename(g.nameOfExe); |
| 276 | + db_multi_exec("CREATE TEMP TABLE repolist(name,tag);"); | |
| 269 | 277 | if( useCheckouts ){ |
| 270 | - db_prepare(&q, | |
| 278 | + db_multi_exec( | |
| 279 | + "INSERT INTO repolist " | |
| 271 | 280 | "SELECT DISTINCT substr(name, 7), name COLLATE nocase" |
| 272 | 281 | " FROM global_config" |
| 273 | 282 | " WHERE substr(name, 1, 6)=='ckout:'" |
| 274 | 283 | " ORDER BY 1" |
| 275 | 284 | ); |
| 276 | 285 | }else{ |
| 277 | - db_prepare(&q, | |
| 286 | + db_multi_exec( | |
| 287 | + "INSERT INTO repolist " | |
| 278 | 288 | "SELECT DISTINCT substr(name, 6), name COLLATE nocase" |
| 279 | 289 | " FROM global_config" |
| 280 | 290 | " WHERE substr(name, 1, 5)=='repo:'" |
| 281 | 291 | " ORDER BY 1" |
| 282 | 292 | ); |
| 283 | 293 | } |
| 284 | 294 | db_multi_exec("CREATE TEMP TABLE todel(x TEXT)"); |
| 295 | + db_prepare(&q, "SELECT name, tag FROM repolist ORDER BY 1"); | |
| 285 | 296 | while( db_step(&q)==SQLITE_ROW ){ |
| 286 | 297 | const char *zFilename = db_column_text(&q, 0); |
| 287 | 298 | if( file_access(zFilename, F_OK) |
| 288 | 299 | || !file_is_canonical(zFilename) |
| 289 | 300 | || (useCheckouts && file_isdir(zFilename)!=1) |
| @@ -300,10 +311,16 @@ | ||
| 300 | 311 | zFilename); |
| 301 | 312 | } |
| 302 | 313 | zQFilename = quoteFilename(zFilename); |
| 303 | 314 | zSyscmd = mprintf("%s %s %s%s", |
| 304 | 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 | + } | |
| 305 | 322 | if( !quiet || dryRunFlag ){ |
| 306 | 323 | fossil_print("%s\n", zSyscmd); |
| 307 | 324 | fflush(stdout); |
| 308 | 325 | } |
| 309 | 326 | rc = dryRunFlag ? 0 : fossil_system(zSyscmd); |
| 310 | 327 |
| --- 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 |