Fossil SCM
Enhance the 'fossil extras' and 'fossil all extras' commands using the new --header option to get them to print the associated repository first.
Commit
69974aaa19c7cced4260543ab5b6cfc7810e9af7
Parent
1f6734c30b00fe0…
2 files changed
+5
-1
+7
+5
-1
| --- src/allrepo.c | ||
| +++ src/allrepo.c | ||
| @@ -188,11 +188,15 @@ | ||
| 188 | 188 | collect_argument(&extra, "temp",0); |
| 189 | 189 | collect_argument(&extra, "verbose","v"); |
| 190 | 190 | collect_argument(&extra, "whatif",0); |
| 191 | 191 | useCheckouts = 1; |
| 192 | 192 | }else if( strncmp(zCmd, "extras", n)==0 ){ |
| 193 | - zCmd = "extras --chdir"; | |
| 193 | + if( showFile ){ | |
| 194 | + zCmd = "extras --chdir"; | |
| 195 | + }else{ | |
| 196 | + zCmd = "extras --header --chdir"; | |
| 197 | + } | |
| 194 | 198 | collect_argument(&extra, "abs-paths",0); |
| 195 | 199 | collect_argument_value(&extra, "case-sensitive"); |
| 196 | 200 | collect_argument(&extra, "dotfiles",0); |
| 197 | 201 | collect_argument_value(&extra, "ignore"); |
| 198 | 202 | collect_argument(&extra, "rel-paths",0); |
| 199 | 203 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -188,11 +188,15 @@ | |
| 188 | collect_argument(&extra, "temp",0); |
| 189 | collect_argument(&extra, "verbose","v"); |
| 190 | collect_argument(&extra, "whatif",0); |
| 191 | useCheckouts = 1; |
| 192 | }else if( strncmp(zCmd, "extras", n)==0 ){ |
| 193 | zCmd = "extras --chdir"; |
| 194 | collect_argument(&extra, "abs-paths",0); |
| 195 | collect_argument_value(&extra, "case-sensitive"); |
| 196 | collect_argument(&extra, "dotfiles",0); |
| 197 | collect_argument_value(&extra, "ignore"); |
| 198 | collect_argument(&extra, "rel-paths",0); |
| 199 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -188,11 +188,15 @@ | |
| 188 | collect_argument(&extra, "temp",0); |
| 189 | collect_argument(&extra, "verbose","v"); |
| 190 | collect_argument(&extra, "whatif",0); |
| 191 | useCheckouts = 1; |
| 192 | }else if( strncmp(zCmd, "extras", n)==0 ){ |
| 193 | if( showFile ){ |
| 194 | zCmd = "extras --chdir"; |
| 195 | }else{ |
| 196 | zCmd = "extras --header --chdir"; |
| 197 | } |
| 198 | collect_argument(&extra, "abs-paths",0); |
| 199 | collect_argument_value(&extra, "case-sensitive"); |
| 200 | collect_argument(&extra, "dotfiles",0); |
| 201 | collect_argument_value(&extra, "ignore"); |
| 202 | collect_argument(&extra, "rel-paths",0); |
| 203 |
+7
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -433,10 +433,11 @@ | ||
| 433 | 433 | ** |
| 434 | 434 | ** Options: |
| 435 | 435 | ** --abs-paths Display absolute pathnames. |
| 436 | 436 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 437 | 437 | ** --dotfiles include files beginning with a dot (".") |
| 438 | +** --header Identify the repository if there are extras | |
| 438 | 439 | ** --ignore <CSG> ignore files matching patterns from the argument |
| 439 | 440 | ** --rel-paths Display pathnames relative to the current working |
| 440 | 441 | ** directory. |
| 441 | 442 | ** |
| 442 | 443 | ** See also: changes, clean, status |
| @@ -443,10 +444,11 @@ | ||
| 443 | 444 | */ |
| 444 | 445 | void extras_cmd(void){ |
| 445 | 446 | Stmt q; |
| 446 | 447 | const char *zIgnoreFlag = find_option("ignore",0,1); |
| 447 | 448 | unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0; |
| 449 | + int showHdr = find_option("header",0,0)!=0; | |
| 448 | 450 | int cwdRelative = 0; |
| 449 | 451 | Glob *pIgnore; |
| 450 | 452 | Blob rewrittenPathname; |
| 451 | 453 | const char *zPathname, *zDisplayName; |
| 452 | 454 | |
| @@ -477,10 +479,15 @@ | ||
| 477 | 479 | zDisplayName = blob_str(&rewrittenPathname); |
| 478 | 480 | if( zDisplayName[0]=='.' && zDisplayName[1]=='/' ){ |
| 479 | 481 | zDisplayName += 2; /* no unnecessary ./ prefix */ |
| 480 | 482 | } |
| 481 | 483 | } |
| 484 | + if( showHdr ){ | |
| 485 | + showHdr = 0; | |
| 486 | + fossil_print("Extras for %s at %s:\n", db_get("project-name","???"), | |
| 487 | + g.zLocalRoot); | |
| 488 | + } | |
| 482 | 489 | fossil_print("%s\n", zDisplayName); |
| 483 | 490 | } |
| 484 | 491 | blob_reset(&rewrittenPathname); |
| 485 | 492 | db_finalize(&q); |
| 486 | 493 | } |
| 487 | 494 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -433,10 +433,11 @@ | |
| 433 | ** |
| 434 | ** Options: |
| 435 | ** --abs-paths Display absolute pathnames. |
| 436 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 437 | ** --dotfiles include files beginning with a dot (".") |
| 438 | ** --ignore <CSG> ignore files matching patterns from the argument |
| 439 | ** --rel-paths Display pathnames relative to the current working |
| 440 | ** directory. |
| 441 | ** |
| 442 | ** See also: changes, clean, status |
| @@ -443,10 +444,11 @@ | |
| 443 | */ |
| 444 | void extras_cmd(void){ |
| 445 | Stmt q; |
| 446 | const char *zIgnoreFlag = find_option("ignore",0,1); |
| 447 | unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0; |
| 448 | int cwdRelative = 0; |
| 449 | Glob *pIgnore; |
| 450 | Blob rewrittenPathname; |
| 451 | const char *zPathname, *zDisplayName; |
| 452 | |
| @@ -477,10 +479,15 @@ | |
| 477 | zDisplayName = blob_str(&rewrittenPathname); |
| 478 | if( zDisplayName[0]=='.' && zDisplayName[1]=='/' ){ |
| 479 | zDisplayName += 2; /* no unnecessary ./ prefix */ |
| 480 | } |
| 481 | } |
| 482 | fossil_print("%s\n", zDisplayName); |
| 483 | } |
| 484 | blob_reset(&rewrittenPathname); |
| 485 | db_finalize(&q); |
| 486 | } |
| 487 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -433,10 +433,11 @@ | |
| 433 | ** |
| 434 | ** Options: |
| 435 | ** --abs-paths Display absolute pathnames. |
| 436 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 437 | ** --dotfiles include files beginning with a dot (".") |
| 438 | ** --header Identify the repository if there are extras |
| 439 | ** --ignore <CSG> ignore files matching patterns from the argument |
| 440 | ** --rel-paths Display pathnames relative to the current working |
| 441 | ** directory. |
| 442 | ** |
| 443 | ** See also: changes, clean, status |
| @@ -443,10 +444,11 @@ | |
| 444 | */ |
| 445 | void extras_cmd(void){ |
| 446 | Stmt q; |
| 447 | const char *zIgnoreFlag = find_option("ignore",0,1); |
| 448 | unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0; |
| 449 | int showHdr = find_option("header",0,0)!=0; |
| 450 | int cwdRelative = 0; |
| 451 | Glob *pIgnore; |
| 452 | Blob rewrittenPathname; |
| 453 | const char *zPathname, *zDisplayName; |
| 454 | |
| @@ -477,10 +479,15 @@ | |
| 479 | zDisplayName = blob_str(&rewrittenPathname); |
| 480 | if( zDisplayName[0]=='.' && zDisplayName[1]=='/' ){ |
| 481 | zDisplayName += 2; /* no unnecessary ./ prefix */ |
| 482 | } |
| 483 | } |
| 484 | if( showHdr ){ |
| 485 | showHdr = 0; |
| 486 | fossil_print("Extras for %s at %s:\n", db_get("project-name","???"), |
| 487 | g.zLocalRoot); |
| 488 | } |
| 489 | fossil_print("%s\n", zDisplayName); |
| 490 | } |
| 491 | blob_reset(&rewrittenPathname); |
| 492 | db_finalize(&q); |
| 493 | } |
| 494 |