Fossil SCM

Add the optional "min" query parameter to /timeline for use with from= and to=, to omit changes of nodes along the same branch for brevity, and to just show the branching changes.

drh 2025-03-06 17:57 trunk
Commit ef80526267072092b32655f16a46c8dce8d1c72f1fd409acdf966957ce9623e6
1 file changed +22 -3
+22 -3
--- src/timeline.c
+++ src/timeline.c
@@ -1717,10 +1717,11 @@
17171717
int showCherrypicks = 1; /* True to show cherrypick merges */
17181718
int haveParameterN; /* True if n= query parameter present */
17191719
int from_to_mode = 0; /* 0: from,to. 1: from,ft 2: from,bt */
17201720
int showSql = PB("showsql"); /* True to show the SQL */
17211721
Blob allSql; /* Copy of all SQL text */
1722
+ int bMin = P("min")!=0; /* True if "min" query parameter used */
17221723
17231724
login_check_credentials();
17241725
url_initialize(&url, "timeline");
17251726
cgi_query_parameters_to_url(&url);
17261727
blob_init(&allSql, 0, 0);
@@ -2110,23 +2111,41 @@
21102111
db_multi_exec(
21112112
"CREATE TEMP TABLE IF NOT EXISTS pathnode(x INTEGER PRIMARY KEY);"
21122113
);
21132114
if( p ){
21142115
int cnt = 4;
2116
+ char *zPriorBr = 0, *zThisBr = 0, *zNextBr = 0;
21152117
blob_init(&ins, 0, 0);
21162118
blob_append_sql(&ins, "INSERT INTO pathnode(x) VALUES(%d)", p->rid);
2117
- p = p->u.pTo;
2118
- while( p ){
2119
+ if( p->u.pTo==0 ) bMin = 0;
2120
+ if( bMin ){
2121
+ zThisBr = branch_of_rid(p->rid);
2122
+ zNextBr = branch_of_rid(p->u.pTo->rid);
2123
+ }
2124
+ for(p=p->u.pTo; p; p=p->u.pTo){
2125
+ if( bMin && p->u.pTo!=0 ){
2126
+ fossil_free(zPriorBr);
2127
+ zPriorBr = zThisBr;
2128
+ zThisBr = zNextBr;
2129
+ zNextBr = branch_of_rid(p->u.pTo->rid);
2130
+ if( fossil_strcmp(zPriorBr,zThisBr)==0
2131
+ && fossil_strcmp(zThisBr,zNextBr)==0
2132
+ ){
2133
+ continue;
2134
+ }
2135
+ }
21192136
if( cnt==8 ){
21202137
blob_append_sql(&ins, ",\n (%d)", p->rid);
21212138
cnt = 0;
21222139
}else{
21232140
cnt++;
21242141
blob_append_sql(&ins, ",(%d)", p->rid);
21252142
}
2126
- p = p->u.pTo;
21272143
}
2144
+ fossil_free(zPriorBr);
2145
+ fossil_free(zThisBr);
2146
+ fossil_free(zNextBr);
21282147
}
21292148
path_reset();
21302149
db_multi_exec("%s", blob_str(&ins)/*safe-for-%s*/);
21312150
blob_reset(&ins);
21322151
if( related ){
21332152
--- src/timeline.c
+++ src/timeline.c
@@ -1717,10 +1717,11 @@
1717 int showCherrypicks = 1; /* True to show cherrypick merges */
1718 int haveParameterN; /* True if n= query parameter present */
1719 int from_to_mode = 0; /* 0: from,to. 1: from,ft 2: from,bt */
1720 int showSql = PB("showsql"); /* True to show the SQL */
1721 Blob allSql; /* Copy of all SQL text */
 
1722
1723 login_check_credentials();
1724 url_initialize(&url, "timeline");
1725 cgi_query_parameters_to_url(&url);
1726 blob_init(&allSql, 0, 0);
@@ -2110,23 +2111,41 @@
2110 db_multi_exec(
2111 "CREATE TEMP TABLE IF NOT EXISTS pathnode(x INTEGER PRIMARY KEY);"
2112 );
2113 if( p ){
2114 int cnt = 4;
 
2115 blob_init(&ins, 0, 0);
2116 blob_append_sql(&ins, "INSERT INTO pathnode(x) VALUES(%d)", p->rid);
2117 p = p->u.pTo;
2118 while( p ){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2119 if( cnt==8 ){
2120 blob_append_sql(&ins, ",\n (%d)", p->rid);
2121 cnt = 0;
2122 }else{
2123 cnt++;
2124 blob_append_sql(&ins, ",(%d)", p->rid);
2125 }
2126 p = p->u.pTo;
2127 }
 
 
 
2128 }
2129 path_reset();
2130 db_multi_exec("%s", blob_str(&ins)/*safe-for-%s*/);
2131 blob_reset(&ins);
2132 if( related ){
2133
--- src/timeline.c
+++ src/timeline.c
@@ -1717,10 +1717,11 @@
1717 int showCherrypicks = 1; /* True to show cherrypick merges */
1718 int haveParameterN; /* True if n= query parameter present */
1719 int from_to_mode = 0; /* 0: from,to. 1: from,ft 2: from,bt */
1720 int showSql = PB("showsql"); /* True to show the SQL */
1721 Blob allSql; /* Copy of all SQL text */
1722 int bMin = P("min")!=0; /* True if "min" query parameter used */
1723
1724 login_check_credentials();
1725 url_initialize(&url, "timeline");
1726 cgi_query_parameters_to_url(&url);
1727 blob_init(&allSql, 0, 0);
@@ -2110,23 +2111,41 @@
2111 db_multi_exec(
2112 "CREATE TEMP TABLE IF NOT EXISTS pathnode(x INTEGER PRIMARY KEY);"
2113 );
2114 if( p ){
2115 int cnt = 4;
2116 char *zPriorBr = 0, *zThisBr = 0, *zNextBr = 0;
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 if( bMin ){
2121 zThisBr = branch_of_rid(p->rid);
2122 zNextBr = branch_of_rid(p->u.pTo->rid);
2123 }
2124 for(p=p->u.pTo; p; p=p->u.pTo){
2125 if( bMin && p->u.pTo!=0 ){
2126 fossil_free(zPriorBr);
2127 zPriorBr = zThisBr;
2128 zThisBr = zNextBr;
2129 zNextBr = branch_of_rid(p->u.pTo->rid);
2130 if( fossil_strcmp(zPriorBr,zThisBr)==0
2131 && fossil_strcmp(zThisBr,zNextBr)==0
2132 ){
2133 continue;
2134 }
2135 }
2136 if( cnt==8 ){
2137 blob_append_sql(&ins, ",\n (%d)", p->rid);
2138 cnt = 0;
2139 }else{
2140 cnt++;
2141 blob_append_sql(&ins, ",(%d)", p->rid);
2142 }
 
2143 }
2144 fossil_free(zPriorBr);
2145 fossil_free(zThisBr);
2146 fossil_free(zNextBr);
2147 }
2148 path_reset();
2149 db_multi_exec("%s", blob_str(&ins)/*safe-for-%s*/);
2150 blob_reset(&ins);
2151 if( related ){
2152

Keyboard Shortcuts

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