Fossil SCM

Remember the URLs for Git-mirror syncs. Show them on the /urllist page.

drh 2021-08-14 22:06 trunk
Commit 458b35a50717c1b663d90033b21bf9b56c4354044ffb22aca19d59fb51b48356
2 files changed +5 +20 -1
--- src/export.c
+++ src/export.c
@@ -1714,10 +1714,15 @@
17141714
fossil_free(zPushCmd);
17151715
zPushCmd = mprintf("git push --mirror %$", zPushUrl);
17161716
rc = fossil_system(zPushCmd);
17171717
if( rc ){
17181718
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();
17191724
}
17201725
fossil_free(zPushCmd);
17211726
}
17221727
}
17231728
17241729
--- 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 @@
481481
int cnt;
482482
int showAll = P("all")!=0;
483483
int nOmitted;
484484
sqlite3_int64 iNow;
485485
char *zRemote;
486
+
486487
login_check_credentials();
487488
if( !g.perm.Admin ){ login_needed(0); return; }
488489
489490
style_set_current_feature("stat");
490491
style_header("URLs and Checkouts");
@@ -540,11 +541,29 @@
540541
url_parse_local(zRemote, URL_OMIT_USER, &x);
541542
@ <p><a href='%h(x.canonical)'>%h(zRemote)</a>
542543
}else{
543544
@ <p>%h(zRemote)</p>
544545
}
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>
546565
}
547566
style_finish_page();
548567
}
549568
550569
/*
551570
--- 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

Keyboard Shortcuts

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