Fossil SCM
The sl= query parameter on /timeline now honors ms=.
Commit
a1a4fc248b25335e303c452a40d7061b05a6bf15b4d98301f09523e3ef30bedd
Parent
b46d2c46912bd8f…
2 files changed
+21
-5
+4
-14
+21
-5
| --- src/match.c | ||
| +++ src/match.c | ||
| @@ -41,15 +41,15 @@ | ||
| 41 | 41 | #if INTERFACE |
| 42 | 42 | /* |
| 43 | 43 | ** Types of comparisons that we are able to perform: |
| 44 | 44 | */ |
| 45 | 45 | typedef enum { |
| 46 | - MS_EXACT, /* Exact string comparison */ | |
| 47 | - MS_GLOB, /* Matches against a list of GLOB patterns. */ | |
| 48 | - MS_LIKE, /* Matches against a list of LIKE patterns. */ | |
| 49 | - MS_REGEXP, /* Matches against a list of regular expressions. */ | |
| 50 | - MS_BRLIST, /* Matches any element of a list */ | |
| 46 | + MS_EXACT=1, /* Exact string comparison */ | |
| 47 | + MS_GLOB=2, /* Matches against a list of GLOB patterns. */ | |
| 48 | + MS_LIKE=3, /* Matches against a list of LIKE patterns. */ | |
| 49 | + MS_REGEXP=4, /* Matches against a list of regular expressions. */ | |
| 50 | + MS_BRLIST=5, /* Matches any element of a list */ | |
| 51 | 51 | } MatchStyle; |
| 52 | 52 | |
| 53 | 53 | /* |
| 54 | 54 | ** The following object represents a precompiled pattern to use for |
| 55 | 55 | ** string matching. |
| @@ -65,10 +65,26 @@ | ||
| 65 | 65 | char **azPattern; /* List of patterns */ |
| 66 | 66 | ReCompiled **aRe; /* List of compiled regular expressions */ |
| 67 | 67 | }; |
| 68 | 68 | |
| 69 | 69 | #endif /*INTERFACE*/ |
| 70 | + | |
| 71 | +/* | |
| 72 | +** Translate a "match style" text name into the MS_* enum value. | |
| 73 | +** Return eDflt if no match is found. | |
| 74 | +*/ | |
| 75 | +MatchStyle match_style(const char *zStyle, MatchStyle eDflt){ | |
| 76 | + if( zStyle==0 ) return eDflt; | |
| 77 | + if( fossil_stricmp(zStyle, "brlist")==0 ) return MS_BRLIST; | |
| 78 | + if( fossil_stricmp(zStyle, "list")==0 ) return MS_BRLIST; | |
| 79 | + if( fossil_stricmp(zStyle, "regexp")==0 ) return MS_REGEXP; | |
| 80 | + if( fossil_stricmp(zStyle, "re")==0 ) return MS_REGEXP; | |
| 81 | + if( fossil_stricmp(zStyle, "glob")==0 ) return MS_GLOB; | |
| 82 | + if( fossil_stricmp(zStyle, "like")==0 ) return MS_LIKE; | |
| 83 | + if( fossil_stricmp(zStyle, "exact")==0 ) return MS_EXACT; | |
| 84 | + return eDflt; | |
| 85 | +} | |
| 70 | 86 | |
| 71 | 87 | |
| 72 | 88 | /* |
| 73 | 89 | ** Create a new Matcher object using the pattern provided. |
| 74 | 90 | */ |
| 75 | 91 |
| --- src/match.c | |
| +++ src/match.c | |
| @@ -41,15 +41,15 @@ | |
| 41 | #if INTERFACE |
| 42 | /* |
| 43 | ** Types of comparisons that we are able to perform: |
| 44 | */ |
| 45 | typedef enum { |
| 46 | MS_EXACT, /* Exact string comparison */ |
| 47 | MS_GLOB, /* Matches against a list of GLOB patterns. */ |
| 48 | MS_LIKE, /* Matches against a list of LIKE patterns. */ |
| 49 | MS_REGEXP, /* Matches against a list of regular expressions. */ |
| 50 | MS_BRLIST, /* Matches any element of a list */ |
| 51 | } MatchStyle; |
| 52 | |
| 53 | /* |
| 54 | ** The following object represents a precompiled pattern to use for |
| 55 | ** string matching. |
| @@ -65,10 +65,26 @@ | |
| 65 | char **azPattern; /* List of patterns */ |
| 66 | ReCompiled **aRe; /* List of compiled regular expressions */ |
| 67 | }; |
| 68 | |
| 69 | #endif /*INTERFACE*/ |
| 70 | |
| 71 | |
| 72 | /* |
| 73 | ** Create a new Matcher object using the pattern provided. |
| 74 | */ |
| 75 |
| --- src/match.c | |
| +++ src/match.c | |
| @@ -41,15 +41,15 @@ | |
| 41 | #if INTERFACE |
| 42 | /* |
| 43 | ** Types of comparisons that we are able to perform: |
| 44 | */ |
| 45 | typedef enum { |
| 46 | MS_EXACT=1, /* Exact string comparison */ |
| 47 | MS_GLOB=2, /* Matches against a list of GLOB patterns. */ |
| 48 | MS_LIKE=3, /* Matches against a list of LIKE patterns. */ |
| 49 | MS_REGEXP=4, /* Matches against a list of regular expressions. */ |
| 50 | MS_BRLIST=5, /* Matches any element of a list */ |
| 51 | } MatchStyle; |
| 52 | |
| 53 | /* |
| 54 | ** The following object represents a precompiled pattern to use for |
| 55 | ** string matching. |
| @@ -65,10 +65,26 @@ | |
| 65 | char **azPattern; /* List of patterns */ |
| 66 | ReCompiled **aRe; /* List of compiled regular expressions */ |
| 67 | }; |
| 68 | |
| 69 | #endif /*INTERFACE*/ |
| 70 | |
| 71 | /* |
| 72 | ** Translate a "match style" text name into the MS_* enum value. |
| 73 | ** Return eDflt if no match is found. |
| 74 | */ |
| 75 | MatchStyle match_style(const char *zStyle, MatchStyle eDflt){ |
| 76 | if( zStyle==0 ) return eDflt; |
| 77 | if( fossil_stricmp(zStyle, "brlist")==0 ) return MS_BRLIST; |
| 78 | if( fossil_stricmp(zStyle, "list")==0 ) return MS_BRLIST; |
| 79 | if( fossil_stricmp(zStyle, "regexp")==0 ) return MS_REGEXP; |
| 80 | if( fossil_stricmp(zStyle, "re")==0 ) return MS_REGEXP; |
| 81 | if( fossil_stricmp(zStyle, "glob")==0 ) return MS_GLOB; |
| 82 | if( fossil_stricmp(zStyle, "like")==0 ) return MS_LIKE; |
| 83 | if( fossil_stricmp(zStyle, "exact")==0 ) return MS_EXACT; |
| 84 | return eDflt; |
| 85 | } |
| 86 | |
| 87 | |
| 88 | /* |
| 89 | ** Create a new Matcher object using the pattern provided. |
| 90 | */ |
| 91 |
+4
-14
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -1845,22 +1845,14 @@ | ||
| 1845 | 1845 | if( zTagName && !*zTagName ){ |
| 1846 | 1846 | zTagName = 0; |
| 1847 | 1847 | } |
| 1848 | 1848 | |
| 1849 | 1849 | /* Finish preliminary processing of tag match queries. */ |
| 1850 | + matchStyle = match_style(zMatchStyle, MS_EXACT); | |
| 1850 | 1851 | if( zTagName ){ |
| 1851 | 1852 | zType = "ci"; |
| 1852 | - /* Interpet the tag style string. */ | |
| 1853 | - if( fossil_stricmp(zMatchStyle, "glob")==0 ){ | |
| 1854 | - matchStyle = MS_GLOB; | |
| 1855 | - }else if( fossil_stricmp(zMatchStyle, "like")==0 ){ | |
| 1856 | - matchStyle = MS_LIKE; | |
| 1857 | - }else if( fossil_stricmp(zMatchStyle, "regexp")==0 ){ | |
| 1858 | - matchStyle = MS_REGEXP; | |
| 1859 | - }else if( fossil_stricmp(zMatchStyle, "brlist")==0 ){ | |
| 1860 | - matchStyle = MS_BRLIST; | |
| 1861 | - }else{ | |
| 1853 | + if( matchStyle==MS_EXACT ){ | |
| 1862 | 1854 | /* For exact maching, inhibit links to the selected tag. */ |
| 1863 | 1855 | zThisTag = zTagName; |
| 1864 | 1856 | Th_Store("current_checkin", zTagName); |
| 1865 | 1857 | } |
| 1866 | 1858 | |
| @@ -2928,15 +2920,13 @@ | ||
| 2928 | 2920 | } |
| 2929 | 2921 | cgi_check_for_malice(); |
| 2930 | 2922 | { |
| 2931 | 2923 | Matcher *pLeftBranch; |
| 2932 | 2924 | if( P("sl")!=0 ){ |
| 2933 | - pLeftBranch = match_create(MS_BRLIST, P("sl")); | |
| 2934 | - }else if( zBrName ){ | |
| 2935 | - pLeftBranch = match_create(matchStyle, zBrName); | |
| 2925 | + pLeftBranch = match_create(zMatchStyle?matchStyle:MS_BRLIST, P("sl")); | |
| 2936 | 2926 | }else{ |
| 2937 | - pLeftBranch = match_create(matchStyle, zTagName); | |
| 2927 | + pLeftBranch = match_create(matchStyle, zBrName?zBrName:zTagName); | |
| 2938 | 2928 | } |
| 2939 | 2929 | www_print_timeline(&q, tmFlags, zThisUser, zThisTag, pLeftBranch, |
| 2940 | 2930 | selectedRid, secondaryRid, 0); |
| 2941 | 2931 | match_free(pLeftBranch); |
| 2942 | 2932 | } |
| 2943 | 2933 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1845,22 +1845,14 @@ | |
| 1845 | if( zTagName && !*zTagName ){ |
| 1846 | zTagName = 0; |
| 1847 | } |
| 1848 | |
| 1849 | /* Finish preliminary processing of tag match queries. */ |
| 1850 | if( zTagName ){ |
| 1851 | zType = "ci"; |
| 1852 | /* Interpet the tag style string. */ |
| 1853 | if( fossil_stricmp(zMatchStyle, "glob")==0 ){ |
| 1854 | matchStyle = MS_GLOB; |
| 1855 | }else if( fossil_stricmp(zMatchStyle, "like")==0 ){ |
| 1856 | matchStyle = MS_LIKE; |
| 1857 | }else if( fossil_stricmp(zMatchStyle, "regexp")==0 ){ |
| 1858 | matchStyle = MS_REGEXP; |
| 1859 | }else if( fossil_stricmp(zMatchStyle, "brlist")==0 ){ |
| 1860 | matchStyle = MS_BRLIST; |
| 1861 | }else{ |
| 1862 | /* For exact maching, inhibit links to the selected tag. */ |
| 1863 | zThisTag = zTagName; |
| 1864 | Th_Store("current_checkin", zTagName); |
| 1865 | } |
| 1866 | |
| @@ -2928,15 +2920,13 @@ | |
| 2928 | } |
| 2929 | cgi_check_for_malice(); |
| 2930 | { |
| 2931 | Matcher *pLeftBranch; |
| 2932 | if( P("sl")!=0 ){ |
| 2933 | pLeftBranch = match_create(MS_BRLIST, P("sl")); |
| 2934 | }else if( zBrName ){ |
| 2935 | pLeftBranch = match_create(matchStyle, zBrName); |
| 2936 | }else{ |
| 2937 | pLeftBranch = match_create(matchStyle, zTagName); |
| 2938 | } |
| 2939 | www_print_timeline(&q, tmFlags, zThisUser, zThisTag, pLeftBranch, |
| 2940 | selectedRid, secondaryRid, 0); |
| 2941 | match_free(pLeftBranch); |
| 2942 | } |
| 2943 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1845,22 +1845,14 @@ | |
| 1845 | if( zTagName && !*zTagName ){ |
| 1846 | zTagName = 0; |
| 1847 | } |
| 1848 | |
| 1849 | /* Finish preliminary processing of tag match queries. */ |
| 1850 | matchStyle = match_style(zMatchStyle, MS_EXACT); |
| 1851 | if( zTagName ){ |
| 1852 | zType = "ci"; |
| 1853 | if( matchStyle==MS_EXACT ){ |
| 1854 | /* For exact maching, inhibit links to the selected tag. */ |
| 1855 | zThisTag = zTagName; |
| 1856 | Th_Store("current_checkin", zTagName); |
| 1857 | } |
| 1858 | |
| @@ -2928,15 +2920,13 @@ | |
| 2920 | } |
| 2921 | cgi_check_for_malice(); |
| 2922 | { |
| 2923 | Matcher *pLeftBranch; |
| 2924 | if( P("sl")!=0 ){ |
| 2925 | pLeftBranch = match_create(zMatchStyle?matchStyle:MS_BRLIST, P("sl")); |
| 2926 | }else{ |
| 2927 | pLeftBranch = match_create(matchStyle, zBrName?zBrName:zTagName); |
| 2928 | } |
| 2929 | www_print_timeline(&q, tmFlags, zThisUser, zThisTag, pLeftBranch, |
| 2930 | selectedRid, secondaryRid, 0); |
| 2931 | match_free(pLeftBranch); |
| 2932 | } |
| 2933 |