Fossil SCM
Fix the "min" and "shortest" query parameters so that they operate independently of one another.
Commit
93269c9f8909c62c8466e3ca51f547f7b9af53dbd7bc1f76cac70ac3d93f5036
Parent
a91586d2563e5ff…
2 files changed
+12
+3
-3
+12
| --- src/path.c | ||
| +++ src/path.c | ||
| @@ -271,10 +271,22 @@ | ||
| 271 | 271 | PathNode *p; |
| 272 | 272 | p = path.pStart; |
| 273 | 273 | if( p ) p = p->u.pTo; |
| 274 | 274 | return p; |
| 275 | 275 | } |
| 276 | + | |
| 277 | +/* | |
| 278 | +** Return the branch for a path node. | |
| 279 | +** | |
| 280 | +** Storage space is managed by the path subsystem. The returned value | |
| 281 | +** is valid until the path is reset. | |
| 282 | +*/ | |
| 283 | +const char *path_branch(PathNode *p){ | |
| 284 | + if( p==0 ) return 0; | |
| 285 | + if( p->zBranch==0 ) p->zBranch = branch_of_rid(p->rid); | |
| 286 | + return p->zBranch; | |
| 287 | +} | |
| 276 | 288 | |
| 277 | 289 | /* |
| 278 | 290 | ** Return an estimate of the number of comparisons remaining in order |
| 279 | 291 | ** to bisect path. This is based on the log2() of path.nStep. |
| 280 | 292 | */ |
| 281 | 293 |
| --- src/path.c | |
| +++ src/path.c | |
| @@ -271,10 +271,22 @@ | |
| 271 | PathNode *p; |
| 272 | p = path.pStart; |
| 273 | if( p ) p = p->u.pTo; |
| 274 | return p; |
| 275 | } |
| 276 | |
| 277 | /* |
| 278 | ** Return an estimate of the number of comparisons remaining in order |
| 279 | ** to bisect path. This is based on the log2() of path.nStep. |
| 280 | */ |
| 281 |
| --- src/path.c | |
| +++ src/path.c | |
| @@ -271,10 +271,22 @@ | |
| 271 | PathNode *p; |
| 272 | p = path.pStart; |
| 273 | if( p ) p = p->u.pTo; |
| 274 | return p; |
| 275 | } |
| 276 | |
| 277 | /* |
| 278 | ** Return the branch for a path node. |
| 279 | ** |
| 280 | ** Storage space is managed by the path subsystem. The returned value |
| 281 | ** is valid until the path is reset. |
| 282 | */ |
| 283 | const char *path_branch(PathNode *p){ |
| 284 | if( p==0 ) return 0; |
| 285 | if( p->zBranch==0 ) p->zBranch = branch_of_rid(p->rid); |
| 286 | return p->zBranch; |
| 287 | } |
| 288 | |
| 289 | /* |
| 290 | ** Return an estimate of the number of comparisons remaining in order |
| 291 | ** to bisect path. This is based on the log2() of path.nStep. |
| 292 | */ |
| 293 |
+3
-3
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -2074,11 +2074,11 @@ | ||
| 2074 | 2074 | const char *zTo = 0; |
| 2075 | 2075 | Blob ins; |
| 2076 | 2076 | int nNodeOnPath = 0; |
| 2077 | 2077 | int commonAncs = 0; /* Common ancestors of me_rid and you_rid. */ |
| 2078 | 2078 | int earlierRid = 0, laterRid = 0; |
| 2079 | - int cost = bMin || !bShort ? 1 : 0; | |
| 2079 | + int cost = bShort ? 0 : 1; | |
| 2080 | 2080 | |
| 2081 | 2081 | if( from_rid && to_rid ){ |
| 2082 | 2082 | if( from_to_mode==0 ){ |
| 2083 | 2083 | p = path_shortest(from_rid, to_rid, 0, 0, 0, cost); |
| 2084 | 2084 | }else if( from_to_mode==1 ){ |
| @@ -2119,12 +2119,12 @@ | ||
| 2119 | 2119 | blob_append_sql(&ins, "INSERT INTO pathnode(x) VALUES(%d)", p->rid); |
| 2120 | 2120 | if( p->u.pTo==0 ) bMin = 0; |
| 2121 | 2121 | for(p=p->u.pTo; p; p=p->u.pTo){ |
| 2122 | 2122 | if( bMin |
| 2123 | 2123 | && p->u.pTo!=0 |
| 2124 | - && fossil_strcmp(p->pFrom->zBranch,p->zBranch)==0 | |
| 2125 | - && fossil_strcmp(p->zBranch,p->u.pTo->zBranch)==0 | |
| 2124 | + && fossil_strcmp(path_branch(p->pFrom),path_branch(p))==0 | |
| 2125 | + && fossil_strcmp(path_branch(p),path_branch(p->u.pTo))==0 | |
| 2126 | 2126 | ){ |
| 2127 | 2127 | continue; |
| 2128 | 2128 | } |
| 2129 | 2129 | if( cnt==8 ){ |
| 2130 | 2130 | blob_append_sql(&ins, ",\n (%d)", p->rid); |
| 2131 | 2131 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -2074,11 +2074,11 @@ | |
| 2074 | const char *zTo = 0; |
| 2075 | Blob ins; |
| 2076 | int nNodeOnPath = 0; |
| 2077 | int commonAncs = 0; /* Common ancestors of me_rid and you_rid. */ |
| 2078 | int earlierRid = 0, laterRid = 0; |
| 2079 | int cost = bMin || !bShort ? 1 : 0; |
| 2080 | |
| 2081 | if( from_rid && to_rid ){ |
| 2082 | if( from_to_mode==0 ){ |
| 2083 | p = path_shortest(from_rid, to_rid, 0, 0, 0, cost); |
| 2084 | }else if( from_to_mode==1 ){ |
| @@ -2119,12 +2119,12 @@ | |
| 2119 | blob_append_sql(&ins, "INSERT INTO pathnode(x) VALUES(%d)", p->rid); |
| 2120 | if( p->u.pTo==0 ) bMin = 0; |
| 2121 | for(p=p->u.pTo; p; p=p->u.pTo){ |
| 2122 | if( bMin |
| 2123 | && p->u.pTo!=0 |
| 2124 | && fossil_strcmp(p->pFrom->zBranch,p->zBranch)==0 |
| 2125 | && fossil_strcmp(p->zBranch,p->u.pTo->zBranch)==0 |
| 2126 | ){ |
| 2127 | continue; |
| 2128 | } |
| 2129 | if( cnt==8 ){ |
| 2130 | blob_append_sql(&ins, ",\n (%d)", p->rid); |
| 2131 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -2074,11 +2074,11 @@ | |
| 2074 | const char *zTo = 0; |
| 2075 | Blob ins; |
| 2076 | int nNodeOnPath = 0; |
| 2077 | int commonAncs = 0; /* Common ancestors of me_rid and you_rid. */ |
| 2078 | int earlierRid = 0, laterRid = 0; |
| 2079 | int cost = bShort ? 0 : 1; |
| 2080 | |
| 2081 | if( from_rid && to_rid ){ |
| 2082 | if( from_to_mode==0 ){ |
| 2083 | p = path_shortest(from_rid, to_rid, 0, 0, 0, cost); |
| 2084 | }else if( from_to_mode==1 ){ |
| @@ -2119,12 +2119,12 @@ | |
| 2119 | blob_append_sql(&ins, "INSERT INTO pathnode(x) VALUES(%d)", p->rid); |
| 2120 | if( p->u.pTo==0 ) bMin = 0; |
| 2121 | for(p=p->u.pTo; p; p=p->u.pTo){ |
| 2122 | if( bMin |
| 2123 | && p->u.pTo!=0 |
| 2124 | && fossil_strcmp(path_branch(p->pFrom),path_branch(p))==0 |
| 2125 | && fossil_strcmp(path_branch(p),path_branch(p->u.pTo))==0 |
| 2126 | ){ |
| 2127 | continue; |
| 2128 | } |
| 2129 | if( cnt==8 ){ |
| 2130 | blob_append_sql(&ins, ",\n (%d)", p->rid); |
| 2131 |