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.
Commit
ef80526267072092b32655f16a46c8dce8d1c72f1fd409acdf966957ce9623e6
Parent
0150eda979ee867…
1 file changed
+22
-3
+22
-3
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -1717,10 +1717,11 @@ | ||
| 1717 | 1717 | int showCherrypicks = 1; /* True to show cherrypick merges */ |
| 1718 | 1718 | int haveParameterN; /* True if n= query parameter present */ |
| 1719 | 1719 | int from_to_mode = 0; /* 0: from,to. 1: from,ft 2: from,bt */ |
| 1720 | 1720 | int showSql = PB("showsql"); /* True to show the SQL */ |
| 1721 | 1721 | Blob allSql; /* Copy of all SQL text */ |
| 1722 | + int bMin = P("min")!=0; /* True if "min" query parameter used */ | |
| 1722 | 1723 | |
| 1723 | 1724 | login_check_credentials(); |
| 1724 | 1725 | url_initialize(&url, "timeline"); |
| 1725 | 1726 | cgi_query_parameters_to_url(&url); |
| 1726 | 1727 | blob_init(&allSql, 0, 0); |
| @@ -2110,23 +2111,41 @@ | ||
| 2110 | 2111 | db_multi_exec( |
| 2111 | 2112 | "CREATE TEMP TABLE IF NOT EXISTS pathnode(x INTEGER PRIMARY KEY);" |
| 2112 | 2113 | ); |
| 2113 | 2114 | if( p ){ |
| 2114 | 2115 | int cnt = 4; |
| 2116 | + char *zPriorBr = 0, *zThisBr = 0, *zNextBr = 0; | |
| 2115 | 2117 | blob_init(&ins, 0, 0); |
| 2116 | 2118 | 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 | + } | |
| 2119 | 2136 | if( cnt==8 ){ |
| 2120 | 2137 | blob_append_sql(&ins, ",\n (%d)", p->rid); |
| 2121 | 2138 | cnt = 0; |
| 2122 | 2139 | }else{ |
| 2123 | 2140 | cnt++; |
| 2124 | 2141 | blob_append_sql(&ins, ",(%d)", p->rid); |
| 2125 | 2142 | } |
| 2126 | - p = p->u.pTo; | |
| 2127 | 2143 | } |
| 2144 | + fossil_free(zPriorBr); | |
| 2145 | + fossil_free(zThisBr); | |
| 2146 | + fossil_free(zNextBr); | |
| 2128 | 2147 | } |
| 2129 | 2148 | path_reset(); |
| 2130 | 2149 | db_multi_exec("%s", blob_str(&ins)/*safe-for-%s*/); |
| 2131 | 2150 | blob_reset(&ins); |
| 2132 | 2151 | if( related ){ |
| 2133 | 2152 |
| --- 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 |