Fossil SCM

Add the new "ms=brlist" version of the "ms" query parameter on /timeline. Use it with the multi-branch selector on the /brlist page.

drh 2021-04-28 17:08 trunk
Commit 2e9520a2b7cddc67e0dd49cece448e01fd480d80781bb8f71298dceaf67998d4
--- src/fossil.page.brlist.js
+++ src/fossil.page.brlist.js
@@ -12,20 +12,20 @@
1212
*/
1313
window.addEventListener( 'load', function() {
1414
1515
var anchor = document.querySelector("div.submenu > a:first-of-type" );
1616
if( !anchor || anchor.innerText != "Timeline" ) return;
17
-var prefix = anchor.href.toString() + "?ms=regexp&rel&t=";
17
+var prefix = anchor.href.toString() + "?ms=brlist&t=";
1818
anchor.classList.add('timeline-link');
1919
2020
var amendAnchor = function( selected ){
2121
if( selected.length == 0 ){
2222
anchor.classList.remove('selected');
2323
anchor.href = prefix;
2424
return;
2525
}
26
- re = selected.join("|");
26
+ re = selected.join(",");
2727
try{re = encodeURIComponent(re);}
2828
catch{console.log("encodeURIComponent() failed for ",re);}
2929
anchor.href = prefix + re;
3030
anchor.innerHTML = "View " + selected.length +
3131
( selected.length > 1 ? " branches" : " branch" );
@@ -38,11 +38,11 @@
3838
var tr = cbx.parentElement.parentElement;
3939
var tag = cbx.parentElement.children[0].innerText;
4040
var re = anchor.href.substr(prefix.length);
4141
try{re = decodeURIComponent(re);}
4242
catch{console.log("decodeURIComponent() failed for ",re);}
43
- var selected = ( re != "" ? re.split("|") : [] );
43
+ var selected = ( re != "" ? re.split(",") : [] );
4444
if( cbx.checked ){
4545
selected.push(tag);
4646
tr.classList.add('selected');
4747
}
4848
else {
4949
--- src/fossil.page.brlist.js
+++ src/fossil.page.brlist.js
@@ -12,20 +12,20 @@
12 */
13 window.addEventListener( 'load', function() {
14
15 var anchor = document.querySelector("div.submenu > a:first-of-type" );
16 if( !anchor || anchor.innerText != "Timeline" ) return;
17 var prefix = anchor.href.toString() + "?ms=regexp&rel&t=";
18 anchor.classList.add('timeline-link');
19
20 var amendAnchor = function( selected ){
21 if( selected.length == 0 ){
22 anchor.classList.remove('selected');
23 anchor.href = prefix;
24 return;
25 }
26 re = selected.join("|");
27 try{re = encodeURIComponent(re);}
28 catch{console.log("encodeURIComponent() failed for ",re);}
29 anchor.href = prefix + re;
30 anchor.innerHTML = "View " + selected.length +
31 ( selected.length > 1 ? " branches" : " branch" );
@@ -38,11 +38,11 @@
38 var tr = cbx.parentElement.parentElement;
39 var tag = cbx.parentElement.children[0].innerText;
40 var re = anchor.href.substr(prefix.length);
41 try{re = decodeURIComponent(re);}
42 catch{console.log("decodeURIComponent() failed for ",re);}
43 var selected = ( re != "" ? re.split("|") : [] );
44 if( cbx.checked ){
45 selected.push(tag);
46 tr.classList.add('selected');
47 }
48 else {
49
--- src/fossil.page.brlist.js
+++ src/fossil.page.brlist.js
@@ -12,20 +12,20 @@
12 */
13 window.addEventListener( 'load', function() {
14
15 var anchor = document.querySelector("div.submenu > a:first-of-type" );
16 if( !anchor || anchor.innerText != "Timeline" ) return;
17 var prefix = anchor.href.toString() + "?ms=brlist&t=";
18 anchor.classList.add('timeline-link');
19
20 var amendAnchor = function( selected ){
21 if( selected.length == 0 ){
22 anchor.classList.remove('selected');
23 anchor.href = prefix;
24 return;
25 }
26 re = selected.join(",");
27 try{re = encodeURIComponent(re);}
28 catch{console.log("encodeURIComponent() failed for ",re);}
29 anchor.href = prefix + re;
30 anchor.innerHTML = "View " + selected.length +
31 ( selected.length > 1 ? " branches" : " branch" );
@@ -38,11 +38,11 @@
38 var tr = cbx.parentElement.parentElement;
39 var tag = cbx.parentElement.children[0].innerText;
40 var re = anchor.href.substr(prefix.length);
41 try{re = decodeURIComponent(re);}
42 catch{console.log("decodeURIComponent() failed for ",re);}
43 var selected = ( re != "" ? re.split(",") : [] );
44 if( cbx.checked ){
45 selected.push(tag);
46 tr.classList.add('selected');
47 }
48 else {
49
+16 -3
--- src/timeline.c
+++ src/timeline.c
@@ -1275,11 +1275,13 @@
12751275
*/
12761276
typedef enum {
12771277
MS_EXACT, /* Matches a single tag by exact string comparison. */
12781278
MS_GLOB, /* Matches tags against a list of GLOB patterns. */
12791279
MS_LIKE, /* Matches tags against a list of LIKE patterns. */
1280
- MS_REGEXP /* Matches tags against a list of regular expressions. */
1280
+ MS_REGEXP, /* Matches tags against a list of regular expressions. */
1281
+ MS_BRLIST, /* Same as REGEXP, except the regular expression is a list
1282
+ ** of branch names */
12811283
} MatchStyle;
12821284
12831285
/*
12841286
** Quote a tag string by surrounding it with double quotes and preceding
12851287
** internal double quotes and backslashes with backslashes.
@@ -1310,11 +1312,13 @@
13101312
13111313
/*
13121314
** Construct the tag match SQL expression.
13131315
**
13141316
** This function is adapted from glob_expr() to support the MS_EXACT, MS_GLOB,
1315
-** MS_LIKE, and MS_REGEXP match styles. For MS_EXACT, the returned expression
1317
+** MS_LIKE, MS_REGEXP, and MS_BRLIST match styles.
1318
+**
1319
+** For MS_EXACT, the returned expression
13161320
** checks for integer match against the tag ID which is looked up directly by
13171321
** this function. For the other modes, the returned SQL expression performs
13181322
** string comparisons against the tag names, so it is necessary to join against
13191323
** the tag table to access the "tagname" column.
13201324
**
@@ -1372,17 +1376,24 @@
13721376
zDelimiter = " OR ";
13731377
zEnd = ")";
13741378
zPrefix = "tagname LIKE 'sym-";
13751379
zSuffix = "'";
13761380
zIntro = "SQL LIKE pattern ";
1377
- }else/* if( matchStyle==MS_REGEXP )*/{
1381
+ }else if( matchStyle==MS_REGEXP ){
13781382
zStart = "(tagname REGEXP '^sym-(";
13791383
zDelimiter = "|";
13801384
zEnd = ")$')";
13811385
zPrefix = "";
13821386
zSuffix = "";
13831387
zIntro = "regular expression ";
1388
+ }else/* if( matchStyle==MS_BRLIST )*/{
1389
+ zStart = "tagname IN ('sym-";
1390
+ zDelimiter = "','sym-";
1391
+ zEnd = "')";
1392
+ zPrefix = "";
1393
+ zSuffix = "";
1394
+ zIntro = "any of ";
13841395
}
13851396
13861397
/* Convert the list of matches into an SQL expression and text description. */
13871398
blob_zero(&expr);
13881399
blob_zero(&desc);
@@ -1792,10 +1803,12 @@
17921803
matchStyle = MS_GLOB;
17931804
}else if( fossil_stricmp(zMatchStyle, "like")==0 ){
17941805
matchStyle = MS_LIKE;
17951806
}else if( fossil_stricmp(zMatchStyle, "regexp")==0 ){
17961807
matchStyle = MS_REGEXP;
1808
+ }else if( fossil_stricmp(zMatchStyle, "brlist")==0 ){
1809
+ matchStyle = MS_BRLIST;
17971810
}else{
17981811
/* For exact maching, inhibit links to the selected tag. */
17991812
zThisTag = zTagName;
18001813
Th_Store("current_checkin", zTagName);
18011814
}
18021815
--- src/timeline.c
+++ src/timeline.c
@@ -1275,11 +1275,13 @@
1275 */
1276 typedef enum {
1277 MS_EXACT, /* Matches a single tag by exact string comparison. */
1278 MS_GLOB, /* Matches tags against a list of GLOB patterns. */
1279 MS_LIKE, /* Matches tags against a list of LIKE patterns. */
1280 MS_REGEXP /* Matches tags against a list of regular expressions. */
 
 
1281 } MatchStyle;
1282
1283 /*
1284 ** Quote a tag string by surrounding it with double quotes and preceding
1285 ** internal double quotes and backslashes with backslashes.
@@ -1310,11 +1312,13 @@
1310
1311 /*
1312 ** Construct the tag match SQL expression.
1313 **
1314 ** This function is adapted from glob_expr() to support the MS_EXACT, MS_GLOB,
1315 ** MS_LIKE, and MS_REGEXP match styles. For MS_EXACT, the returned expression
 
 
1316 ** checks for integer match against the tag ID which is looked up directly by
1317 ** this function. For the other modes, the returned SQL expression performs
1318 ** string comparisons against the tag names, so it is necessary to join against
1319 ** the tag table to access the "tagname" column.
1320 **
@@ -1372,17 +1376,24 @@
1372 zDelimiter = " OR ";
1373 zEnd = ")";
1374 zPrefix = "tagname LIKE 'sym-";
1375 zSuffix = "'";
1376 zIntro = "SQL LIKE pattern ";
1377 }else/* if( matchStyle==MS_REGEXP )*/{
1378 zStart = "(tagname REGEXP '^sym-(";
1379 zDelimiter = "|";
1380 zEnd = ")$')";
1381 zPrefix = "";
1382 zSuffix = "";
1383 zIntro = "regular expression ";
 
 
 
 
 
 
 
1384 }
1385
1386 /* Convert the list of matches into an SQL expression and text description. */
1387 blob_zero(&expr);
1388 blob_zero(&desc);
@@ -1792,10 +1803,12 @@
1792 matchStyle = MS_GLOB;
1793 }else if( fossil_stricmp(zMatchStyle, "like")==0 ){
1794 matchStyle = MS_LIKE;
1795 }else if( fossil_stricmp(zMatchStyle, "regexp")==0 ){
1796 matchStyle = MS_REGEXP;
 
 
1797 }else{
1798 /* For exact maching, inhibit links to the selected tag. */
1799 zThisTag = zTagName;
1800 Th_Store("current_checkin", zTagName);
1801 }
1802
--- src/timeline.c
+++ src/timeline.c
@@ -1275,11 +1275,13 @@
1275 */
1276 typedef enum {
1277 MS_EXACT, /* Matches a single tag by exact string comparison. */
1278 MS_GLOB, /* Matches tags against a list of GLOB patterns. */
1279 MS_LIKE, /* Matches tags against a list of LIKE patterns. */
1280 MS_REGEXP, /* Matches tags against a list of regular expressions. */
1281 MS_BRLIST, /* Same as REGEXP, except the regular expression is a list
1282 ** of branch names */
1283 } MatchStyle;
1284
1285 /*
1286 ** Quote a tag string by surrounding it with double quotes and preceding
1287 ** internal double quotes and backslashes with backslashes.
@@ -1310,11 +1312,13 @@
1312
1313 /*
1314 ** Construct the tag match SQL expression.
1315 **
1316 ** This function is adapted from glob_expr() to support the MS_EXACT, MS_GLOB,
1317 ** MS_LIKE, MS_REGEXP, and MS_BRLIST match styles.
1318 **
1319 ** For MS_EXACT, the returned expression
1320 ** checks for integer match against the tag ID which is looked up directly by
1321 ** this function. For the other modes, the returned SQL expression performs
1322 ** string comparisons against the tag names, so it is necessary to join against
1323 ** the tag table to access the "tagname" column.
1324 **
@@ -1372,17 +1376,24 @@
1376 zDelimiter = " OR ";
1377 zEnd = ")";
1378 zPrefix = "tagname LIKE 'sym-";
1379 zSuffix = "'";
1380 zIntro = "SQL LIKE pattern ";
1381 }else if( matchStyle==MS_REGEXP ){
1382 zStart = "(tagname REGEXP '^sym-(";
1383 zDelimiter = "|";
1384 zEnd = ")$')";
1385 zPrefix = "";
1386 zSuffix = "";
1387 zIntro = "regular expression ";
1388 }else/* if( matchStyle==MS_BRLIST )*/{
1389 zStart = "tagname IN ('sym-";
1390 zDelimiter = "','sym-";
1391 zEnd = "')";
1392 zPrefix = "";
1393 zSuffix = "";
1394 zIntro = "any of ";
1395 }
1396
1397 /* Convert the list of matches into an SQL expression and text description. */
1398 blob_zero(&expr);
1399 blob_zero(&desc);
@@ -1792,10 +1803,12 @@
1803 matchStyle = MS_GLOB;
1804 }else if( fossil_stricmp(zMatchStyle, "like")==0 ){
1805 matchStyle = MS_LIKE;
1806 }else if( fossil_stricmp(zMatchStyle, "regexp")==0 ){
1807 matchStyle = MS_REGEXP;
1808 }else if( fossil_stricmp(zMatchStyle, "brlist")==0 ){
1809 matchStyle = MS_BRLIST;
1810 }else{
1811 /* For exact maching, inhibit links to the selected tag. */
1812 zThisTag = zTagName;
1813 Th_Store("current_checkin", zTagName);
1814 }
1815

Keyboard Shortcuts

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