Fossil SCM

The sl= query parameter on /timeline now honors ms=.

drh 2024-12-24 13:24 trunk
Commit a1a4fc248b25335e303c452a40d7061b05a6bf15b4d98301f09523e3ef30bedd
2 files changed +21 -5 +4 -14
+21 -5
--- src/match.c
+++ src/match.c
@@ -41,15 +41,15 @@
4141
#if INTERFACE
4242
/*
4343
** Types of comparisons that we are able to perform:
4444
*/
4545
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 */
5151
} MatchStyle;
5252
5353
/*
5454
** The following object represents a precompiled pattern to use for
5555
** string matching.
@@ -65,10 +65,26 @@
6565
char **azPattern; /* List of patterns */
6666
ReCompiled **aRe; /* List of compiled regular expressions */
6767
};
6868
6969
#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
+}
7086
7187
7288
/*
7389
** Create a new Matcher object using the pattern provided.
7490
*/
7591
--- 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 @@
18451845
if( zTagName && !*zTagName ){
18461846
zTagName = 0;
18471847
}
18481848
18491849
/* Finish preliminary processing of tag match queries. */
1850
+ matchStyle = match_style(zMatchStyle, MS_EXACT);
18501851
if( zTagName ){
18511852
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 ){
18621854
/* For exact maching, inhibit links to the selected tag. */
18631855
zThisTag = zTagName;
18641856
Th_Store("current_checkin", zTagName);
18651857
}
18661858
@@ -2928,15 +2920,13 @@
29282920
}
29292921
cgi_check_for_malice();
29302922
{
29312923
Matcher *pLeftBranch;
29322924
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"));
29362926
}else{
2937
- pLeftBranch = match_create(matchStyle, zTagName);
2927
+ pLeftBranch = match_create(matchStyle, zBrName?zBrName:zTagName);
29382928
}
29392929
www_print_timeline(&q, tmFlags, zThisUser, zThisTag, pLeftBranch,
29402930
selectedRid, secondaryRid, 0);
29412931
match_free(pLeftBranch);
29422932
}
29432933
--- 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

Keyboard Shortcuts

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