Fossil SCM
On the header for a /timeline that uses the new to2= query parameter, use the value of either the to= or the to2= query parameter, whichever is valid.
Commit
452f050241b94485b74d1b1f3c992e648b028383c65ccfe92b45ce3a7c77929a
Parent
650305e94f076c8…
2 files changed
+9
-2
+3
-2
+9
-2
| --- src/name.c | ||
| +++ src/name.c | ||
| @@ -826,25 +826,32 @@ | ||
| 826 | 826 | ** Try to resolve zQP1 into a check-in name. If zQP1 does not exist, |
| 827 | 827 | ** return 0. If zQP1 exists but cannot be resolved, then also try to |
| 828 | 828 | ** resolve zQP2 if it exists. If zQP1 cannot be resolved but zQP2 does |
| 829 | 829 | ** not exist, then raise an error. If both zQP1 and zQP2 exists but |
| 830 | 830 | ** neither can be resolved, also raise an error. |
| 831 | +** | |
| 832 | +** If pzPick is not a NULL pointer, then *pzPick to be the value of whichever | |
| 833 | +** query parameter ended up being used. | |
| 831 | 834 | */ |
| 832 | -int name_choice(const char *zQP1, const char *zQP2){ | |
| 835 | +int name_choice(const char *zQP1, const char *zQP2, const char **pzPick){ | |
| 833 | 836 | const char *zName, *zName2; |
| 834 | 837 | int rid; |
| 835 | 838 | zName = P(zQP1); |
| 836 | 839 | if( zName==0 || zName[0]==0 ) return 0; |
| 837 | 840 | rid = symbolic_name_to_rid(zName, "ci"); |
| 838 | - if( rid>0 ) return rid; | |
| 841 | + if( rid>0 ){ | |
| 842 | + if( pzPick ) *pzPick = zName; | |
| 843 | + return rid; | |
| 844 | + } | |
| 839 | 845 | if( rid<0 ){ |
| 840 | 846 | fossil_fatal("ambiguous name: %s", zName); |
| 841 | 847 | } |
| 842 | 848 | zName2 = P(zQP2); |
| 843 | 849 | if( zName2==0 || zName2[0]==0 ){ |
| 844 | 850 | fossil_fatal("cannot resolve name: %s", zName); |
| 845 | 851 | } |
| 852 | + if( pzPick ) *pzPick = zName2; | |
| 846 | 853 | return name_to_typed_rid(zName2, "ci"); |
| 847 | 854 | } |
| 848 | 855 | |
| 849 | 856 | /* |
| 850 | 857 | ** WEBPAGE: ambiguous |
| 851 | 858 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -826,25 +826,32 @@ | |
| 826 | ** Try to resolve zQP1 into a check-in name. If zQP1 does not exist, |
| 827 | ** return 0. If zQP1 exists but cannot be resolved, then also try to |
| 828 | ** resolve zQP2 if it exists. If zQP1 cannot be resolved but zQP2 does |
| 829 | ** not exist, then raise an error. If both zQP1 and zQP2 exists but |
| 830 | ** neither can be resolved, also raise an error. |
| 831 | */ |
| 832 | int name_choice(const char *zQP1, const char *zQP2){ |
| 833 | const char *zName, *zName2; |
| 834 | int rid; |
| 835 | zName = P(zQP1); |
| 836 | if( zName==0 || zName[0]==0 ) return 0; |
| 837 | rid = symbolic_name_to_rid(zName, "ci"); |
| 838 | if( rid>0 ) return rid; |
| 839 | if( rid<0 ){ |
| 840 | fossil_fatal("ambiguous name: %s", zName); |
| 841 | } |
| 842 | zName2 = P(zQP2); |
| 843 | if( zName2==0 || zName2[0]==0 ){ |
| 844 | fossil_fatal("cannot resolve name: %s", zName); |
| 845 | } |
| 846 | return name_to_typed_rid(zName2, "ci"); |
| 847 | } |
| 848 | |
| 849 | /* |
| 850 | ** WEBPAGE: ambiguous |
| 851 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -826,25 +826,32 @@ | |
| 826 | ** Try to resolve zQP1 into a check-in name. If zQP1 does not exist, |
| 827 | ** return 0. If zQP1 exists but cannot be resolved, then also try to |
| 828 | ** resolve zQP2 if it exists. If zQP1 cannot be resolved but zQP2 does |
| 829 | ** not exist, then raise an error. If both zQP1 and zQP2 exists but |
| 830 | ** neither can be resolved, also raise an error. |
| 831 | ** |
| 832 | ** If pzPick is not a NULL pointer, then *pzPick to be the value of whichever |
| 833 | ** query parameter ended up being used. |
| 834 | */ |
| 835 | int name_choice(const char *zQP1, const char *zQP2, const char **pzPick){ |
| 836 | const char *zName, *zName2; |
| 837 | int rid; |
| 838 | zName = P(zQP1); |
| 839 | if( zName==0 || zName[0]==0 ) return 0; |
| 840 | rid = symbolic_name_to_rid(zName, "ci"); |
| 841 | if( rid>0 ){ |
| 842 | if( pzPick ) *pzPick = zName; |
| 843 | return rid; |
| 844 | } |
| 845 | if( rid<0 ){ |
| 846 | fossil_fatal("ambiguous name: %s", zName); |
| 847 | } |
| 848 | zName2 = P(zQP2); |
| 849 | if( zName2==0 || zName2[0]==0 ){ |
| 850 | fossil_fatal("cannot resolve name: %s", zName); |
| 851 | } |
| 852 | if( pzPick ) *pzPick = zName2; |
| 853 | return name_to_typed_rid(zName2, "ci"); |
| 854 | } |
| 855 | |
| 856 | /* |
| 857 | ** WEBPAGE: ambiguous |
| 858 |
+3
-2
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -1838,11 +1838,12 @@ | ||
| 1838 | 1838 | int tmFlags = 0; /* Timeline flags */ |
| 1839 | 1839 | const char *zThisTag = 0; /* Suppress links to this tag */ |
| 1840 | 1840 | const char *zThisUser = 0; /* Suppress links to this user */ |
| 1841 | 1841 | HQuery url; /* URL for various branch links */ |
| 1842 | 1842 | int from_rid = name_to_typed_rid(P("from"),"ci"); /* from= for paths */ |
| 1843 | - int to_rid = name_choice("to","to2"); /* to= for path timelines */ | |
| 1843 | + const char *zTo2 = 0; | |
| 1844 | + int to_rid = name_choice("to","to2",&zTo2); /* to= for path timelines */ | |
| 1844 | 1845 | int noMerge = P("shortest")==0; /* Follow merge links if shorter */ |
| 1845 | 1846 | int me_rid = name_to_typed_rid(P("me"),"ci"); /* me= for common ancestory */ |
| 1846 | 1847 | int you_rid = name_to_typed_rid(P("you"),"ci");/* you= for common ancst */ |
| 1847 | 1848 | int pd_rid; |
| 1848 | 1849 | double rBefore, rAfter, rCirca; /* Boundary times */ |
| @@ -2212,11 +2213,11 @@ | ||
| 2212 | 2213 | p = path_shortest(from_rid, to_rid, 0, 1, 0); |
| 2213 | 2214 | }else{ |
| 2214 | 2215 | p = path_shortest(to_rid, from_rid, 0, 1, 0); |
| 2215 | 2216 | } |
| 2216 | 2217 | zFrom = P("from"); |
| 2217 | - zTo = P("to"); | |
| 2218 | + zTo = zTo2 ? zTo2 : P("to"); | |
| 2218 | 2219 | }else{ |
| 2219 | 2220 | if( path_common_ancestor(me_rid, you_rid) ){ |
| 2220 | 2221 | p = path_first(); |
| 2221 | 2222 | } |
| 2222 | 2223 | zFrom = P("me"); |
| 2223 | 2224 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1838,11 +1838,12 @@ | |
| 1838 | int tmFlags = 0; /* Timeline flags */ |
| 1839 | const char *zThisTag = 0; /* Suppress links to this tag */ |
| 1840 | const char *zThisUser = 0; /* Suppress links to this user */ |
| 1841 | HQuery url; /* URL for various branch links */ |
| 1842 | int from_rid = name_to_typed_rid(P("from"),"ci"); /* from= for paths */ |
| 1843 | int to_rid = name_choice("to","to2"); /* to= for path timelines */ |
| 1844 | int noMerge = P("shortest")==0; /* Follow merge links if shorter */ |
| 1845 | int me_rid = name_to_typed_rid(P("me"),"ci"); /* me= for common ancestory */ |
| 1846 | int you_rid = name_to_typed_rid(P("you"),"ci");/* you= for common ancst */ |
| 1847 | int pd_rid; |
| 1848 | double rBefore, rAfter, rCirca; /* Boundary times */ |
| @@ -2212,11 +2213,11 @@ | |
| 2212 | p = path_shortest(from_rid, to_rid, 0, 1, 0); |
| 2213 | }else{ |
| 2214 | p = path_shortest(to_rid, from_rid, 0, 1, 0); |
| 2215 | } |
| 2216 | zFrom = P("from"); |
| 2217 | zTo = P("to"); |
| 2218 | }else{ |
| 2219 | if( path_common_ancestor(me_rid, you_rid) ){ |
| 2220 | p = path_first(); |
| 2221 | } |
| 2222 | zFrom = P("me"); |
| 2223 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1838,11 +1838,12 @@ | |
| 1838 | int tmFlags = 0; /* Timeline flags */ |
| 1839 | const char *zThisTag = 0; /* Suppress links to this tag */ |
| 1840 | const char *zThisUser = 0; /* Suppress links to this user */ |
| 1841 | HQuery url; /* URL for various branch links */ |
| 1842 | int from_rid = name_to_typed_rid(P("from"),"ci"); /* from= for paths */ |
| 1843 | const char *zTo2 = 0; |
| 1844 | int to_rid = name_choice("to","to2",&zTo2); /* to= for path timelines */ |
| 1845 | int noMerge = P("shortest")==0; /* Follow merge links if shorter */ |
| 1846 | int me_rid = name_to_typed_rid(P("me"),"ci"); /* me= for common ancestory */ |
| 1847 | int you_rid = name_to_typed_rid(P("you"),"ci");/* you= for common ancst */ |
| 1848 | int pd_rid; |
| 1849 | double rBefore, rAfter, rCirca; /* Boundary times */ |
| @@ -2212,11 +2213,11 @@ | |
| 2213 | p = path_shortest(from_rid, to_rid, 0, 1, 0); |
| 2214 | }else{ |
| 2215 | p = path_shortest(to_rid, from_rid, 0, 1, 0); |
| 2216 | } |
| 2217 | zFrom = P("from"); |
| 2218 | zTo = zTo2 ? zTo2 : P("to"); |
| 2219 | }else{ |
| 2220 | if( path_common_ancestor(me_rid, you_rid) ){ |
| 2221 | p = path_first(); |
| 2222 | } |
| 2223 | zFrom = P("me"); |
| 2224 |