Fossil SCM

Enhance the from=/to= query parameters on the /timeline page so that when the "rel" query parameter is present, the graph shows checkins that merge with checkins on the choose path.

drh 2018-12-28 18:15 trunk
Commit 7759a00e3e03e531d093d7974b82df64dad4a1b826b9bd253d7042f6a7d621c6
1 file changed +36 -6
+36 -6
--- src/timeline.c
+++ src/timeline.c
@@ -1434,12 +1434,13 @@
14341434
** ncp Omit cherrypick merges
14351435
** nd Do not highlight the focus check-in
14361436
** v Show details of files changed
14371437
** f=CHECKIN Show family (immediate parents and children) of CHECKIN
14381438
** from=CHECKIN Path from...
1439
-** to=CHECKIN ... to this
1440
-** shortest ... show only the shortest path
1439
+** to=CHECKIN ... to this
1440
+** shorest ... show only the shortest path
1441
+** rel ... also show related checkins
14411442
** uf=FILE_HASH Show only check-ins that contain the given file version
14421443
** chng=GLOBLIST Show only check-ins that involve changes to a file whose
14431444
** name matches one of the comma-separate GLOBLIST
14441445
** brbg Background color from branch name
14451446
** ubg Background color from user
@@ -1721,10 +1722,11 @@
17211722
/* If from= and to= are present, display all nodes on a path connecting
17221723
** the two */
17231724
PathNode *p = 0;
17241725
const char *zFrom = 0;
17251726
const char *zTo = 0;
1727
+ Blob ins;
17261728
17271729
if( from_rid && to_rid ){
17281730
p = path_shortest(from_rid, to_rid, noMerge, 0);
17291731
zFrom = P("from");
17301732
zTo = P("to");
@@ -1733,17 +1735,45 @@
17331735
p = path_first();
17341736
}
17351737
zFrom = P("me");
17361738
zTo = P("you");
17371739
}
1738
- blob_append(&sql, " AND event.objid IN (0", -1);
1739
- while( p ){
1740
- blob_append_sql(&sql, ",%d", p->rid);
1740
+ blob_init(&ins, 0, 0);
1741
+ db_multi_exec(
1742
+ "CREATE TABLE IF NOT EXISTS temp.pathnode(x INTEGER PRIMARY KEY);"
1743
+ );
1744
+ if( p ){
1745
+ blob_init(&ins, 0, 0);
1746
+ blob_append_sql(&ins, "INSERT INTO pathnode(x) VALUES(%d)", p->rid);
17411747
p = p->u.pTo;
1748
+ while( p ){
1749
+ blob_append_sql(&ins, ",(%d)", p->rid);
1750
+ p = p->u.pTo;
1751
+ }
17421752
}
1743
- blob_append(&sql, ")", -1);
17441753
path_reset();
1754
+ db_multi_exec("%s", blob_str(&ins)/*safe-for-%s*/);
1755
+ blob_reset(&ins);
1756
+ if( related ){
1757
+ db_multi_exec(
1758
+ "CREATE TABLE IF NOT EXISTS temp.related(x INTEGER PRIMARY KEY);"
1759
+ "INSERT OR IGNORE INTO related(x)"
1760
+ " SELECT cid FROM plink WHERE pid IN pathnode;"
1761
+ "INSERT OR IGNORE INTO related(x)"
1762
+ " SELECT pid FROM plink WHERE cid IN pathnode;"
1763
+ );
1764
+ if( showCherrypicks ){
1765
+ db_multi_exec(
1766
+ "INSERT OR IGNORE INTO related(x)"
1767
+ " SELECT childid FROM cherrypick WHERE parentid IN pathnode;"
1768
+ "INSERT OR IGNORE INTO related(x)"
1769
+ " SELECT parentid FROM cherrypick WHERE childid IN pathnode;"
1770
+ );
1771
+ }
1772
+ db_multi_exec("INSERT OR IGNORE INTO pathnode SELECT x FROM related");
1773
+ }
1774
+ blob_append_sql(&sql, " AND event.objid IN pathnode");
17451775
addFileGlobExclusion(zChng, &sql);
17461776
tmFlags |= TIMELINE_DISJOINT;
17471777
db_multi_exec("%s", blob_sql_text(&sql));
17481778
if( advancedMenu ){
17491779
style_submenu_checkbox("v", "Files", (zType[0]!='a' && zType[0]!='c'),0);
17501780
--- src/timeline.c
+++ src/timeline.c
@@ -1434,12 +1434,13 @@
1434 ** ncp Omit cherrypick merges
1435 ** nd Do not highlight the focus check-in
1436 ** v Show details of files changed
1437 ** f=CHECKIN Show family (immediate parents and children) of CHECKIN
1438 ** from=CHECKIN Path from...
1439 ** to=CHECKIN ... to this
1440 ** shortest ... show only the shortest path
 
1441 ** uf=FILE_HASH Show only check-ins that contain the given file version
1442 ** chng=GLOBLIST Show only check-ins that involve changes to a file whose
1443 ** name matches one of the comma-separate GLOBLIST
1444 ** brbg Background color from branch name
1445 ** ubg Background color from user
@@ -1721,10 +1722,11 @@
1721 /* If from= and to= are present, display all nodes on a path connecting
1722 ** the two */
1723 PathNode *p = 0;
1724 const char *zFrom = 0;
1725 const char *zTo = 0;
 
1726
1727 if( from_rid && to_rid ){
1728 p = path_shortest(from_rid, to_rid, noMerge, 0);
1729 zFrom = P("from");
1730 zTo = P("to");
@@ -1733,17 +1735,45 @@
1733 p = path_first();
1734 }
1735 zFrom = P("me");
1736 zTo = P("you");
1737 }
1738 blob_append(&sql, " AND event.objid IN (0", -1);
1739 while( p ){
1740 blob_append_sql(&sql, ",%d", p->rid);
 
 
 
 
1741 p = p->u.pTo;
 
 
 
 
1742 }
1743 blob_append(&sql, ")", -1);
1744 path_reset();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1745 addFileGlobExclusion(zChng, &sql);
1746 tmFlags |= TIMELINE_DISJOINT;
1747 db_multi_exec("%s", blob_sql_text(&sql));
1748 if( advancedMenu ){
1749 style_submenu_checkbox("v", "Files", (zType[0]!='a' && zType[0]!='c'),0);
1750
--- src/timeline.c
+++ src/timeline.c
@@ -1434,12 +1434,13 @@
1434 ** ncp Omit cherrypick merges
1435 ** nd Do not highlight the focus check-in
1436 ** v Show details of files changed
1437 ** f=CHECKIN Show family (immediate parents and children) of CHECKIN
1438 ** from=CHECKIN Path from...
1439 ** to=CHECKIN ... to this
1440 ** shorest ... show only the shortest path
1441 ** rel ... also show related checkins
1442 ** uf=FILE_HASH Show only check-ins that contain the given file version
1443 ** chng=GLOBLIST Show only check-ins that involve changes to a file whose
1444 ** name matches one of the comma-separate GLOBLIST
1445 ** brbg Background color from branch name
1446 ** ubg Background color from user
@@ -1721,10 +1722,11 @@
1722 /* If from= and to= are present, display all nodes on a path connecting
1723 ** the two */
1724 PathNode *p = 0;
1725 const char *zFrom = 0;
1726 const char *zTo = 0;
1727 Blob ins;
1728
1729 if( from_rid && to_rid ){
1730 p = path_shortest(from_rid, to_rid, noMerge, 0);
1731 zFrom = P("from");
1732 zTo = P("to");
@@ -1733,17 +1735,45 @@
1735 p = path_first();
1736 }
1737 zFrom = P("me");
1738 zTo = P("you");
1739 }
1740 blob_init(&ins, 0, 0);
1741 db_multi_exec(
1742 "CREATE TABLE IF NOT EXISTS temp.pathnode(x INTEGER PRIMARY KEY);"
1743 );
1744 if( p ){
1745 blob_init(&ins, 0, 0);
1746 blob_append_sql(&ins, "INSERT INTO pathnode(x) VALUES(%d)", p->rid);
1747 p = p->u.pTo;
1748 while( p ){
1749 blob_append_sql(&ins, ",(%d)", p->rid);
1750 p = p->u.pTo;
1751 }
1752 }
 
1753 path_reset();
1754 db_multi_exec("%s", blob_str(&ins)/*safe-for-%s*/);
1755 blob_reset(&ins);
1756 if( related ){
1757 db_multi_exec(
1758 "CREATE TABLE IF NOT EXISTS temp.related(x INTEGER PRIMARY KEY);"
1759 "INSERT OR IGNORE INTO related(x)"
1760 " SELECT cid FROM plink WHERE pid IN pathnode;"
1761 "INSERT OR IGNORE INTO related(x)"
1762 " SELECT pid FROM plink WHERE cid IN pathnode;"
1763 );
1764 if( showCherrypicks ){
1765 db_multi_exec(
1766 "INSERT OR IGNORE INTO related(x)"
1767 " SELECT childid FROM cherrypick WHERE parentid IN pathnode;"
1768 "INSERT OR IGNORE INTO related(x)"
1769 " SELECT parentid FROM cherrypick WHERE childid IN pathnode;"
1770 );
1771 }
1772 db_multi_exec("INSERT OR IGNORE INTO pathnode SELECT x FROM related");
1773 }
1774 blob_append_sql(&sql, " AND event.objid IN pathnode");
1775 addFileGlobExclusion(zChng, &sql);
1776 tmFlags |= TIMELINE_DISJOINT;
1777 db_multi_exec("%s", blob_sql_text(&sql));
1778 if( advancedMenu ){
1779 style_submenu_checkbox("v", "Files", (zType[0]!='a' && zType[0]!='c'),0);
1780

Keyboard Shortcuts

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