Fossil SCM
Show the synclog on the /urllist page.
Commit
8a2b980d0d1a288c793e397a29fb14bd9e97a089ba00cf2d0747f58cc9c2f4c8
Parent
bda1728a9c531ed…
1 file changed
+88
+88
| --- src/stat.c | ||
| +++ src/stat.c | ||
| @@ -541,10 +541,96 @@ | ||
| 541 | 541 | @ </table> |
| 542 | 542 | if( P("urlonly") ){ |
| 543 | 543 | style_finish_page(); |
| 544 | 544 | return; |
| 545 | 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 | + | |
| 546 | 632 | db_prepare(&q, "SELECT substr(name,7), datetime(mtime,'unixepoch')" |
| 547 | 633 | " FROM config WHERE name GLOB 'ckout:*' ORDER BY 2 DESC"); |
| 548 | 634 | cnt = 0; |
| 549 | 635 | while( db_step(&q)==SQLITE_ROW ){ |
| 550 | 636 | const char *zPath = db_column_text(&q,0); |
| @@ -560,10 +646,12 @@ | ||
| 560 | 646 | } |
| 561 | 647 | db_finalize(&q); |
| 562 | 648 | if( cnt ){ |
| 563 | 649 | @ </table> |
| 564 | 650 | } |
| 651 | + | |
| 652 | + | |
| 565 | 653 | cnt = 0; |
| 566 | 654 | db_prepare(&q, |
| 567 | 655 | "SELECT substr(name,10), datetime(mtime,'unixepoch')" |
| 568 | 656 | " FROM config WHERE name GLOB 'syncwith:*'" |
| 569 | 657 | "UNION ALL " |
| 570 | 658 |
| --- 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 |