Fossil SCM
Move GLOB before LIKE in list of possible match styles
Commit
fc25a1270e8e712d3c43c10520bf60401111aa10
Parent
f0b91665aba525e…
1 file changed
+17
-17
+17
-17
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -1223,20 +1223,20 @@ | ||
| 1223 | 1223 | /* |
| 1224 | 1224 | ** Tag match expression type code. |
| 1225 | 1225 | */ |
| 1226 | 1226 | typedef enum { |
| 1227 | 1227 | MS_EXACT, /* Matches a single tag by exact string comparison. */ |
| 1228 | - MS_LIKE, /* Matches tags against a list of LIKE patterns. */ | |
| 1229 | 1228 | MS_GLOB, /* Matches tags against a list of GLOB patterns. */ |
| 1229 | + MS_LIKE, /* Matches tags against a list of LIKE patterns. */ | |
| 1230 | 1230 | MS_REGEXP /* Matches tags against a list of regular expressions. */ |
| 1231 | 1231 | } MatchStyle; |
| 1232 | 1232 | |
| 1233 | 1233 | /* |
| 1234 | 1234 | ** Construct the tag match SQL expression. |
| 1235 | 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 | |
| 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 | 1238 | ** checks for integer match against the tag ID which is looked up directly by |
| 1239 | 1239 | ** this function. For the other modes, the returned SQL expression performs |
| 1240 | 1240 | ** string comparisons against the tag names, so it is necessary to join against |
| 1241 | 1241 | ** the tag table to access the "tagname" column. |
| 1242 | 1242 | ** |
| @@ -1265,22 +1265,22 @@ | ||
| 1265 | 1265 | return mprintf("(tagid=%d)", db_int(-1, |
| 1266 | 1266 | "SELECT tagid FROM tag WHERE tagname='sym-%q'", zTag)); |
| 1267 | 1267 | } |
| 1268 | 1268 | |
| 1269 | 1269 | /* 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 ){ | |
| 1271 | 1277 | zStart = "("; |
| 1272 | 1278 | zDelimiter = " OR "; |
| 1273 | 1279 | zEnd = ")"; |
| 1274 | 1280 | zPrefix = "tagname LIKE 'sym-"; |
| 1275 | 1281 | zSuffix = "'"; |
| 1276 | - }else if( matchStyle==MS_GLOB ){ | |
| 1277 | - zStart = "("; | |
| 1278 | - zDelimiter = " OR "; | |
| 1279 | - zEnd = ")"; | |
| 1280 | - zPrefix = "tagname GLOB 'sym-"; | |
| 1281 | - zSuffix = "'"; | |
| 1282 | 1282 | }else/* if( matchStyle==MS_REGEXP )*/{ |
| 1283 | 1283 | zStart = "(tagname REGEXP '^sym-("; |
| 1284 | 1284 | zDelimiter = "|"; |
| 1285 | 1285 | zEnd = ")$')"; |
| 1286 | 1286 | zPrefix = ""; |
| @@ -1358,11 +1358,11 @@ | ||
| 1358 | 1358 | ** p=CHECKIN parents and ancestors of CHECKIN |
| 1359 | 1359 | ** d=CHECKIN descendants of CHECIN |
| 1360 | 1360 | ** dp=CHECKIN The same as d=CHECKIN&p=CHECKIN |
| 1361 | 1361 | ** t=TAG show only check-ins with the given TAG |
| 1362 | 1362 | ** 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 | |
| 1364 | 1364 | ** u=USER only show items associated with USER |
| 1365 | 1365 | ** y=TYPE 'ci', 'w', 't', 'e', or (default) 'all' |
| 1366 | 1366 | ** ng No Graph. |
| 1367 | 1367 | ** nd Do not highlight the focus check-in |
| 1368 | 1368 | ** v Show details of files changed |
| @@ -1477,14 +1477,14 @@ | ||
| 1477 | 1477 | zThisTag = zBrName; |
| 1478 | 1478 | } |
| 1479 | 1479 | |
| 1480 | 1480 | /* Interpet the tag style string. */ |
| 1481 | 1481 | 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 ){ | |
| 1485 | 1483 | matchStyle = MS_GLOB; |
| 1484 | + }else if( fossil_stricmp(zMatchStyle, "LIKE")==0 ){ | |
| 1485 | + matchStyle = MS_LIKE; | |
| 1486 | 1486 | }else if( fossil_stricmp(zMatchStyle, "REGEXP")==0 ){ |
| 1487 | 1487 | matchStyle = MS_REGEXP; |
| 1488 | 1488 | } |
| 1489 | 1489 | } |
| 1490 | 1490 | |
| @@ -1919,14 +1919,14 @@ | ||
| 1919 | 1919 | if( zTagName ){ |
| 1920 | 1920 | blob_append(&desc, " with tags matching ", -1); |
| 1921 | 1921 | }else{ |
| 1922 | 1922 | blob_append(&desc, " related to tags matching ", -1); |
| 1923 | 1923 | } |
| 1924 | - if( matchStyle==MS_LIKE ){ | |
| 1925 | - blob_append(&desc, " SQL LIKE pattern", -1); | |
| 1926 | - }else if( matchStyle==MS_GLOB ){ | |
| 1924 | + if( matchStyle==MS_GLOB ){ | |
| 1927 | 1925 | blob_append(&desc, " glob pattern", -1); |
| 1926 | + }else if( matchStyle==MS_LIKE ){ | |
| 1927 | + blob_append(&desc, " SQL LIKE pattern", -1); | |
| 1928 | 1928 | }else/* if( matchStyle==MS_REGEXP )*/{ |
| 1929 | 1929 | blob_append(&desc, " regular expression", -1); |
| 1930 | 1930 | } |
| 1931 | 1931 | if( tagMatchCount!=1 ){ |
| 1932 | 1932 | blob_append(&desc, "s", 1); |
| 1933 | 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_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 |