Fossil SCM
Remember the URLs for Git-mirror syncs. Show them on the /urllist page.
Commit
458b35a50717c1b663d90033b21bf9b56c4354044ffb22aca19d59fb51b48356
Parent
999d838de2a2c57…
2 files changed
+5
+20
-1
+5
| --- src/export.c | ||
| +++ src/export.c | ||
| @@ -1714,10 +1714,15 @@ | ||
| 1714 | 1714 | fossil_free(zPushCmd); |
| 1715 | 1715 | zPushCmd = mprintf("git push --mirror %$", zPushUrl); |
| 1716 | 1716 | rc = fossil_system(zPushCmd); |
| 1717 | 1717 | if( rc ){ |
| 1718 | 1718 | fossil_fatal("cannot push content using: %s", zPushCmd); |
| 1719 | + }else if( db_is_writeable("repository") ){ | |
| 1720 | + db_unprotect(PROTECT_CONFIG); | |
| 1721 | + db_multi_exec("REPLACE INTO config(name,value,mtime)" | |
| 1722 | + "VALUES('gitpush:%q',1,now())", zPushUrl); | |
| 1723 | + db_protect_pop(); | |
| 1719 | 1724 | } |
| 1720 | 1725 | fossil_free(zPushCmd); |
| 1721 | 1726 | } |
| 1722 | 1727 | } |
| 1723 | 1728 | |
| 1724 | 1729 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -1714,10 +1714,15 @@ | |
| 1714 | fossil_free(zPushCmd); |
| 1715 | zPushCmd = mprintf("git push --mirror %$", zPushUrl); |
| 1716 | rc = fossil_system(zPushCmd); |
| 1717 | if( rc ){ |
| 1718 | fossil_fatal("cannot push content using: %s", zPushCmd); |
| 1719 | } |
| 1720 | fossil_free(zPushCmd); |
| 1721 | } |
| 1722 | } |
| 1723 | |
| 1724 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -1714,10 +1714,15 @@ | |
| 1714 | fossil_free(zPushCmd); |
| 1715 | zPushCmd = mprintf("git push --mirror %$", zPushUrl); |
| 1716 | rc = fossil_system(zPushCmd); |
| 1717 | if( rc ){ |
| 1718 | fossil_fatal("cannot push content using: %s", zPushCmd); |
| 1719 | }else if( db_is_writeable("repository") ){ |
| 1720 | db_unprotect(PROTECT_CONFIG); |
| 1721 | db_multi_exec("REPLACE INTO config(name,value,mtime)" |
| 1722 | "VALUES('gitpush:%q',1,now())", zPushUrl); |
| 1723 | db_protect_pop(); |
| 1724 | } |
| 1725 | fossil_free(zPushCmd); |
| 1726 | } |
| 1727 | } |
| 1728 | |
| 1729 |
+20
-1
| --- src/stat.c | ||
| +++ src/stat.c | ||
| @@ -481,10 +481,11 @@ | ||
| 481 | 481 | int cnt; |
| 482 | 482 | int showAll = P("all")!=0; |
| 483 | 483 | int nOmitted; |
| 484 | 484 | sqlite3_int64 iNow; |
| 485 | 485 | char *zRemote; |
| 486 | + | |
| 486 | 487 | login_check_credentials(); |
| 487 | 488 | if( !g.perm.Admin ){ login_needed(0); return; } |
| 488 | 489 | |
| 489 | 490 | style_set_current_feature("stat"); |
| 490 | 491 | style_header("URLs and Checkouts"); |
| @@ -540,11 +541,29 @@ | ||
| 540 | 541 | url_parse_local(zRemote, URL_OMIT_USER, &x); |
| 541 | 542 | @ <p><a href='%h(x.canonical)'>%h(zRemote)</a> |
| 542 | 543 | }else{ |
| 543 | 544 | @ <p>%h(zRemote)</p> |
| 544 | 545 | } |
| 545 | - @ </div> | |
| 546 | + } | |
| 547 | + cnt = 0; | |
| 548 | + db_prepare(&q, "SELECT substr(name,9), datetime(mtime,'unixepoch')" | |
| 549 | + " FROM config WHERE name GLOB 'gitpush:*' ORDER BY 2 DESC"); | |
| 550 | + while( db_step(&q)==SQLITE_ROW ){ | |
| 551 | + const char *zURL = db_column_text(&q,0); | |
| 552 | + UrlData x; | |
| 553 | + if( cnt==0 ){ | |
| 554 | + @ <div class="section">Git Mirrors</div> | |
| 555 | + @ <table border='0' width='100%%'> | |
| 556 | + } | |
| 557 | + url_parse_local(zURL, URL_OMIT_USER, &x); | |
| 558 | + @ <tr><td width='100%%'><a href='%h(x.canonical)'>%h(x.canonical)</a> | |
| 559 | + @ <td><nobr>%h(db_column_text(&q,1))</nobr></td></tr> | |
| 560 | + cnt++; | |
| 561 | + } | |
| 562 | + db_finalize(&q); | |
| 563 | + if( cnt ){ | |
| 564 | + @ </table> | |
| 546 | 565 | } |
| 547 | 566 | style_finish_page(); |
| 548 | 567 | } |
| 549 | 568 | |
| 550 | 569 | /* |
| 551 | 570 |
| --- src/stat.c | |
| +++ src/stat.c | |
| @@ -481,10 +481,11 @@ | |
| 481 | int cnt; |
| 482 | int showAll = P("all")!=0; |
| 483 | int nOmitted; |
| 484 | sqlite3_int64 iNow; |
| 485 | char *zRemote; |
| 486 | login_check_credentials(); |
| 487 | if( !g.perm.Admin ){ login_needed(0); return; } |
| 488 | |
| 489 | style_set_current_feature("stat"); |
| 490 | style_header("URLs and Checkouts"); |
| @@ -540,11 +541,29 @@ | |
| 540 | url_parse_local(zRemote, URL_OMIT_USER, &x); |
| 541 | @ <p><a href='%h(x.canonical)'>%h(zRemote)</a> |
| 542 | }else{ |
| 543 | @ <p>%h(zRemote)</p> |
| 544 | } |
| 545 | @ </div> |
| 546 | } |
| 547 | style_finish_page(); |
| 548 | } |
| 549 | |
| 550 | /* |
| 551 |
| --- src/stat.c | |
| +++ src/stat.c | |
| @@ -481,10 +481,11 @@ | |
| 481 | int cnt; |
| 482 | int showAll = P("all")!=0; |
| 483 | int nOmitted; |
| 484 | sqlite3_int64 iNow; |
| 485 | char *zRemote; |
| 486 | |
| 487 | login_check_credentials(); |
| 488 | if( !g.perm.Admin ){ login_needed(0); return; } |
| 489 | |
| 490 | style_set_current_feature("stat"); |
| 491 | style_header("URLs and Checkouts"); |
| @@ -540,11 +541,29 @@ | |
| 541 | url_parse_local(zRemote, URL_OMIT_USER, &x); |
| 542 | @ <p><a href='%h(x.canonical)'>%h(zRemote)</a> |
| 543 | }else{ |
| 544 | @ <p>%h(zRemote)</p> |
| 545 | } |
| 546 | } |
| 547 | cnt = 0; |
| 548 | db_prepare(&q, "SELECT substr(name,9), datetime(mtime,'unixepoch')" |
| 549 | " FROM config WHERE name GLOB 'gitpush:*' ORDER BY 2 DESC"); |
| 550 | while( db_step(&q)==SQLITE_ROW ){ |
| 551 | const char *zURL = db_column_text(&q,0); |
| 552 | UrlData x; |
| 553 | if( cnt==0 ){ |
| 554 | @ <div class="section">Git Mirrors</div> |
| 555 | @ <table border='0' width='100%%'> |
| 556 | } |
| 557 | url_parse_local(zURL, URL_OMIT_USER, &x); |
| 558 | @ <tr><td width='100%%'><a href='%h(x.canonical)'>%h(x.canonical)</a> |
| 559 | @ <td><nobr>%h(db_column_text(&q,1))</nobr></td></tr> |
| 560 | cnt++; |
| 561 | } |
| 562 | db_finalize(&q); |
| 563 | if( cnt ){ |
| 564 | @ </table> |
| 565 | } |
| 566 | style_finish_page(); |
| 567 | } |
| 568 | |
| 569 | /* |
| 570 |