Fossil SCM

Add the "chng=" query parameter to the "/timeline" page.

drh 2016-06-19 18:49 trunk
Commit b2b62b8318700f9f1e3efc179d4e71bddaf62756
1 file changed +35
--- src/timeline.c
+++ src/timeline.c
@@ -1183,10 +1183,36 @@
11831183
}
11841184
if( i>2 ){
11851185
style_submenu_multichoice("y", i/2, az, isDisabled);
11861186
}
11871187
}
1188
+
1189
+/*
1190
+** If the zChng string is not NULL, then it should be a comma-separated
1191
+** list of glob patterns for filenames. Add an term to the WHERE clause
1192
+** for the SQL statement under construction that excludes any check-in that
1193
+** does not modify one or more files matching the globs.
1194
+*/
1195
+static void addFileGlobExclusion(
1196
+ const char *zChng, /* The filename GLOB list */
1197
+ Blob *pSql /* The SELECT statement under construction */
1198
+){
1199
+ if( zChng==0 || zChng[0]==0 ) return;
1200
+ blob_append_sql(pSql," AND event.objid IN ("
1201
+ "SELECT mlink.mid FROM mlink, filename"
1202
+ " WHERE mlink.fnid=filename.fnid AND %s)",
1203
+ glob_expr("filename.name", zChng));
1204
+}
1205
+static void addFileGlobDescription(
1206
+ const char *zChng, /* The filename GLOB list */
1207
+ Blob *pDescription /* Result description */
1208
+){
1209
+ if( zChng==0 || zChng[0]==0 ) return;
1210
+ blob_appendf(pDescription, " that include changes to files matching %Q",
1211
+ zChng);
1212
+}
1213
+
11881214
11891215
/*
11901216
** WEBPAGE: timeline
11911217
**
11921218
** Query parameters:
@@ -1209,10 +1235,12 @@
12091235
** f=CHECKIN Show family (immediate parents and children) of CHECKIN
12101236
** from=CHECKIN Path from...
12111237
** to=CHECKIN ... to this
12121238
** shortest ... show only the shortest path
12131239
** uf=FILE_SHA1 Show only check-ins that contain the given file version
1240
+** chng=GLOBLIST Show only check-ins that involve changes to a file whose
1241
+** name matches one of the comma-separate GLOBLIST.
12141242
** brbg Background color from branch name
12151243
** ubg Background color from user
12161244
** namechng Show only check-ins that have filename changes
12171245
** forks Show only forks and their children
12181246
** ym=YYYY-MM Show only events for the given year/month.
@@ -1245,10 +1273,11 @@
12451273
const char *zSearch = P("s"); /* Search string */
12461274
const char *zUses = P("uf"); /* Only show check-ins hold this file */
12471275
const char *zYearMonth = P("ym"); /* Show check-ins for the given YYYY-MM */
12481276
const char *zYearWeek = P("yw"); /* Check-ins for YYYY-WW (week-of-year) */
12491277
const char *zDay = P("ymd"); /* Check-ins for the day YYYY-MM-DD */
1278
+ const char *zChng = P("chng"); /* List of GLOBs for files that changed */
12501279
int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */
12511280
int renameOnly = P("namechng")!=0; /* Show only check-ins that rename files */
12521281
int forkOnly = PB("forks"); /* Show only forks and their children */
12531282
int bisectOnly = PB("bisect"); /* Show the check-ins of the bisect */
12541283
int tagid; /* Tag ID */
@@ -1437,17 +1466,21 @@
14371466
blob_append_sql(&sql, ",%d", p->rid);
14381467
p = p->u.pTo;
14391468
}
14401469
blob_append(&sql, ")", -1);
14411470
path_reset();
1471
+ addFileGlobExclusion(zChng, &sql);
14421472
tmFlags |= TIMELINE_DISJOINT;
14431473
db_multi_exec("%s", blob_sql_text(&sql));
1474
+ style_submenu_binary("v","With Files","Without Files",
1475
+ zType[0]!='a' && zType[0]!='c');
14441476
blob_appendf(&desc, "%d check-ins going from ",
14451477
db_int(0, "SELECT count(*) FROM timeline"));
14461478
blob_appendf(&desc, "%z[%h]</a>", href("%R/info/%h", zFrom), zFrom);
14471479
blob_append(&desc, " to ", -1);
14481480
blob_appendf(&desc, "%z[%h]</a>", href("%R/info/%h",zTo), zTo);
1481
+ addFileGlobDescription(zChng, &desc);
14491482
}else if( (p_rid || d_rid) && g.perm.Read ){
14501483
/* If p= or d= is present, ignore all other parameters other than n= */
14511484
char *zUuid;
14521485
int np, nd;
14531486
@@ -1520,10 +1553,11 @@
15201553
int n;
15211554
const char *zEType = "timeline item";
15221555
char *zDate;
15231556
Blob cond;
15241557
blob_zero(&cond);
1558
+ addFileGlobExclusion(zChng, &cond);
15251559
if( zUses ){
15261560
blob_append_sql(&cond, " AND event.objid IN usesfile ");
15271561
}
15281562
if( renameOnly ){
15291563
blob_append_sql(&cond, " AND event.objid IN rnfile ");
@@ -1730,10 +1764,11 @@
17301764
tmFlags |= TIMELINE_DISJOINT;
17311765
}else if( zBrName ){
17321766
blob_appendf(&desc, " related to \"%h\"", zBrName);
17331767
tmFlags |= TIMELINE_DISJOINT;
17341768
}
1769
+ addFileGlobDescription(zChng, &desc);
17351770
if( rAfter>0.0 ){
17361771
if( rBefore>0.0 ){
17371772
blob_appendf(&desc, " occurring between %h and %h.<br />",
17381773
zAfter, zBefore);
17391774
}else{
17401775
--- src/timeline.c
+++ src/timeline.c
@@ -1183,10 +1183,36 @@
1183 }
1184 if( i>2 ){
1185 style_submenu_multichoice("y", i/2, az, isDisabled);
1186 }
1187 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1188
1189 /*
1190 ** WEBPAGE: timeline
1191 **
1192 ** Query parameters:
@@ -1209,10 +1235,12 @@
1209 ** f=CHECKIN Show family (immediate parents and children) of CHECKIN
1210 ** from=CHECKIN Path from...
1211 ** to=CHECKIN ... to this
1212 ** shortest ... show only the shortest path
1213 ** uf=FILE_SHA1 Show only check-ins that contain the given file version
 
 
1214 ** brbg Background color from branch name
1215 ** ubg Background color from user
1216 ** namechng Show only check-ins that have filename changes
1217 ** forks Show only forks and their children
1218 ** ym=YYYY-MM Show only events for the given year/month.
@@ -1245,10 +1273,11 @@
1245 const char *zSearch = P("s"); /* Search string */
1246 const char *zUses = P("uf"); /* Only show check-ins hold this file */
1247 const char *zYearMonth = P("ym"); /* Show check-ins for the given YYYY-MM */
1248 const char *zYearWeek = P("yw"); /* Check-ins for YYYY-WW (week-of-year) */
1249 const char *zDay = P("ymd"); /* Check-ins for the day YYYY-MM-DD */
 
1250 int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */
1251 int renameOnly = P("namechng")!=0; /* Show only check-ins that rename files */
1252 int forkOnly = PB("forks"); /* Show only forks and their children */
1253 int bisectOnly = PB("bisect"); /* Show the check-ins of the bisect */
1254 int tagid; /* Tag ID */
@@ -1437,17 +1466,21 @@
1437 blob_append_sql(&sql, ",%d", p->rid);
1438 p = p->u.pTo;
1439 }
1440 blob_append(&sql, ")", -1);
1441 path_reset();
 
1442 tmFlags |= TIMELINE_DISJOINT;
1443 db_multi_exec("%s", blob_sql_text(&sql));
 
 
1444 blob_appendf(&desc, "%d check-ins going from ",
1445 db_int(0, "SELECT count(*) FROM timeline"));
1446 blob_appendf(&desc, "%z[%h]</a>", href("%R/info/%h", zFrom), zFrom);
1447 blob_append(&desc, " to ", -1);
1448 blob_appendf(&desc, "%z[%h]</a>", href("%R/info/%h",zTo), zTo);
 
1449 }else if( (p_rid || d_rid) && g.perm.Read ){
1450 /* If p= or d= is present, ignore all other parameters other than n= */
1451 char *zUuid;
1452 int np, nd;
1453
@@ -1520,10 +1553,11 @@
1520 int n;
1521 const char *zEType = "timeline item";
1522 char *zDate;
1523 Blob cond;
1524 blob_zero(&cond);
 
1525 if( zUses ){
1526 blob_append_sql(&cond, " AND event.objid IN usesfile ");
1527 }
1528 if( renameOnly ){
1529 blob_append_sql(&cond, " AND event.objid IN rnfile ");
@@ -1730,10 +1764,11 @@
1730 tmFlags |= TIMELINE_DISJOINT;
1731 }else if( zBrName ){
1732 blob_appendf(&desc, " related to \"%h\"", zBrName);
1733 tmFlags |= TIMELINE_DISJOINT;
1734 }
 
1735 if( rAfter>0.0 ){
1736 if( rBefore>0.0 ){
1737 blob_appendf(&desc, " occurring between %h and %h.<br />",
1738 zAfter, zBefore);
1739 }else{
1740
--- src/timeline.c
+++ src/timeline.c
@@ -1183,10 +1183,36 @@
1183 }
1184 if( i>2 ){
1185 style_submenu_multichoice("y", i/2, az, isDisabled);
1186 }
1187 }
1188
1189 /*
1190 ** If the zChng string is not NULL, then it should be a comma-separated
1191 ** list of glob patterns for filenames. Add an term to the WHERE clause
1192 ** for the SQL statement under construction that excludes any check-in that
1193 ** does not modify one or more files matching the globs.
1194 */
1195 static void addFileGlobExclusion(
1196 const char *zChng, /* The filename GLOB list */
1197 Blob *pSql /* The SELECT statement under construction */
1198 ){
1199 if( zChng==0 || zChng[0]==0 ) return;
1200 blob_append_sql(pSql," AND event.objid IN ("
1201 "SELECT mlink.mid FROM mlink, filename"
1202 " WHERE mlink.fnid=filename.fnid AND %s)",
1203 glob_expr("filename.name", zChng));
1204 }
1205 static void addFileGlobDescription(
1206 const char *zChng, /* The filename GLOB list */
1207 Blob *pDescription /* Result description */
1208 ){
1209 if( zChng==0 || zChng[0]==0 ) return;
1210 blob_appendf(pDescription, " that include changes to files matching %Q",
1211 zChng);
1212 }
1213
1214
1215 /*
1216 ** WEBPAGE: timeline
1217 **
1218 ** Query parameters:
@@ -1209,10 +1235,12 @@
1235 ** f=CHECKIN Show family (immediate parents and children) of CHECKIN
1236 ** from=CHECKIN Path from...
1237 ** to=CHECKIN ... to this
1238 ** shortest ... show only the shortest path
1239 ** uf=FILE_SHA1 Show only check-ins that contain the given file version
1240 ** chng=GLOBLIST Show only check-ins that involve changes to a file whose
1241 ** name matches one of the comma-separate GLOBLIST.
1242 ** brbg Background color from branch name
1243 ** ubg Background color from user
1244 ** namechng Show only check-ins that have filename changes
1245 ** forks Show only forks and their children
1246 ** ym=YYYY-MM Show only events for the given year/month.
@@ -1245,10 +1273,11 @@
1273 const char *zSearch = P("s"); /* Search string */
1274 const char *zUses = P("uf"); /* Only show check-ins hold this file */
1275 const char *zYearMonth = P("ym"); /* Show check-ins for the given YYYY-MM */
1276 const char *zYearWeek = P("yw"); /* Check-ins for YYYY-WW (week-of-year) */
1277 const char *zDay = P("ymd"); /* Check-ins for the day YYYY-MM-DD */
1278 const char *zChng = P("chng"); /* List of GLOBs for files that changed */
1279 int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */
1280 int renameOnly = P("namechng")!=0; /* Show only check-ins that rename files */
1281 int forkOnly = PB("forks"); /* Show only forks and their children */
1282 int bisectOnly = PB("bisect"); /* Show the check-ins of the bisect */
1283 int tagid; /* Tag ID */
@@ -1437,17 +1466,21 @@
1466 blob_append_sql(&sql, ",%d", p->rid);
1467 p = p->u.pTo;
1468 }
1469 blob_append(&sql, ")", -1);
1470 path_reset();
1471 addFileGlobExclusion(zChng, &sql);
1472 tmFlags |= TIMELINE_DISJOINT;
1473 db_multi_exec("%s", blob_sql_text(&sql));
1474 style_submenu_binary("v","With Files","Without Files",
1475 zType[0]!='a' && zType[0]!='c');
1476 blob_appendf(&desc, "%d check-ins going from ",
1477 db_int(0, "SELECT count(*) FROM timeline"));
1478 blob_appendf(&desc, "%z[%h]</a>", href("%R/info/%h", zFrom), zFrom);
1479 blob_append(&desc, " to ", -1);
1480 blob_appendf(&desc, "%z[%h]</a>", href("%R/info/%h",zTo), zTo);
1481 addFileGlobDescription(zChng, &desc);
1482 }else if( (p_rid || d_rid) && g.perm.Read ){
1483 /* If p= or d= is present, ignore all other parameters other than n= */
1484 char *zUuid;
1485 int np, nd;
1486
@@ -1520,10 +1553,11 @@
1553 int n;
1554 const char *zEType = "timeline item";
1555 char *zDate;
1556 Blob cond;
1557 blob_zero(&cond);
1558 addFileGlobExclusion(zChng, &cond);
1559 if( zUses ){
1560 blob_append_sql(&cond, " AND event.objid IN usesfile ");
1561 }
1562 if( renameOnly ){
1563 blob_append_sql(&cond, " AND event.objid IN rnfile ");
@@ -1730,10 +1764,11 @@
1764 tmFlags |= TIMELINE_DISJOINT;
1765 }else if( zBrName ){
1766 blob_appendf(&desc, " related to \"%h\"", zBrName);
1767 tmFlags |= TIMELINE_DISJOINT;
1768 }
1769 addFileGlobDescription(zChng, &desc);
1770 if( rAfter>0.0 ){
1771 if( rBefore>0.0 ){
1772 blob_appendf(&desc, " occurring between %h and %h.<br />",
1773 zAfter, zBefore);
1774 }else{
1775

Keyboard Shortcuts

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