Fossil SCM

In the timeline, remove the "shortest" flag on the from=,to= configuration, as it is not useful. Simplify the implementation of the "min" flag.

drh 2025-03-08 22:49 min-from-to
Commit e09d965fe0d586242773d95368ceb1df5d1a961e74c0e47d55d5d899b09533aa
1 file changed +8 -22
+8 -22
--- src/timeline.c
+++ src/timeline.c
@@ -1603,11 +1603,10 @@
16031603
** vfx Show complete text of forum messages
16041604
** f=CHECKIN Family (immediate parents and children) of CHECKIN
16051605
** from=CHECKIN Path through common ancestor from...
16061606
** to=CHECKIN ... to this
16071607
** to2=CHECKIN ... backup name if to= doesn't resolve
1608
-** shortest ... show only the shortest path
16091608
** rel ... also show related checkins
16101609
** min ... only show key nodes of the path
16111610
** abd ... avoid branch detours
16121611
** bt=PRIOR ... path from CHECKIN back to PRIOR
16131612
** ft=LATER ... path from CHECKIN forward to LATER
@@ -1698,11 +1697,10 @@
16981697
const char *zThisUser = 0; /* Suppress links to this user */
16991698
HQuery url; /* URL for various branch links */
17001699
int from_rid = name_to_typed_rid(P("from"),"ci"); /* from= for paths */
17011700
const char *zTo2 = 0;
17021701
int to_rid = name_choice("to","to2",&zTo2); /* to= for path timelines */
1703
- int noMerge = P("shortest")==0; /* Follow merge links if shorter */
17041702
int me_rid = name_to_typed_rid(P("me"),"ci"); /* me= for common ancestory */
17051703
int you_rid = name_to_typed_rid(P("you"),"ci");/* you= for common ancst */
17061704
int pd_rid;
17071705
const char *zDPName; /* Value of p=, d=, or dp= params */
17081706
double rBefore, rAfter, rCirca; /* Boundary times */
@@ -2075,15 +2073,15 @@
20752073
const char *zTo = 0;
20762074
Blob ins;
20772075
int nNodeOnPath = 0;
20782076
int commonAncs = 0; /* Common ancestors of me_rid and you_rid. */
20792077
int earlierRid = 0, laterRid = 0;
2080
- int cost = bMin || P("abd")!=0 ? 100 : 0;
2078
+ int cost = bMin || P("abd")!=0 ? 1 : 0;
20812079
20822080
if( from_rid && to_rid ){
20832081
if( from_to_mode==0 ){
2084
- p = path_shortest(from_rid, to_rid, noMerge, 0, 0, cost);
2082
+ p = path_shortest(from_rid, to_rid, 0, 0, 0, cost);
20852083
}else if( from_to_mode==1 ){
20862084
p = path_shortest(from_rid, to_rid, 0, 1, 0, cost);
20872085
earlierRid = commonAncs = from_rid;
20882086
laterRid = to_rid;
20892087
}else{
@@ -2114,41 +2112,29 @@
21142112
db_multi_exec(
21152113
"CREATE TEMP TABLE IF NOT EXISTS pathnode(x INTEGER PRIMARY KEY);"
21162114
);
21172115
if( p ){
21182116
int cnt = 4;
2119
- char *zPriorBr = 0, *zThisBr = 0, *zNextBr = 0;
21202117
blob_init(&ins, 0, 0);
21212118
blob_append_sql(&ins, "INSERT INTO pathnode(x) VALUES(%d)", p->rid);
21222119
if( p->u.pTo==0 ) bMin = 0;
2123
- if( bMin ){
2124
- zThisBr = branch_of_rid(p->rid);
2125
- zNextBr = branch_of_rid(p->u.pTo->rid);
2126
- }
21272120
for(p=p->u.pTo; p; p=p->u.pTo){
2128
- if( bMin && p->u.pTo!=0 ){
2129
- fossil_free(zPriorBr);
2130
- zPriorBr = zThisBr;
2131
- zThisBr = zNextBr;
2132
- zNextBr = branch_of_rid(p->u.pTo->rid);
2133
- if( fossil_strcmp(zPriorBr,zThisBr)==0
2134
- && fossil_strcmp(zThisBr,zNextBr)==0
2135
- ){
2136
- continue;
2137
- }
2121
+ if( bMin
2122
+ && p->u.pTo!=0
2123
+ && fossil_strcmp(p->pFrom->zBranch,p->zBranch)==0
2124
+ && fossil_strcmp(p->zBranch,p->u.pTo->zBranch)==0
2125
+ ){
2126
+ continue;
21382127
}
21392128
if( cnt==8 ){
21402129
blob_append_sql(&ins, ",\n (%d)", p->rid);
21412130
cnt = 0;
21422131
}else{
21432132
cnt++;
21442133
blob_append_sql(&ins, ",(%d)", p->rid);
21452134
}
21462135
}
2147
- fossil_free(zPriorBr);
2148
- fossil_free(zThisBr);
2149
- fossil_free(zNextBr);
21502136
}
21512137
path_reset();
21522138
db_multi_exec("%s", blob_str(&ins)/*safe-for-%s*/);
21532139
blob_reset(&ins);
21542140
if( related ){
21552141
--- src/timeline.c
+++ src/timeline.c
@@ -1603,11 +1603,10 @@
1603 ** vfx Show complete text of forum messages
1604 ** f=CHECKIN Family (immediate parents and children) of CHECKIN
1605 ** from=CHECKIN Path through common ancestor from...
1606 ** to=CHECKIN ... to this
1607 ** to2=CHECKIN ... backup name if to= doesn't resolve
1608 ** shortest ... show only the shortest path
1609 ** rel ... also show related checkins
1610 ** min ... only show key nodes of the path
1611 ** abd ... avoid branch detours
1612 ** bt=PRIOR ... path from CHECKIN back to PRIOR
1613 ** ft=LATER ... path from CHECKIN forward to LATER
@@ -1698,11 +1697,10 @@
1698 const char *zThisUser = 0; /* Suppress links to this user */
1699 HQuery url; /* URL for various branch links */
1700 int from_rid = name_to_typed_rid(P("from"),"ci"); /* from= for paths */
1701 const char *zTo2 = 0;
1702 int to_rid = name_choice("to","to2",&zTo2); /* to= for path timelines */
1703 int noMerge = P("shortest")==0; /* Follow merge links if shorter */
1704 int me_rid = name_to_typed_rid(P("me"),"ci"); /* me= for common ancestory */
1705 int you_rid = name_to_typed_rid(P("you"),"ci");/* you= for common ancst */
1706 int pd_rid;
1707 const char *zDPName; /* Value of p=, d=, or dp= params */
1708 double rBefore, rAfter, rCirca; /* Boundary times */
@@ -2075,15 +2073,15 @@
2075 const char *zTo = 0;
2076 Blob ins;
2077 int nNodeOnPath = 0;
2078 int commonAncs = 0; /* Common ancestors of me_rid and you_rid. */
2079 int earlierRid = 0, laterRid = 0;
2080 int cost = bMin || P("abd")!=0 ? 100 : 0;
2081
2082 if( from_rid && to_rid ){
2083 if( from_to_mode==0 ){
2084 p = path_shortest(from_rid, to_rid, noMerge, 0, 0, cost);
2085 }else if( from_to_mode==1 ){
2086 p = path_shortest(from_rid, to_rid, 0, 1, 0, cost);
2087 earlierRid = commonAncs = from_rid;
2088 laterRid = to_rid;
2089 }else{
@@ -2114,41 +2112,29 @@
2114 db_multi_exec(
2115 "CREATE TEMP TABLE IF NOT EXISTS pathnode(x INTEGER PRIMARY KEY);"
2116 );
2117 if( p ){
2118 int cnt = 4;
2119 char *zPriorBr = 0, *zThisBr = 0, *zNextBr = 0;
2120 blob_init(&ins, 0, 0);
2121 blob_append_sql(&ins, "INSERT INTO pathnode(x) VALUES(%d)", p->rid);
2122 if( p->u.pTo==0 ) bMin = 0;
2123 if( bMin ){
2124 zThisBr = branch_of_rid(p->rid);
2125 zNextBr = branch_of_rid(p->u.pTo->rid);
2126 }
2127 for(p=p->u.pTo; p; p=p->u.pTo){
2128 if( bMin && p->u.pTo!=0 ){
2129 fossil_free(zPriorBr);
2130 zPriorBr = zThisBr;
2131 zThisBr = zNextBr;
2132 zNextBr = branch_of_rid(p->u.pTo->rid);
2133 if( fossil_strcmp(zPriorBr,zThisBr)==0
2134 && fossil_strcmp(zThisBr,zNextBr)==0
2135 ){
2136 continue;
2137 }
2138 }
2139 if( cnt==8 ){
2140 blob_append_sql(&ins, ",\n (%d)", p->rid);
2141 cnt = 0;
2142 }else{
2143 cnt++;
2144 blob_append_sql(&ins, ",(%d)", p->rid);
2145 }
2146 }
2147 fossil_free(zPriorBr);
2148 fossil_free(zThisBr);
2149 fossil_free(zNextBr);
2150 }
2151 path_reset();
2152 db_multi_exec("%s", blob_str(&ins)/*safe-for-%s*/);
2153 blob_reset(&ins);
2154 if( related ){
2155
--- src/timeline.c
+++ src/timeline.c
@@ -1603,11 +1603,10 @@
1603 ** vfx Show complete text of forum messages
1604 ** f=CHECKIN Family (immediate parents and children) of CHECKIN
1605 ** from=CHECKIN Path through common ancestor from...
1606 ** to=CHECKIN ... to this
1607 ** to2=CHECKIN ... backup name if to= doesn't resolve
 
1608 ** rel ... also show related checkins
1609 ** min ... only show key nodes of the path
1610 ** abd ... avoid branch detours
1611 ** bt=PRIOR ... path from CHECKIN back to PRIOR
1612 ** ft=LATER ... path from CHECKIN forward to LATER
@@ -1698,11 +1697,10 @@
1697 const char *zThisUser = 0; /* Suppress links to this user */
1698 HQuery url; /* URL for various branch links */
1699 int from_rid = name_to_typed_rid(P("from"),"ci"); /* from= for paths */
1700 const char *zTo2 = 0;
1701 int to_rid = name_choice("to","to2",&zTo2); /* to= for path timelines */
 
1702 int me_rid = name_to_typed_rid(P("me"),"ci"); /* me= for common ancestory */
1703 int you_rid = name_to_typed_rid(P("you"),"ci");/* you= for common ancst */
1704 int pd_rid;
1705 const char *zDPName; /* Value of p=, d=, or dp= params */
1706 double rBefore, rAfter, rCirca; /* Boundary times */
@@ -2075,15 +2073,15 @@
2073 const char *zTo = 0;
2074 Blob ins;
2075 int nNodeOnPath = 0;
2076 int commonAncs = 0; /* Common ancestors of me_rid and you_rid. */
2077 int earlierRid = 0, laterRid = 0;
2078 int cost = bMin || P("abd")!=0 ? 1 : 0;
2079
2080 if( from_rid && to_rid ){
2081 if( from_to_mode==0 ){
2082 p = path_shortest(from_rid, to_rid, 0, 0, 0, cost);
2083 }else if( from_to_mode==1 ){
2084 p = path_shortest(from_rid, to_rid, 0, 1, 0, cost);
2085 earlierRid = commonAncs = from_rid;
2086 laterRid = to_rid;
2087 }else{
@@ -2114,41 +2112,29 @@
2112 db_multi_exec(
2113 "CREATE TEMP TABLE IF NOT EXISTS pathnode(x INTEGER PRIMARY KEY);"
2114 );
2115 if( p ){
2116 int cnt = 4;
 
2117 blob_init(&ins, 0, 0);
2118 blob_append_sql(&ins, "INSERT INTO pathnode(x) VALUES(%d)", p->rid);
2119 if( p->u.pTo==0 ) bMin = 0;
 
 
 
 
2120 for(p=p->u.pTo; p; p=p->u.pTo){
2121 if( bMin
2122 && p->u.pTo!=0
2123 && fossil_strcmp(p->pFrom->zBranch,p->zBranch)==0
2124 && fossil_strcmp(p->zBranch,p->u.pTo->zBranch)==0
2125 ){
2126 continue;
 
 
 
 
2127 }
2128 if( cnt==8 ){
2129 blob_append_sql(&ins, ",\n (%d)", p->rid);
2130 cnt = 0;
2131 }else{
2132 cnt++;
2133 blob_append_sql(&ins, ",(%d)", p->rid);
2134 }
2135 }
 
 
 
2136 }
2137 path_reset();
2138 db_multi_exec("%s", blob_str(&ins)/*safe-for-%s*/);
2139 blob_reset(&ins);
2140 if( related ){
2141

Keyboard Shortcuts

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