Fossil SCM

Show the synclog on the /urllist page.

drh 2021-12-20 13:26 synclog
Commit 8a2b980d0d1a288c793e397a29fb14bd9e97a089ba00cf2d0747f58cc9c2f4c8
1 file changed +88
+88
--- src/stat.c
+++ src/stat.c
@@ -541,10 +541,96 @@
541541
@ </table>
542542
if( P("urlonly") ){
543543
style_finish_page();
544544
return;
545545
}
546
+
547
+ if( db_table_exists("repository","synclog") ){
548
+ /* This code derived from the "synclog" command in "sync.c" */
549
+ const nIndent = 3;
550
+ db_prepare(&q,
551
+ "WITH allpull(xfrom,xto,xtime) AS MATERIALIZED (\n"
552
+ " SELECT sfrom, sto, max(stime) FROM synclog GROUP BY 1\n"
553
+ "),\n"
554
+ "pull(level, url, mtime, ex) AS (\n"
555
+ " SELECT 0, xfrom, xtime, '|this|' || xfrom || '|'\n"
556
+ " FROM allpull WHERE xto='this'\n"
557
+ " UNION\n"
558
+ " SELECT level+1, xfrom, xtime, ex || xfrom || '|'\n"
559
+ " FROM pull, allpull\n"
560
+ " WHERE xto=url\n"
561
+ " AND ex NOT GLOB ('*|' || xfrom || '|*')\n"
562
+ " ORDER BY 1 DESC, 3 DESC\n"
563
+ ")\n"
564
+ "SELECT level, url, datetime(mtime,'auto') FROM pull"
565
+ );
566
+ cnt = 0;
567
+ while( db_step(&q)==SQLITE_ROW ){
568
+ int iLevel = db_column_int(&q,0)*nIndent;
569
+ const char *zUrl = db_column_text(&q,1);
570
+ const char *zDate = db_column_text(&q,2);
571
+ if( cnt==0 ){
572
+ @ <div class="section">Pulls</div>
573
+ @ <table border="0" width='100%%'>
574
+ }
575
+ if( strncmp(zUrl,"http",4)==0 ){
576
+ @ <tr><td width='100%%'><span style='margin-left:%d(iLevel)em'>\
577
+ @ <a href='%s(zUrl)'>%h(zUrl)</a></td>\
578
+ @ <td><nobr>%h(zDate)</nobr></td></tr>
579
+ }else{
580
+ @ <tr><td width='100%%'><span style='margin-left:%d(iLevel)em'>\
581
+ @ %h(zUrl)</td><td><nobr>%h(zDate)</nobr></td></tr>
582
+ }
583
+ cnt++;
584
+ }
585
+ db_finalize(&q);
586
+ if( cnt ){
587
+ @ </table>
588
+ }
589
+
590
+ db_prepare(&q,
591
+ "WITH allpush(xfrom,xto,xtime) AS MATERIALIZED (\n"
592
+ " SELECT sfrom, sto, max(stime) FROM synclog GROUP BY 2\n"
593
+ "),\n"
594
+ "push(level, url, mtime, ex) AS (\n"
595
+ " SELECT 0, xto, xtime, '|this|' || xto || '|'\n"
596
+ " FROM allpush WHERE xfrom='this'\n"
597
+ " UNION\n"
598
+ " SELECT level+1, xto, xtime, ex || xto || '|'\n"
599
+ " FROM push, allpush\n"
600
+ " WHERE xfrom=url\n"
601
+ " AND ex NOT GLOB ('*|' || xto || '|*')\n"
602
+ " ORDER BY 1 DESC, 3 DESC\n"
603
+ ")\n"
604
+ "SELECT level, url, datetime(mtime,'auto') FROM push"
605
+ );
606
+ cnt = 0;
607
+ while( db_step(&q)==SQLITE_ROW ){
608
+ int iLevel = db_column_int(&q,0)*nIndent;
609
+ const char *zUrl = db_column_text(&q,1);
610
+ const char *zDate = db_column_text(&q,2);
611
+ if( cnt==0 ){
612
+ @ <div class="section">Pushes</div>
613
+ @ <table border="0" width='100%%'>
614
+ }
615
+ if( strncmp(zUrl,"http",4)==0 ){
616
+ @ <tr><td width='100%%'><span style='margin-left:%d(iLevel)em'>\
617
+ @ <a href='%s(zUrl)'>%h(zUrl)</a></td>\
618
+ @ <td><nobr>%h(zDate)</nobr></td></tr>
619
+ }else{
620
+ @ <tr><td width='100%%'><span style='margin-left:%d(iLevel)em'>\
621
+ @ %h(zUrl)</td><td><nobr>%h(zDate)</nobr></td></tr>
622
+ }
623
+ cnt++;
624
+ }
625
+ db_finalize(&q);
626
+ if( cnt ){
627
+ @ </table>
628
+ }
629
+ }
630
+
631
+
546632
db_prepare(&q, "SELECT substr(name,7), datetime(mtime,'unixepoch')"
547633
" FROM config WHERE name GLOB 'ckout:*' ORDER BY 2 DESC");
548634
cnt = 0;
549635
while( db_step(&q)==SQLITE_ROW ){
550636
const char *zPath = db_column_text(&q,0);
@@ -560,10 +646,12 @@
560646
}
561647
db_finalize(&q);
562648
if( cnt ){
563649
@ </table>
564650
}
651
+
652
+
565653
cnt = 0;
566654
db_prepare(&q,
567655
"SELECT substr(name,10), datetime(mtime,'unixepoch')"
568656
" FROM config WHERE name GLOB 'syncwith:*'"
569657
"UNION ALL "
570658
--- src/stat.c
+++ src/stat.c
@@ -541,10 +541,96 @@
541 @ </table>
542 if( P("urlonly") ){
543 style_finish_page();
544 return;
545 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
546 db_prepare(&q, "SELECT substr(name,7), datetime(mtime,'unixepoch')"
547 " FROM config WHERE name GLOB 'ckout:*' ORDER BY 2 DESC");
548 cnt = 0;
549 while( db_step(&q)==SQLITE_ROW ){
550 const char *zPath = db_column_text(&q,0);
@@ -560,10 +646,12 @@
560 }
561 db_finalize(&q);
562 if( cnt ){
563 @ </table>
564 }
 
 
565 cnt = 0;
566 db_prepare(&q,
567 "SELECT substr(name,10), datetime(mtime,'unixepoch')"
568 " FROM config WHERE name GLOB 'syncwith:*'"
569 "UNION ALL "
570
--- src/stat.c
+++ src/stat.c
@@ -541,10 +541,96 @@
541 @ </table>
542 if( P("urlonly") ){
543 style_finish_page();
544 return;
545 }
546
547 if( db_table_exists("repository","synclog") ){
548 /* This code derived from the "synclog" command in "sync.c" */
549 const nIndent = 3;
550 db_prepare(&q,
551 "WITH allpull(xfrom,xto,xtime) AS MATERIALIZED (\n"
552 " SELECT sfrom, sto, max(stime) FROM synclog GROUP BY 1\n"
553 "),\n"
554 "pull(level, url, mtime, ex) AS (\n"
555 " SELECT 0, xfrom, xtime, '|this|' || xfrom || '|'\n"
556 " FROM allpull WHERE xto='this'\n"
557 " UNION\n"
558 " SELECT level+1, xfrom, xtime, ex || xfrom || '|'\n"
559 " FROM pull, allpull\n"
560 " WHERE xto=url\n"
561 " AND ex NOT GLOB ('*|' || xfrom || '|*')\n"
562 " ORDER BY 1 DESC, 3 DESC\n"
563 ")\n"
564 "SELECT level, url, datetime(mtime,'auto') FROM pull"
565 );
566 cnt = 0;
567 while( db_step(&q)==SQLITE_ROW ){
568 int iLevel = db_column_int(&q,0)*nIndent;
569 const char *zUrl = db_column_text(&q,1);
570 const char *zDate = db_column_text(&q,2);
571 if( cnt==0 ){
572 @ <div class="section">Pulls</div>
573 @ <table border="0" width='100%%'>
574 }
575 if( strncmp(zUrl,"http",4)==0 ){
576 @ <tr><td width='100%%'><span style='margin-left:%d(iLevel)em'>\
577 @ <a href='%s(zUrl)'>%h(zUrl)</a></td>\
578 @ <td><nobr>%h(zDate)</nobr></td></tr>
579 }else{
580 @ <tr><td width='100%%'><span style='margin-left:%d(iLevel)em'>\
581 @ %h(zUrl)</td><td><nobr>%h(zDate)</nobr></td></tr>
582 }
583 cnt++;
584 }
585 db_finalize(&q);
586 if( cnt ){
587 @ </table>
588 }
589
590 db_prepare(&q,
591 "WITH allpush(xfrom,xto,xtime) AS MATERIALIZED (\n"
592 " SELECT sfrom, sto, max(stime) FROM synclog GROUP BY 2\n"
593 "),\n"
594 "push(level, url, mtime, ex) AS (\n"
595 " SELECT 0, xto, xtime, '|this|' || xto || '|'\n"
596 " FROM allpush WHERE xfrom='this'\n"
597 " UNION\n"
598 " SELECT level+1, xto, xtime, ex || xto || '|'\n"
599 " FROM push, allpush\n"
600 " WHERE xfrom=url\n"
601 " AND ex NOT GLOB ('*|' || xto || '|*')\n"
602 " ORDER BY 1 DESC, 3 DESC\n"
603 ")\n"
604 "SELECT level, url, datetime(mtime,'auto') FROM push"
605 );
606 cnt = 0;
607 while( db_step(&q)==SQLITE_ROW ){
608 int iLevel = db_column_int(&q,0)*nIndent;
609 const char *zUrl = db_column_text(&q,1);
610 const char *zDate = db_column_text(&q,2);
611 if( cnt==0 ){
612 @ <div class="section">Pushes</div>
613 @ <table border="0" width='100%%'>
614 }
615 if( strncmp(zUrl,"http",4)==0 ){
616 @ <tr><td width='100%%'><span style='margin-left:%d(iLevel)em'>\
617 @ <a href='%s(zUrl)'>%h(zUrl)</a></td>\
618 @ <td><nobr>%h(zDate)</nobr></td></tr>
619 }else{
620 @ <tr><td width='100%%'><span style='margin-left:%d(iLevel)em'>\
621 @ %h(zUrl)</td><td><nobr>%h(zDate)</nobr></td></tr>
622 }
623 cnt++;
624 }
625 db_finalize(&q);
626 if( cnt ){
627 @ </table>
628 }
629 }
630
631
632 db_prepare(&q, "SELECT substr(name,7), datetime(mtime,'unixepoch')"
633 " FROM config WHERE name GLOB 'ckout:*' ORDER BY 2 DESC");
634 cnt = 0;
635 while( db_step(&q)==SQLITE_ROW ){
636 const char *zPath = db_column_text(&q,0);
@@ -560,10 +646,12 @@
646 }
647 db_finalize(&q);
648 if( cnt ){
649 @ </table>
650 }
651
652
653 cnt = 0;
654 db_prepare(&q,
655 "SELECT substr(name,10), datetime(mtime,'unixepoch')"
656 " FROM config WHERE name GLOB 'syncwith:*'"
657 "UNION ALL "
658

Keyboard Shortcuts

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