Fossil SCM

Improved output (less clutter) from the "fossil all git status" command. Results are only shown from repositories that actually have a Git mirror.

drh 2021-08-14 18:00 trunk
Commit 9179663d8c0efc0c767972b7d36fe6b68a7ffdb02cb05e1faaeb67b587b4bcff
2 files changed +2 -1 +18 -1
+2 -1
--- src/allrepo.c
+++ src/allrepo.c
@@ -254,11 +254,12 @@
254254
}else{
255255
int n3 = (int)strlen(g.argv[3]);
256256
if( strncmp(g.argv[3], "export", n3)==0 ){
257257
zCmd = "git export --if-mirrored -R";
258258
}else if( strncmp(g.argv[3], "status", n3)==0 ){
259
- zCmd = "git status -R";
259
+ zCmd = "git status --by-all -R";
260
+ quiet = 1;
260261
}else{
261262
usage("git (export|status)");
262263
}
263264
}
264265
}else if( strncmp(zCmd, "push", n)==0 ){
265266
--- src/allrepo.c
+++ src/allrepo.c
@@ -254,11 +254,12 @@
254 }else{
255 int n3 = (int)strlen(g.argv[3]);
256 if( strncmp(g.argv[3], "export", n3)==0 ){
257 zCmd = "git export --if-mirrored -R";
258 }else if( strncmp(g.argv[3], "status", n3)==0 ){
259 zCmd = "git status -R";
 
260 }else{
261 usage("git (export|status)");
262 }
263 }
264 }else if( strncmp(zCmd, "push", n)==0 ){
265
--- src/allrepo.c
+++ src/allrepo.c
@@ -254,11 +254,12 @@
254 }else{
255 int n3 = (int)strlen(g.argv[3]);
256 if( strncmp(g.argv[3], "export", n3)==0 ){
257 zCmd = "git export --if-mirrored -R";
258 }else if( strncmp(g.argv[3], "status", n3)==0 ){
259 zCmd = "git status --by-all -R";
260 quiet = 1;
261 }else{
262 usage("git (export|status)");
263 }
264 }
265 }else if( strncmp(zCmd, "push", n)==0 ){
266
+18 -1
--- src/export.c
+++ src/export.c
@@ -1728,17 +1728,32 @@
17281728
*/
17291729
void gitmirror_status_command(void){
17301730
char *zMirror;
17311731
char *z;
17321732
int n, k;
1733
+ int bQuiet = 0;
1734
+ int bByAll = 0; /* Undocumented option meaning this command was invoked
1735
+ ** from "fossil all" and should modify output accordingly */
1736
+
17331737
db_find_and_open_repository(0, 0);
1738
+ bQuiet = find_option("quiet","q",0)!=0;
1739
+ bByAll = find_option("by-all",0,0)!=0;
17341740
verify_all_options();
17351741
zMirror = db_get("last-git-export-repo", 0);
17361742
if( zMirror==0 ){
1737
- fossil_print("Git mirror: none\n");
1743
+ if( !bQuiet && !bByAll ){
1744
+ fossil_print("Git mirror: none\n");
1745
+ }
17381746
return;
17391747
}
1748
+ if( bByAll ){
1749
+ size_t len = strlen(g.zRepositoryName);
1750
+ int n;
1751
+ if( len>60 ) len = 60;
1752
+ n = (int)(65 - len);
1753
+ fossil_print("%.12c %s %.*c\n", '*', g.zRepositoryName, n, '*');
1754
+ }
17401755
fossil_print("Git mirror: %s\n", zMirror);
17411756
db_multi_exec("ATTACH '%q/.mirror_state/db' AS mirror;", zMirror);
17421757
z = db_text(0, "SELECT datetime(value) FROM mconfig WHERE key='start'");
17431758
if( z ){
17441759
double rAge = db_double(0.0, "SELECT julianday('now') - value"
@@ -1826,10 +1841,12 @@
18261841
** TBD...
18271842
**
18281843
** > fossil git status
18291844
**
18301845
** Show the status of the current Git mirror, if there is one.
1846
+**
1847
+** -q|--quiet No output if there is nothing to report
18311848
*/
18321849
void gitmirror_command(void){
18331850
char *zCmd;
18341851
int nCmd;
18351852
if( g.argc<3 ){
18361853
--- src/export.c
+++ src/export.c
@@ -1728,17 +1728,32 @@
1728 */
1729 void gitmirror_status_command(void){
1730 char *zMirror;
1731 char *z;
1732 int n, k;
 
 
 
 
1733 db_find_and_open_repository(0, 0);
 
 
1734 verify_all_options();
1735 zMirror = db_get("last-git-export-repo", 0);
1736 if( zMirror==0 ){
1737 fossil_print("Git mirror: none\n");
 
 
1738 return;
1739 }
 
 
 
 
 
 
 
1740 fossil_print("Git mirror: %s\n", zMirror);
1741 db_multi_exec("ATTACH '%q/.mirror_state/db' AS mirror;", zMirror);
1742 z = db_text(0, "SELECT datetime(value) FROM mconfig WHERE key='start'");
1743 if( z ){
1744 double rAge = db_double(0.0, "SELECT julianday('now') - value"
@@ -1826,10 +1841,12 @@
1826 ** TBD...
1827 **
1828 ** > fossil git status
1829 **
1830 ** Show the status of the current Git mirror, if there is one.
 
 
1831 */
1832 void gitmirror_command(void){
1833 char *zCmd;
1834 int nCmd;
1835 if( g.argc<3 ){
1836
--- src/export.c
+++ src/export.c
@@ -1728,17 +1728,32 @@
1728 */
1729 void gitmirror_status_command(void){
1730 char *zMirror;
1731 char *z;
1732 int n, k;
1733 int bQuiet = 0;
1734 int bByAll = 0; /* Undocumented option meaning this command was invoked
1735 ** from "fossil all" and should modify output accordingly */
1736
1737 db_find_and_open_repository(0, 0);
1738 bQuiet = find_option("quiet","q",0)!=0;
1739 bByAll = find_option("by-all",0,0)!=0;
1740 verify_all_options();
1741 zMirror = db_get("last-git-export-repo", 0);
1742 if( zMirror==0 ){
1743 if( !bQuiet && !bByAll ){
1744 fossil_print("Git mirror: none\n");
1745 }
1746 return;
1747 }
1748 if( bByAll ){
1749 size_t len = strlen(g.zRepositoryName);
1750 int n;
1751 if( len>60 ) len = 60;
1752 n = (int)(65 - len);
1753 fossil_print("%.12c %s %.*c\n", '*', g.zRepositoryName, n, '*');
1754 }
1755 fossil_print("Git mirror: %s\n", zMirror);
1756 db_multi_exec("ATTACH '%q/.mirror_state/db' AS mirror;", zMirror);
1757 z = db_text(0, "SELECT datetime(value) FROM mconfig WHERE key='start'");
1758 if( z ){
1759 double rAge = db_double(0.0, "SELECT julianday('now') - value"
@@ -1826,10 +1841,12 @@
1841 ** TBD...
1842 **
1843 ** > fossil git status
1844 **
1845 ** Show the status of the current Git mirror, if there is one.
1846 **
1847 ** -q|--quiet No output if there is nothing to report
1848 */
1849 void gitmirror_command(void){
1850 char *zCmd;
1851 int nCmd;
1852 if( g.argc<3 ){
1853

Keyboard Shortcuts

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