Fossil SCM

Timeline enhancements: (1) Add the "nc" query parameter which means to omit all graph colorations other than highlights from "m" or "m2". (2) Add the "m2=" query parameter for secondary highlight. (3) Undocumented sel1= and sel2= query parameters remain undocumented but are now aliases for the documented "m=" and "m2=" query parameters.

drh 2021-07-12 13:26 trunk
Commit a3392298c341e5120dd25a76711a3bcde41dd974cb357f7982efadab912ad7c0
2 files changed +19 +13 -4
+19
--- src/cgi.c
+++ src/cgi.c
@@ -1321,10 +1321,29 @@
13211321
}
13221322
}
13231323
CGIDEBUG(("no-match [%s]\n", zName));
13241324
return zDefault;
13251325
}
1326
+
1327
+/*
1328
+** Return the value of the first defined query parameter or cookie whose
1329
+** name appears in the list of arguments. Or if no parameter is found,
1330
+** return NULL.
1331
+*/
1332
+const char *cgi_coalesce(const char *zName, ...){
1333
+ va_list ap;
1334
+ const char *z;
1335
+ const char *zX;
1336
+ if( zName==0 ) return 0;
1337
+ z = cgi_parameter(zName, 0);
1338
+ va_start(ap, zName);
1339
+ while( z==0 && (zX = va_arg(ap,const char*))!=0 ){
1340
+ z = cgi_parameter(zX, 0);
1341
+ }
1342
+ va_end(ap);
1343
+ return z;
1344
+}
13261345
13271346
/*
13281347
** Return the value of a CGI parameter with leading and trailing
13291348
** spaces removed and with internal \r\n changed to just \n
13301349
*/
13311350
--- src/cgi.c
+++ src/cgi.c
@@ -1321,10 +1321,29 @@
1321 }
1322 }
1323 CGIDEBUG(("no-match [%s]\n", zName));
1324 return zDefault;
1325 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1326
1327 /*
1328 ** Return the value of a CGI parameter with leading and trailing
1329 ** spaces removed and with internal \r\n changed to just \n
1330 */
1331
--- src/cgi.c
+++ src/cgi.c
@@ -1321,10 +1321,29 @@
1321 }
1322 }
1323 CGIDEBUG(("no-match [%s]\n", zName));
1324 return zDefault;
1325 }
1326
1327 /*
1328 ** Return the value of the first defined query parameter or cookie whose
1329 ** name appears in the list of arguments. Or if no parameter is found,
1330 ** return NULL.
1331 */
1332 const char *cgi_coalesce(const char *zName, ...){
1333 va_list ap;
1334 const char *z;
1335 const char *zX;
1336 if( zName==0 ) return 0;
1337 z = cgi_parameter(zName, 0);
1338 va_start(ap, zName);
1339 while( z==0 && (zX = va_arg(ap,const char*))!=0 ){
1340 z = cgi_parameter(zX, 0);
1341 }
1342 va_end(ap);
1343 return z;
1344 }
1345
1346 /*
1347 ** Return the value of a CGI parameter with leading and trailing
1348 ** spaces removed and with internal \r\n changed to just \n
1349 */
1350
+13 -4
--- src/timeline.c
+++ src/timeline.c
@@ -118,10 +118,11 @@
118118
#define TIMELINE_XMERGE 0x1000000 /* Omit merges from off-graph nodes */
119119
#define TIMELINE_NOTKT 0x2000000 /* Omit extra ticket classes */
120120
#define TIMELINE_FORUMTXT 0x4000000 /* Render all forum messages */
121121
#define TIMELINE_REFS 0x8000000 /* Output intended for References tab */
122122
#define TIMELINE_DELTA 0x10000000 /* Background color shows delta manifests */
123
+#define TIMELINE_NOCOLOR 0x20000000 /* No colors except for highlights */
123124
#endif
124125
125126
/*
126127
** Return a new timelineTable id.
127128
*/
@@ -363,13 +364,15 @@
363364
}else{
364365
zDateLink = mprintf("<a>");
365366
}
366367
@ <td class="timelineTime">%z(zDateLink)%s(zTime)</a></td>
367368
@ <td class="timelineGraph">
368
- if( tmFlags & (TIMELINE_UCOLOR|TIMELINE_DELTA) ){
369
+ if( tmFlags & (TIMELINE_UCOLOR|TIMELINE_DELTA|TIMELINE_NOCOLOR) ){
369370
if( tmFlags & TIMELINE_UCOLOR ){
370371
zBgClr = zUser ? user_color(zUser) : 0;
372
+ }else if( tmFlags & TIMELINE_NOCOLOR ){
373
+ zBgClr = 0;
371374
}else if( zType[0]=='c' ){
372375
static Stmt qdelta;
373376
db_static_prepare(&qdelta, "SELECT baseid IS NULL FROM plink"
374377
" WHERE cid=:rid");
375378
db_bind_int(&qdelta, ":rid", rid);
@@ -392,11 +395,11 @@
392395
zBr = db_column_text(&qbranch, 0);
393396
}else{
394397
zBr = "trunk";
395398
}
396399
if( zBgClr==0 || (tmFlags & TIMELINE_BRCOLOR)!=0 ){
397
- if( tmFlags & TIMELINE_DELTA ){
400
+ if( tmFlags & (TIMELINE_DELTA|TIMELINE_NOCOLOR) ){
398401
}else if( zBr==0 || strcmp(zBr,"trunk")==0 ){
399402
zBgClr = 0;
400403
}else{
401404
zBgClr = hash_color(zBr);
402405
}
@@ -1545,10 +1548,11 @@
15451548
** b=TIMEORTAG Show events before TIMEORTAG
15461549
** c=TIMEORTAG Show events that happen "circa" TIMEORTAG
15471550
** cf=FILEHASH Show events around the time of the first use of
15481551
** the file with FILEHASH
15491552
** m=TIMEORTAG Highlight the event at TIMEORTAG
1553
+** m2=TIMEORTAG Secondary highlight
15501554
** n=COUNT Maximum number of events. "all" for no limit
15511555
** n1=COUNT Same as "n" but doesn't set the display-preference cookie
15521556
** Use "n1=COUNT" for a one-time display change
15531557
** p=CHECKIN Parents and ancestors of CHECKIN
15541558
** bt=PRIOR ... going back to PRIOR
@@ -1572,10 +1576,11 @@
15721576
** advm Use the "Advanced" or "Busy" menu design.
15731577
** ng No Graph.
15741578
** ncp Omit cherrypick merges
15751579
** nd Do not highlight the focus check-in
15761580
** nsm Omit the submenu
1581
+** nc Omit all graph colors other than highlights
15771582
** v Show details of files changed
15781583
** vfx Show complete text of forum messages
15791584
** f=CHECKIN Show family (immediate parents and children) of CHECKIN
15801585
** from=CHECKIN Path from...
15811586
** to=CHECKIN ... to this
@@ -1728,12 +1733,12 @@
17281733
}
17291734
17301735
/* Undocumented query parameter to set JS mode */
17311736
builtin_set_js_delivery_mode(P("jsmode"),1);
17321737
1733
- secondaryRid = name_to_typed_rid(P("sel2"),"ci");
1734
- selectedRid = name_to_typed_rid(P("sel1"),"ci");
1738
+ secondaryRid = name_to_typed_rid(cgi_coalesce("sel2","m2",NULL),"ci");
1739
+ selectedRid = name_to_typed_rid(cgi_coalesce("m","sel1",NULL),"ci");
17351740
tmFlags |= timeline_ss_submenu();
17361741
cookie_link_parameter("advm","advm","0");
17371742
advancedMenu = atoi(PD("advm","0"));
17381743
17391744
/* Omit all cherry-pick merge lines if the "ncp" query parameter is
@@ -1861,10 +1866,14 @@
18611866
tmFlags |= TIMELINE_UCOLOR;
18621867
}
18631868
if( PB("deltabg") ){
18641869
tmFlags |= TIMELINE_DELTA;
18651870
}
1871
+ if( PB("nc") ){
1872
+ tmFlags &= ~(TIMELINE_DELTA|TIMELINE_BRCOLOR|TIMELINE_UCOLOR);
1873
+ tmFlags |= TIMELINE_NOCOLOR;
1874
+ }
18661875
if( zUses!=0 ){
18671876
int ufid = db_int(0, "SELECT rid FROM blob WHERE uuid GLOB '%q*'", zUses);
18681877
if( ufid ){
18691878
zUses = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", ufid);
18701879
db_multi_exec("CREATE TEMP TABLE usesfile(rid INTEGER PRIMARY KEY)");
18711880
--- src/timeline.c
+++ src/timeline.c
@@ -118,10 +118,11 @@
118 #define TIMELINE_XMERGE 0x1000000 /* Omit merges from off-graph nodes */
119 #define TIMELINE_NOTKT 0x2000000 /* Omit extra ticket classes */
120 #define TIMELINE_FORUMTXT 0x4000000 /* Render all forum messages */
121 #define TIMELINE_REFS 0x8000000 /* Output intended for References tab */
122 #define TIMELINE_DELTA 0x10000000 /* Background color shows delta manifests */
 
123 #endif
124
125 /*
126 ** Return a new timelineTable id.
127 */
@@ -363,13 +364,15 @@
363 }else{
364 zDateLink = mprintf("<a>");
365 }
366 @ <td class="timelineTime">%z(zDateLink)%s(zTime)</a></td>
367 @ <td class="timelineGraph">
368 if( tmFlags & (TIMELINE_UCOLOR|TIMELINE_DELTA) ){
369 if( tmFlags & TIMELINE_UCOLOR ){
370 zBgClr = zUser ? user_color(zUser) : 0;
 
 
371 }else if( zType[0]=='c' ){
372 static Stmt qdelta;
373 db_static_prepare(&qdelta, "SELECT baseid IS NULL FROM plink"
374 " WHERE cid=:rid");
375 db_bind_int(&qdelta, ":rid", rid);
@@ -392,11 +395,11 @@
392 zBr = db_column_text(&qbranch, 0);
393 }else{
394 zBr = "trunk";
395 }
396 if( zBgClr==0 || (tmFlags & TIMELINE_BRCOLOR)!=0 ){
397 if( tmFlags & TIMELINE_DELTA ){
398 }else if( zBr==0 || strcmp(zBr,"trunk")==0 ){
399 zBgClr = 0;
400 }else{
401 zBgClr = hash_color(zBr);
402 }
@@ -1545,10 +1548,11 @@
1545 ** b=TIMEORTAG Show events before TIMEORTAG
1546 ** c=TIMEORTAG Show events that happen "circa" TIMEORTAG
1547 ** cf=FILEHASH Show events around the time of the first use of
1548 ** the file with FILEHASH
1549 ** m=TIMEORTAG Highlight the event at TIMEORTAG
 
1550 ** n=COUNT Maximum number of events. "all" for no limit
1551 ** n1=COUNT Same as "n" but doesn't set the display-preference cookie
1552 ** Use "n1=COUNT" for a one-time display change
1553 ** p=CHECKIN Parents and ancestors of CHECKIN
1554 ** bt=PRIOR ... going back to PRIOR
@@ -1572,10 +1576,11 @@
1572 ** advm Use the "Advanced" or "Busy" menu design.
1573 ** ng No Graph.
1574 ** ncp Omit cherrypick merges
1575 ** nd Do not highlight the focus check-in
1576 ** nsm Omit the submenu
 
1577 ** v Show details of files changed
1578 ** vfx Show complete text of forum messages
1579 ** f=CHECKIN Show family (immediate parents and children) of CHECKIN
1580 ** from=CHECKIN Path from...
1581 ** to=CHECKIN ... to this
@@ -1728,12 +1733,12 @@
1728 }
1729
1730 /* Undocumented query parameter to set JS mode */
1731 builtin_set_js_delivery_mode(P("jsmode"),1);
1732
1733 secondaryRid = name_to_typed_rid(P("sel2"),"ci");
1734 selectedRid = name_to_typed_rid(P("sel1"),"ci");
1735 tmFlags |= timeline_ss_submenu();
1736 cookie_link_parameter("advm","advm","0");
1737 advancedMenu = atoi(PD("advm","0"));
1738
1739 /* Omit all cherry-pick merge lines if the "ncp" query parameter is
@@ -1861,10 +1866,14 @@
1861 tmFlags |= TIMELINE_UCOLOR;
1862 }
1863 if( PB("deltabg") ){
1864 tmFlags |= TIMELINE_DELTA;
1865 }
 
 
 
 
1866 if( zUses!=0 ){
1867 int ufid = db_int(0, "SELECT rid FROM blob WHERE uuid GLOB '%q*'", zUses);
1868 if( ufid ){
1869 zUses = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", ufid);
1870 db_multi_exec("CREATE TEMP TABLE usesfile(rid INTEGER PRIMARY KEY)");
1871
--- src/timeline.c
+++ src/timeline.c
@@ -118,10 +118,11 @@
118 #define TIMELINE_XMERGE 0x1000000 /* Omit merges from off-graph nodes */
119 #define TIMELINE_NOTKT 0x2000000 /* Omit extra ticket classes */
120 #define TIMELINE_FORUMTXT 0x4000000 /* Render all forum messages */
121 #define TIMELINE_REFS 0x8000000 /* Output intended for References tab */
122 #define TIMELINE_DELTA 0x10000000 /* Background color shows delta manifests */
123 #define TIMELINE_NOCOLOR 0x20000000 /* No colors except for highlights */
124 #endif
125
126 /*
127 ** Return a new timelineTable id.
128 */
@@ -363,13 +364,15 @@
364 }else{
365 zDateLink = mprintf("<a>");
366 }
367 @ <td class="timelineTime">%z(zDateLink)%s(zTime)</a></td>
368 @ <td class="timelineGraph">
369 if( tmFlags & (TIMELINE_UCOLOR|TIMELINE_DELTA|TIMELINE_NOCOLOR) ){
370 if( tmFlags & TIMELINE_UCOLOR ){
371 zBgClr = zUser ? user_color(zUser) : 0;
372 }else if( tmFlags & TIMELINE_NOCOLOR ){
373 zBgClr = 0;
374 }else if( zType[0]=='c' ){
375 static Stmt qdelta;
376 db_static_prepare(&qdelta, "SELECT baseid IS NULL FROM plink"
377 " WHERE cid=:rid");
378 db_bind_int(&qdelta, ":rid", rid);
@@ -392,11 +395,11 @@
395 zBr = db_column_text(&qbranch, 0);
396 }else{
397 zBr = "trunk";
398 }
399 if( zBgClr==0 || (tmFlags & TIMELINE_BRCOLOR)!=0 ){
400 if( tmFlags & (TIMELINE_DELTA|TIMELINE_NOCOLOR) ){
401 }else if( zBr==0 || strcmp(zBr,"trunk")==0 ){
402 zBgClr = 0;
403 }else{
404 zBgClr = hash_color(zBr);
405 }
@@ -1545,10 +1548,11 @@
1548 ** b=TIMEORTAG Show events before TIMEORTAG
1549 ** c=TIMEORTAG Show events that happen "circa" TIMEORTAG
1550 ** cf=FILEHASH Show events around the time of the first use of
1551 ** the file with FILEHASH
1552 ** m=TIMEORTAG Highlight the event at TIMEORTAG
1553 ** m2=TIMEORTAG Secondary highlight
1554 ** n=COUNT Maximum number of events. "all" for no limit
1555 ** n1=COUNT Same as "n" but doesn't set the display-preference cookie
1556 ** Use "n1=COUNT" for a one-time display change
1557 ** p=CHECKIN Parents and ancestors of CHECKIN
1558 ** bt=PRIOR ... going back to PRIOR
@@ -1572,10 +1576,11 @@
1576 ** advm Use the "Advanced" or "Busy" menu design.
1577 ** ng No Graph.
1578 ** ncp Omit cherrypick merges
1579 ** nd Do not highlight the focus check-in
1580 ** nsm Omit the submenu
1581 ** nc Omit all graph colors other than highlights
1582 ** v Show details of files changed
1583 ** vfx Show complete text of forum messages
1584 ** f=CHECKIN Show family (immediate parents and children) of CHECKIN
1585 ** from=CHECKIN Path from...
1586 ** to=CHECKIN ... to this
@@ -1728,12 +1733,12 @@
1733 }
1734
1735 /* Undocumented query parameter to set JS mode */
1736 builtin_set_js_delivery_mode(P("jsmode"),1);
1737
1738 secondaryRid = name_to_typed_rid(cgi_coalesce("sel2","m2",NULL),"ci");
1739 selectedRid = name_to_typed_rid(cgi_coalesce("m","sel1",NULL),"ci");
1740 tmFlags |= timeline_ss_submenu();
1741 cookie_link_parameter("advm","advm","0");
1742 advancedMenu = atoi(PD("advm","0"));
1743
1744 /* Omit all cherry-pick merge lines if the "ncp" query parameter is
@@ -1861,10 +1866,14 @@
1866 tmFlags |= TIMELINE_UCOLOR;
1867 }
1868 if( PB("deltabg") ){
1869 tmFlags |= TIMELINE_DELTA;
1870 }
1871 if( PB("nc") ){
1872 tmFlags &= ~(TIMELINE_DELTA|TIMELINE_BRCOLOR|TIMELINE_UCOLOR);
1873 tmFlags |= TIMELINE_NOCOLOR;
1874 }
1875 if( zUses!=0 ){
1876 int ufid = db_int(0, "SELECT rid FROM blob WHERE uuid GLOB '%q*'", zUses);
1877 if( ufid ){
1878 zUses = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", ufid);
1879 db_multi_exec("CREATE TEMP TABLE usesfile(rid INTEGER PRIMARY KEY)");
1880

Keyboard Shortcuts

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