Fossil

Check-in [fc25a127]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Move GLOB before LIKE in list of possible match styles
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | andygoth-timeline-ms
Files: files | file ages | folders
SHA1: fc25a1270e8e712d3c43c10520bf60401111aa10
User & Date: andygoth 2016-11-04 15:48:58
Context
2016-11-04
15:52
Change style_submenu_entry() to allow zero and negative iSize. Zero iSize means display size and length limit are not specified, and negative iSize means no length limit is specified but the display size is set to the absolute value of iSize. check-in: 2e9ac33a user: andygoth tags: andygoth-timeline-ms
15:48
Move GLOB before LIKE in list of possible match styles check-in: fc25a127 user: andygoth tags: andygoth-timeline-ms
15:12
Revert unintended change that snuck in alongside prior merge check-in: f0b91665 user: andygoth tags: andygoth-timeline-ms
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/timeline.c.

1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
....
1263
1264
1265
1266
1267
1268
1269






1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
....
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
....
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
....
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
}

/*
** Tag match expression type code.
*/
typedef enum {
  MS_EXACT,   /* Matches a single tag by exact string comparison. */
  MS_LIKE,    /* Matches tags against a list of LIKE patterns. */
  MS_GLOB,    /* Matches tags against a list of GLOB patterns. */
  MS_REGEXP   /* Matches tags against a list of regular expressions. */
} MatchStyle;

/*
** Construct the tag match SQL expression.
**
** This function is adapted from glob_expr() to support the MS_EXACT, MS_LIKE,
** MS_GLOB, and MS_REGEXP match styles.  For MS_EXACT, the returned expression
** checks for integer match against the tag ID which is looked up directly by
** this function.  For the other modes, the returned SQL expression performs
** string comparisons against the tag names, so it is necessary to join against
** the tag table to access the "tagname" column.
**
** Each pattern is adjusted to to start with "sym-" and be anchored at end.
**
................................................................................
  if( matchStyle==MS_EXACT ){
    *pCount = 1;
    return mprintf("(tagid=%d)", db_int(-1,
        "SELECT tagid FROM tag WHERE tagname='sym-%q'", zTag));
  }

  /* Decide pattern prefix and suffix strings according to match style. */






  if( matchStyle==MS_LIKE ){
    zStart = "(";
    zDelimiter = " OR ";
    zEnd = ")";
    zPrefix = "tagname LIKE 'sym-";
    zSuffix = "'";
  }else if( matchStyle==MS_GLOB ){
    zStart = "(";
    zDelimiter = " OR ";
    zEnd = ")";
    zPrefix = "tagname GLOB 'sym-";
    zSuffix = "'";
  }else/* if( matchStyle==MS_REGEXP )*/{
    zStart = "(tagname REGEXP '^sym-(";
    zDelimiter = "|";
    zEnd = ")$')";
    zPrefix = "";
    zSuffix = "";
  }
................................................................................
**    m=TIMEORTAG    mark this event
**    n=COUNT        suggested number of events in output
**    p=CHECKIN      parents and ancestors of CHECKIN
**    d=CHECKIN      descendants of CHECIN
**    dp=CHECKIN     The same as d=CHECKIN&p=CHECKIN
**    t=TAG          show only check-ins with the given TAG
**    r=TAG          show check-ins related to TAG
**    ms=STYLE       sets tag match style to EXACT, LIKE, GLOB, REGEXP
**    u=USER         only show items associated with USER
**    y=TYPE         'ci', 'w', 't', 'e', or (default) 'all'
**    ng             No Graph.
**    nd             Do not highlight the focus check-in
**    v              Show details of files changed
**    f=CHECKIN      Show family (immediate parents and children) of CHECKIN
**    from=CHECKIN   Path from...
................................................................................
    zThisTag = zTagName;
  }else if( zBrName ){
    zThisTag = zBrName;
  }

  /* Interpet the tag style string. */
  if( zThisTag ){
    if( fossil_stricmp(zMatchStyle, "LIKE")==0 ){
      matchStyle = MS_LIKE;
    }else if( fossil_stricmp(zMatchStyle, "GLOB")==0 ){
      matchStyle = MS_GLOB;
    }else if( fossil_stricmp(zMatchStyle, "REGEXP")==0 ){
      matchStyle = MS_REGEXP;
    }
  }

  /* Construct the tag match expression. */
  if( zThisTag ){
................................................................................
    if( zThisTag ){
      if( matchStyle!=MS_EXACT ){
        if( zTagName ){
          blob_append(&desc, " with tags matching ", -1);
        }else{
          blob_append(&desc, " related to tags matching ", -1);
        }
        if( matchStyle==MS_LIKE ){
          blob_append(&desc, " SQL LIKE pattern", -1);
        }else if( matchStyle==MS_GLOB ){
          blob_append(&desc, " glob pattern", -1);
        }else/* if( matchStyle==MS_REGEXP )*/{
          blob_append(&desc, " regular expression", -1);
        }
        if( tagMatchCount!=1 ){
          blob_append(&desc, "s", 1);
        }
        blob_appendf(&desc, " (%h)", zThisTag);







|
|






|
|







 







>
>
>
>
>
>
|





<
<
<
<
<
<







 







|







 







|
|
|
|







 







|
|
|
|







1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
....
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281






1282
1283
1284
1285
1286
1287
1288
....
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
....
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
....
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
}

/*
** Tag match expression type code.
*/
typedef enum {
  MS_EXACT,   /* Matches a single tag by exact string comparison. */
  MS_GLOB,    /* Matches tags against a list of GLOB patterns. */
  MS_LIKE,    /* Matches tags against a list of LIKE patterns. */
  MS_REGEXP   /* Matches tags against a list of regular expressions. */
} MatchStyle;

/*
** Construct the tag match SQL expression.
**
** This function is adapted from glob_expr() to support the MS_EXACT, MS_GLOB,
** MS_LIKE, and MS_REGEXP match styles.  For MS_EXACT, the returned expression
** checks for integer match against the tag ID which is looked up directly by
** this function.  For the other modes, the returned SQL expression performs
** string comparisons against the tag names, so it is necessary to join against
** the tag table to access the "tagname" column.
**
** Each pattern is adjusted to to start with "sym-" and be anchored at end.
**
................................................................................
  if( matchStyle==MS_EXACT ){
    *pCount = 1;
    return mprintf("(tagid=%d)", db_int(-1,
        "SELECT tagid FROM tag WHERE tagname='sym-%q'", zTag));
  }

  /* Decide pattern prefix and suffix strings according to match style. */
  if( matchStyle==MS_GLOB ){
    zStart = "(";
    zDelimiter = " OR ";
    zEnd = ")";
    zPrefix = "tagname GLOB 'sym-";
    zSuffix = "'";
  }else if( matchStyle==MS_LIKE ){
    zStart = "(";
    zDelimiter = " OR ";
    zEnd = ")";
    zPrefix = "tagname LIKE 'sym-";
    zSuffix = "'";






  }else/* if( matchStyle==MS_REGEXP )*/{
    zStart = "(tagname REGEXP '^sym-(";
    zDelimiter = "|";
    zEnd = ")$')";
    zPrefix = "";
    zSuffix = "";
  }
................................................................................
**    m=TIMEORTAG    mark this event
**    n=COUNT        suggested number of events in output
**    p=CHECKIN      parents and ancestors of CHECKIN
**    d=CHECKIN      descendants of CHECIN
**    dp=CHECKIN     The same as d=CHECKIN&p=CHECKIN
**    t=TAG          show only check-ins with the given TAG
**    r=TAG          show check-ins related to TAG
**    ms=STYLE       sets tag match style to EXACT, GLOB, LIKE, REGEXP
**    u=USER         only show items associated with USER
**    y=TYPE         'ci', 'w', 't', 'e', or (default) 'all'
**    ng             No Graph.
**    nd             Do not highlight the focus check-in
**    v              Show details of files changed
**    f=CHECKIN      Show family (immediate parents and children) of CHECKIN
**    from=CHECKIN   Path from...
................................................................................
    zThisTag = zTagName;
  }else if( zBrName ){
    zThisTag = zBrName;
  }

  /* Interpet the tag style string. */
  if( zThisTag ){
    if( fossil_stricmp(zMatchStyle, "GLOB")==0 ){
      matchStyle = MS_GLOB;
    }else if( fossil_stricmp(zMatchStyle, "LIKE")==0 ){
      matchStyle = MS_LIKE;
    }else if( fossil_stricmp(zMatchStyle, "REGEXP")==0 ){
      matchStyle = MS_REGEXP;
    }
  }

  /* Construct the tag match expression. */
  if( zThisTag ){
................................................................................
    if( zThisTag ){
      if( matchStyle!=MS_EXACT ){
        if( zTagName ){
          blob_append(&desc, " with tags matching ", -1);
        }else{
          blob_append(&desc, " related to tags matching ", -1);
        }
        if( matchStyle==MS_GLOB ){
          blob_append(&desc, " glob pattern", -1);
        }else if( matchStyle==MS_LIKE ){
          blob_append(&desc, " SQL LIKE pattern", -1);
        }else/* if( matchStyle==MS_REGEXP )*/{
          blob_append(&desc, " regular expression", -1);
        }
        if( tagMatchCount!=1 ){
          blob_append(&desc, "s", 1);
        }
        blob_appendf(&desc, " (%h)", zThisTag);