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.
Commit
9179663d8c0efc0c767972b7d36fe6b68a7ffdb02cb05e1faaeb67b587b4bcff
Parent
c763040b9d23c6d…
2 files changed
+2
-1
+18
-1
+2
-1
| --- src/allrepo.c | ||
| +++ src/allrepo.c | ||
| @@ -254,11 +254,12 @@ | ||
| 254 | 254 | }else{ |
| 255 | 255 | int n3 = (int)strlen(g.argv[3]); |
| 256 | 256 | if( strncmp(g.argv[3], "export", n3)==0 ){ |
| 257 | 257 | zCmd = "git export --if-mirrored -R"; |
| 258 | 258 | }else if( strncmp(g.argv[3], "status", n3)==0 ){ |
| 259 | - zCmd = "git status -R"; | |
| 259 | + zCmd = "git status --by-all -R"; | |
| 260 | + quiet = 1; | |
| 260 | 261 | }else{ |
| 261 | 262 | usage("git (export|status)"); |
| 262 | 263 | } |
| 263 | 264 | } |
| 264 | 265 | }else if( strncmp(zCmd, "push", n)==0 ){ |
| 265 | 266 |
| --- 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 @@ | ||
| 1728 | 1728 | */ |
| 1729 | 1729 | void gitmirror_status_command(void){ |
| 1730 | 1730 | char *zMirror; |
| 1731 | 1731 | char *z; |
| 1732 | 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 | + | |
| 1733 | 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; | |
| 1734 | 1740 | verify_all_options(); |
| 1735 | 1741 | zMirror = db_get("last-git-export-repo", 0); |
| 1736 | 1742 | if( zMirror==0 ){ |
| 1737 | - fossil_print("Git mirror: none\n"); | |
| 1743 | + if( !bQuiet && !bByAll ){ | |
| 1744 | + fossil_print("Git mirror: none\n"); | |
| 1745 | + } | |
| 1738 | 1746 | return; |
| 1739 | 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 | + } | |
| 1740 | 1755 | fossil_print("Git mirror: %s\n", zMirror); |
| 1741 | 1756 | db_multi_exec("ATTACH '%q/.mirror_state/db' AS mirror;", zMirror); |
| 1742 | 1757 | z = db_text(0, "SELECT datetime(value) FROM mconfig WHERE key='start'"); |
| 1743 | 1758 | if( z ){ |
| 1744 | 1759 | double rAge = db_double(0.0, "SELECT julianday('now') - value" |
| @@ -1826,10 +1841,12 @@ | ||
| 1826 | 1841 | ** TBD... |
| 1827 | 1842 | ** |
| 1828 | 1843 | ** > fossil git status |
| 1829 | 1844 | ** |
| 1830 | 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 | |
| 1831 | 1848 | */ |
| 1832 | 1849 | void gitmirror_command(void){ |
| 1833 | 1850 | char *zCmd; |
| 1834 | 1851 | int nCmd; |
| 1835 | 1852 | if( g.argc<3 ){ |
| 1836 | 1853 |
| --- 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 |