Fossil SCM

Move GLOB before LIKE in list of possible match styles

andygoth 2016-11-04 15:48 andygoth-timeline-ms
Commit fc25a1270e8e712d3c43c10520bf60401111aa10
1 file changed +17 -17
+17 -17
--- src/timeline.c
+++ src/timeline.c
@@ -1223,20 +1223,20 @@
12231223
/*
12241224
** Tag match expression type code.
12251225
*/
12261226
typedef enum {
12271227
MS_EXACT, /* Matches a single tag by exact string comparison. */
1228
- MS_LIKE, /* Matches tags against a list of LIKE patterns. */
12291228
MS_GLOB, /* Matches tags against a list of GLOB patterns. */
1229
+ MS_LIKE, /* Matches tags against a list of LIKE patterns. */
12301230
MS_REGEXP /* Matches tags against a list of regular expressions. */
12311231
} MatchStyle;
12321232
12331233
/*
12341234
** Construct the tag match SQL expression.
12351235
**
1236
-** This function is adapted from glob_expr() to support the MS_EXACT, MS_LIKE,
1237
-** MS_GLOB, and MS_REGEXP match styles. For MS_EXACT, the returned expression
1236
+** This function is adapted from glob_expr() to support the MS_EXACT, MS_GLOB,
1237
+** MS_LIKE, and MS_REGEXP match styles. For MS_EXACT, the returned expression
12381238
** checks for integer match against the tag ID which is looked up directly by
12391239
** this function. For the other modes, the returned SQL expression performs
12401240
** string comparisons against the tag names, so it is necessary to join against
12411241
** the tag table to access the "tagname" column.
12421242
**
@@ -1265,22 +1265,22 @@
12651265
return mprintf("(tagid=%d)", db_int(-1,
12661266
"SELECT tagid FROM tag WHERE tagname='sym-%q'", zTag));
12671267
}
12681268
12691269
/* Decide pattern prefix and suffix strings according to match style. */
1270
- if( matchStyle==MS_LIKE ){
1270
+ if( matchStyle==MS_GLOB ){
1271
+ zStart = "(";
1272
+ zDelimiter = " OR ";
1273
+ zEnd = ")";
1274
+ zPrefix = "tagname GLOB 'sym-";
1275
+ zSuffix = "'";
1276
+ }else if( matchStyle==MS_LIKE ){
12711277
zStart = "(";
12721278
zDelimiter = " OR ";
12731279
zEnd = ")";
12741280
zPrefix = "tagname LIKE 'sym-";
12751281
zSuffix = "'";
1276
- }else if( matchStyle==MS_GLOB ){
1277
- zStart = "(";
1278
- zDelimiter = " OR ";
1279
- zEnd = ")";
1280
- zPrefix = "tagname GLOB 'sym-";
1281
- zSuffix = "'";
12821282
}else/* if( matchStyle==MS_REGEXP )*/{
12831283
zStart = "(tagname REGEXP '^sym-(";
12841284
zDelimiter = "|";
12851285
zEnd = ")$')";
12861286
zPrefix = "";
@@ -1358,11 +1358,11 @@
13581358
** p=CHECKIN parents and ancestors of CHECKIN
13591359
** d=CHECKIN descendants of CHECIN
13601360
** dp=CHECKIN The same as d=CHECKIN&p=CHECKIN
13611361
** t=TAG show only check-ins with the given TAG
13621362
** r=TAG show check-ins related to TAG
1363
-** ms=STYLE sets tag match style to EXACT, LIKE, GLOB, REGEXP
1363
+** ms=STYLE sets tag match style to EXACT, GLOB, LIKE, REGEXP
13641364
** u=USER only show items associated with USER
13651365
** y=TYPE 'ci', 'w', 't', 'e', or (default) 'all'
13661366
** ng No Graph.
13671367
** nd Do not highlight the focus check-in
13681368
** v Show details of files changed
@@ -1477,14 +1477,14 @@
14771477
zThisTag = zBrName;
14781478
}
14791479
14801480
/* Interpet the tag style string. */
14811481
if( zThisTag ){
1482
- if( fossil_stricmp(zMatchStyle, "LIKE")==0 ){
1483
- matchStyle = MS_LIKE;
1484
- }else if( fossil_stricmp(zMatchStyle, "GLOB")==0 ){
1482
+ if( fossil_stricmp(zMatchStyle, "GLOB")==0 ){
14851483
matchStyle = MS_GLOB;
1484
+ }else if( fossil_stricmp(zMatchStyle, "LIKE")==0 ){
1485
+ matchStyle = MS_LIKE;
14861486
}else if( fossil_stricmp(zMatchStyle, "REGEXP")==0 ){
14871487
matchStyle = MS_REGEXP;
14881488
}
14891489
}
14901490
@@ -1919,14 +1919,14 @@
19191919
if( zTagName ){
19201920
blob_append(&desc, " with tags matching ", -1);
19211921
}else{
19221922
blob_append(&desc, " related to tags matching ", -1);
19231923
}
1924
- if( matchStyle==MS_LIKE ){
1925
- blob_append(&desc, " SQL LIKE pattern", -1);
1926
- }else if( matchStyle==MS_GLOB ){
1924
+ if( matchStyle==MS_GLOB ){
19271925
blob_append(&desc, " glob pattern", -1);
1926
+ }else if( matchStyle==MS_LIKE ){
1927
+ blob_append(&desc, " SQL LIKE pattern", -1);
19281928
}else/* if( matchStyle==MS_REGEXP )*/{
19291929
blob_append(&desc, " regular expression", -1);
19301930
}
19311931
if( tagMatchCount!=1 ){
19321932
blob_append(&desc, "s", 1);
19331933
--- src/timeline.c
+++ src/timeline.c
@@ -1223,20 +1223,20 @@
1223 /*
1224 ** Tag match expression type code.
1225 */
1226 typedef enum {
1227 MS_EXACT, /* Matches a single tag by exact string comparison. */
1228 MS_LIKE, /* Matches tags against a list of LIKE patterns. */
1229 MS_GLOB, /* Matches tags against a list of GLOB patterns. */
 
1230 MS_REGEXP /* Matches tags against a list of regular expressions. */
1231 } MatchStyle;
1232
1233 /*
1234 ** Construct the tag match SQL expression.
1235 **
1236 ** This function is adapted from glob_expr() to support the MS_EXACT, MS_LIKE,
1237 ** MS_GLOB, and MS_REGEXP match styles. For MS_EXACT, the returned expression
1238 ** checks for integer match against the tag ID which is looked up directly by
1239 ** this function. For the other modes, the returned SQL expression performs
1240 ** string comparisons against the tag names, so it is necessary to join against
1241 ** the tag table to access the "tagname" column.
1242 **
@@ -1265,22 +1265,22 @@
1265 return mprintf("(tagid=%d)", db_int(-1,
1266 "SELECT tagid FROM tag WHERE tagname='sym-%q'", zTag));
1267 }
1268
1269 /* Decide pattern prefix and suffix strings according to match style. */
1270 if( matchStyle==MS_LIKE ){
 
 
 
 
 
 
1271 zStart = "(";
1272 zDelimiter = " OR ";
1273 zEnd = ")";
1274 zPrefix = "tagname LIKE 'sym-";
1275 zSuffix = "'";
1276 }else if( matchStyle==MS_GLOB ){
1277 zStart = "(";
1278 zDelimiter = " OR ";
1279 zEnd = ")";
1280 zPrefix = "tagname GLOB 'sym-";
1281 zSuffix = "'";
1282 }else/* if( matchStyle==MS_REGEXP )*/{
1283 zStart = "(tagname REGEXP '^sym-(";
1284 zDelimiter = "|";
1285 zEnd = ")$')";
1286 zPrefix = "";
@@ -1358,11 +1358,11 @@
1358 ** p=CHECKIN parents and ancestors of CHECKIN
1359 ** d=CHECKIN descendants of CHECIN
1360 ** dp=CHECKIN The same as d=CHECKIN&p=CHECKIN
1361 ** t=TAG show only check-ins with the given TAG
1362 ** r=TAG show check-ins related to TAG
1363 ** ms=STYLE sets tag match style to EXACT, LIKE, GLOB, REGEXP
1364 ** u=USER only show items associated with USER
1365 ** y=TYPE 'ci', 'w', 't', 'e', or (default) 'all'
1366 ** ng No Graph.
1367 ** nd Do not highlight the focus check-in
1368 ** v Show details of files changed
@@ -1477,14 +1477,14 @@
1477 zThisTag = zBrName;
1478 }
1479
1480 /* Interpet the tag style string. */
1481 if( zThisTag ){
1482 if( fossil_stricmp(zMatchStyle, "LIKE")==0 ){
1483 matchStyle = MS_LIKE;
1484 }else if( fossil_stricmp(zMatchStyle, "GLOB")==0 ){
1485 matchStyle = MS_GLOB;
 
 
1486 }else if( fossil_stricmp(zMatchStyle, "REGEXP")==0 ){
1487 matchStyle = MS_REGEXP;
1488 }
1489 }
1490
@@ -1919,14 +1919,14 @@
1919 if( zTagName ){
1920 blob_append(&desc, " with tags matching ", -1);
1921 }else{
1922 blob_append(&desc, " related to tags matching ", -1);
1923 }
1924 if( matchStyle==MS_LIKE ){
1925 blob_append(&desc, " SQL LIKE pattern", -1);
1926 }else if( matchStyle==MS_GLOB ){
1927 blob_append(&desc, " glob pattern", -1);
 
 
1928 }else/* if( matchStyle==MS_REGEXP )*/{
1929 blob_append(&desc, " regular expression", -1);
1930 }
1931 if( tagMatchCount!=1 ){
1932 blob_append(&desc, "s", 1);
1933
--- src/timeline.c
+++ src/timeline.c
@@ -1223,20 +1223,20 @@
1223 /*
1224 ** Tag match expression type code.
1225 */
1226 typedef enum {
1227 MS_EXACT, /* Matches a single tag by exact string comparison. */
 
1228 MS_GLOB, /* Matches tags against a list of GLOB patterns. */
1229 MS_LIKE, /* Matches tags against a list of LIKE patterns. */
1230 MS_REGEXP /* Matches tags against a list of regular expressions. */
1231 } MatchStyle;
1232
1233 /*
1234 ** Construct the tag match SQL expression.
1235 **
1236 ** This function is adapted from glob_expr() to support the MS_EXACT, MS_GLOB,
1237 ** MS_LIKE, and MS_REGEXP match styles. For MS_EXACT, the returned expression
1238 ** checks for integer match against the tag ID which is looked up directly by
1239 ** this function. For the other modes, the returned SQL expression performs
1240 ** string comparisons against the tag names, so it is necessary to join against
1241 ** the tag table to access the "tagname" column.
1242 **
@@ -1265,22 +1265,22 @@
1265 return mprintf("(tagid=%d)", db_int(-1,
1266 "SELECT tagid FROM tag WHERE tagname='sym-%q'", zTag));
1267 }
1268
1269 /* Decide pattern prefix and suffix strings according to match style. */
1270 if( matchStyle==MS_GLOB ){
1271 zStart = "(";
1272 zDelimiter = " OR ";
1273 zEnd = ")";
1274 zPrefix = "tagname GLOB 'sym-";
1275 zSuffix = "'";
1276 }else if( matchStyle==MS_LIKE ){
1277 zStart = "(";
1278 zDelimiter = " OR ";
1279 zEnd = ")";
1280 zPrefix = "tagname LIKE 'sym-";
1281 zSuffix = "'";
 
 
 
 
 
 
1282 }else/* if( matchStyle==MS_REGEXP )*/{
1283 zStart = "(tagname REGEXP '^sym-(";
1284 zDelimiter = "|";
1285 zEnd = ")$')";
1286 zPrefix = "";
@@ -1358,11 +1358,11 @@
1358 ** p=CHECKIN parents and ancestors of CHECKIN
1359 ** d=CHECKIN descendants of CHECIN
1360 ** dp=CHECKIN The same as d=CHECKIN&p=CHECKIN
1361 ** t=TAG show only check-ins with the given TAG
1362 ** r=TAG show check-ins related to TAG
1363 ** ms=STYLE sets tag match style to EXACT, GLOB, LIKE, REGEXP
1364 ** u=USER only show items associated with USER
1365 ** y=TYPE 'ci', 'w', 't', 'e', or (default) 'all'
1366 ** ng No Graph.
1367 ** nd Do not highlight the focus check-in
1368 ** v Show details of files changed
@@ -1477,14 +1477,14 @@
1477 zThisTag = zBrName;
1478 }
1479
1480 /* Interpet the tag style string. */
1481 if( zThisTag ){
1482 if( fossil_stricmp(zMatchStyle, "GLOB")==0 ){
 
 
1483 matchStyle = MS_GLOB;
1484 }else if( fossil_stricmp(zMatchStyle, "LIKE")==0 ){
1485 matchStyle = MS_LIKE;
1486 }else if( fossil_stricmp(zMatchStyle, "REGEXP")==0 ){
1487 matchStyle = MS_REGEXP;
1488 }
1489 }
1490
@@ -1919,14 +1919,14 @@
1919 if( zTagName ){
1920 blob_append(&desc, " with tags matching ", -1);
1921 }else{
1922 blob_append(&desc, " related to tags matching ", -1);
1923 }
1924 if( matchStyle==MS_GLOB ){
 
 
1925 blob_append(&desc, " glob pattern", -1);
1926 }else if( matchStyle==MS_LIKE ){
1927 blob_append(&desc, " SQL LIKE pattern", -1);
1928 }else/* if( matchStyle==MS_REGEXP )*/{
1929 blob_append(&desc, " regular expression", -1);
1930 }
1931 if( tagMatchCount!=1 ){
1932 blob_append(&desc, "s", 1);
1933

Keyboard Shortcuts

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