Fossil SCM

Enhance 'brlist' page to make use of branch colors.

mistachkin 2016-10-26 21:21 trunk merge
Commit 796c9abacd626d0cb6c7d5c22a643299fefe4409
+17 -2
--- src/branch.c
+++ src/branch.c
@@ -323,11 +323,12 @@
323323
@ WHERE plink.pid=event.objid
324324
@ AND tagxref.rid=plink.cid
325325
@ AND tagxref.tagid=(SELECT tagid FROM tag WHERE tagname='branch')
326326
@ AND tagtype>0),
327327
@ count(*),
328
-@ (SELECT uuid FROM blob WHERE rid=tagxref.rid)
328
+@ (SELECT uuid FROM blob WHERE rid=tagxref.rid),
329
+@ event.bgcolor
329330
@ FROM tagxref, tag, event
330331
@ WHERE tagxref.tagid=tag.tagid
331332
@ AND tagxref.tagtype>0
332333
@ AND tag.tagname='branch'
333334
@ AND event.objid=tagxref.rid
@@ -344,14 +345,16 @@
344345
** if there are no query parameters.
345346
*/
346347
static void new_brlist_page(void){
347348
Stmt q;
348349
double rNow;
350
+ int show_colors = PB("colors");
349351
login_check_credentials();
350352
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
351353
style_header("Branches");
352354
style_adunit_config(ADUNIT_RIGHT_OK);
355
+ style_submenu_binary("colors", "Show branch colors", "No branch colors", 0);
353356
login_anonymous_available();
354357
355358
db_prepare(&q, brlistQuery/*works-like:""*/);
356359
rNow = db_double(0.0, "SELECT julianday('now')");
357360
@ <div class="brlist"><table id="branchlisttable">
@@ -367,14 +370,26 @@
367370
double rMtime = db_column_double(&q, 1);
368371
int isClosed = db_column_int(&q, 2);
369372
const char *zMergeTo = db_column_text(&q, 3);
370373
int nCkin = db_column_int(&q, 4);
371374
const char *zLastCkin = db_column_text(&q, 5);
375
+ const char *zBgClr = db_column_text(&q, 6);
372376
char *zAge = human_readable_age(rNow - rMtime);
373377
sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0);
374378
if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0;
375
- @ <tr>
379
+ if( zBgClr == 0 ){
380
+ if( zBranch==0 || strcmp(zBranch,"trunk")==0 ){
381
+ zBgClr = 0;
382
+ }else{
383
+ zBgClr = hash_color(zBranch);
384
+ }
385
+ }
386
+ if( zBgClr && zBgClr[0] && show_colors ){
387
+ @ <tr style="background-color:%s(zBgClr)">
388
+ }else{
389
+ @ <tr>
390
+ }
376391
@ <td>%z(href("%R/timeline?n=100&r=%T",zBranch))%h(zBranch)</a></td>
377392
@ <td data-sortkey="%016llx(-iMtime)">%s(zAge)</td>
378393
@ <td>%d(nCkin)</td>
379394
fossil_free(zAge);
380395
@ <td>%s(isClosed?"closed":"")</td>
381396
--- src/branch.c
+++ src/branch.c
@@ -323,11 +323,12 @@
323 @ WHERE plink.pid=event.objid
324 @ AND tagxref.rid=plink.cid
325 @ AND tagxref.tagid=(SELECT tagid FROM tag WHERE tagname='branch')
326 @ AND tagtype>0),
327 @ count(*),
328 @ (SELECT uuid FROM blob WHERE rid=tagxref.rid)
 
329 @ FROM tagxref, tag, event
330 @ WHERE tagxref.tagid=tag.tagid
331 @ AND tagxref.tagtype>0
332 @ AND tag.tagname='branch'
333 @ AND event.objid=tagxref.rid
@@ -344,14 +345,16 @@
344 ** if there are no query parameters.
345 */
346 static void new_brlist_page(void){
347 Stmt q;
348 double rNow;
 
349 login_check_credentials();
350 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
351 style_header("Branches");
352 style_adunit_config(ADUNIT_RIGHT_OK);
 
353 login_anonymous_available();
354
355 db_prepare(&q, brlistQuery/*works-like:""*/);
356 rNow = db_double(0.0, "SELECT julianday('now')");
357 @ <div class="brlist"><table id="branchlisttable">
@@ -367,14 +370,26 @@
367 double rMtime = db_column_double(&q, 1);
368 int isClosed = db_column_int(&q, 2);
369 const char *zMergeTo = db_column_text(&q, 3);
370 int nCkin = db_column_int(&q, 4);
371 const char *zLastCkin = db_column_text(&q, 5);
 
372 char *zAge = human_readable_age(rNow - rMtime);
373 sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0);
374 if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0;
375 @ <tr>
 
 
 
 
 
 
 
 
 
 
 
376 @ <td>%z(href("%R/timeline?n=100&r=%T",zBranch))%h(zBranch)</a></td>
377 @ <td data-sortkey="%016llx(-iMtime)">%s(zAge)</td>
378 @ <td>%d(nCkin)</td>
379 fossil_free(zAge);
380 @ <td>%s(isClosed?"closed":"")</td>
381
--- src/branch.c
+++ src/branch.c
@@ -323,11 +323,12 @@
323 @ WHERE plink.pid=event.objid
324 @ AND tagxref.rid=plink.cid
325 @ AND tagxref.tagid=(SELECT tagid FROM tag WHERE tagname='branch')
326 @ AND tagtype>0),
327 @ count(*),
328 @ (SELECT uuid FROM blob WHERE rid=tagxref.rid),
329 @ event.bgcolor
330 @ FROM tagxref, tag, event
331 @ WHERE tagxref.tagid=tag.tagid
332 @ AND tagxref.tagtype>0
333 @ AND tag.tagname='branch'
334 @ AND event.objid=tagxref.rid
@@ -344,14 +345,16 @@
345 ** if there are no query parameters.
346 */
347 static void new_brlist_page(void){
348 Stmt q;
349 double rNow;
350 int show_colors = PB("colors");
351 login_check_credentials();
352 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
353 style_header("Branches");
354 style_adunit_config(ADUNIT_RIGHT_OK);
355 style_submenu_binary("colors", "Show branch colors", "No branch colors", 0);
356 login_anonymous_available();
357
358 db_prepare(&q, brlistQuery/*works-like:""*/);
359 rNow = db_double(0.0, "SELECT julianday('now')");
360 @ <div class="brlist"><table id="branchlisttable">
@@ -367,14 +370,26 @@
370 double rMtime = db_column_double(&q, 1);
371 int isClosed = db_column_int(&q, 2);
372 const char *zMergeTo = db_column_text(&q, 3);
373 int nCkin = db_column_int(&q, 4);
374 const char *zLastCkin = db_column_text(&q, 5);
375 const char *zBgClr = db_column_text(&q, 6);
376 char *zAge = human_readable_age(rNow - rMtime);
377 sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0);
378 if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0;
379 if( zBgClr == 0 ){
380 if( zBranch==0 || strcmp(zBranch,"trunk")==0 ){
381 zBgClr = 0;
382 }else{
383 zBgClr = hash_color(zBranch);
384 }
385 }
386 if( zBgClr && zBgClr[0] && show_colors ){
387 @ <tr style="background-color:%s(zBgClr)">
388 }else{
389 @ <tr>
390 }
391 @ <td>%z(href("%R/timeline?n=100&r=%T",zBranch))%h(zBranch)</a></td>
392 @ <td data-sortkey="%016llx(-iMtime)">%s(zAge)</td>
393 @ <td>%d(nCkin)</td>
394 fossil_free(zAge);
395 @ <td>%s(isClosed?"closed":"")</td>
396
+17 -2
--- src/branch.c
+++ src/branch.c
@@ -323,11 +323,12 @@
323323
@ WHERE plink.pid=event.objid
324324
@ AND tagxref.rid=plink.cid
325325
@ AND tagxref.tagid=(SELECT tagid FROM tag WHERE tagname='branch')
326326
@ AND tagtype>0),
327327
@ count(*),
328
-@ (SELECT uuid FROM blob WHERE rid=tagxref.rid)
328
+@ (SELECT uuid FROM blob WHERE rid=tagxref.rid),
329
+@ event.bgcolor
329330
@ FROM tagxref, tag, event
330331
@ WHERE tagxref.tagid=tag.tagid
331332
@ AND tagxref.tagtype>0
332333
@ AND tag.tagname='branch'
333334
@ AND event.objid=tagxref.rid
@@ -344,14 +345,16 @@
344345
** if there are no query parameters.
345346
*/
346347
static void new_brlist_page(void){
347348
Stmt q;
348349
double rNow;
350
+ int show_colors = PB("colors");
349351
login_check_credentials();
350352
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
351353
style_header("Branches");
352354
style_adunit_config(ADUNIT_RIGHT_OK);
355
+ style_submenu_binary("colors", "Show branch colors", "No branch colors", 0);
353356
login_anonymous_available();
354357
355358
db_prepare(&q, brlistQuery/*works-like:""*/);
356359
rNow = db_double(0.0, "SELECT julianday('now')");
357360
@ <div class="brlist"><table id="branchlisttable">
@@ -367,14 +370,26 @@
367370
double rMtime = db_column_double(&q, 1);
368371
int isClosed = db_column_int(&q, 2);
369372
const char *zMergeTo = db_column_text(&q, 3);
370373
int nCkin = db_column_int(&q, 4);
371374
const char *zLastCkin = db_column_text(&q, 5);
375
+ const char *zBgClr = db_column_text(&q, 6);
372376
char *zAge = human_readable_age(rNow - rMtime);
373377
sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0);
374378
if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0;
375
- @ <tr>
379
+ if( zBgClr == 0 ){
380
+ if( zBranch==0 || strcmp(zBranch,"trunk")==0 ){
381
+ zBgClr = 0;
382
+ }else{
383
+ zBgClr = hash_color(zBranch);
384
+ }
385
+ }
386
+ if( zBgClr && zBgClr[0] && show_colors ){
387
+ @ <tr style="background-color:%s(zBgClr)">
388
+ }else{
389
+ @ <tr>
390
+ }
376391
@ <td>%z(href("%R/timeline?n=100&r=%T",zBranch))%h(zBranch)</a></td>
377392
@ <td data-sortkey="%016llx(-iMtime)">%s(zAge)</td>
378393
@ <td>%d(nCkin)</td>
379394
fossil_free(zAge);
380395
@ <td>%s(isClosed?"closed":"")</td>
381396
--- src/branch.c
+++ src/branch.c
@@ -323,11 +323,12 @@
323 @ WHERE plink.pid=event.objid
324 @ AND tagxref.rid=plink.cid
325 @ AND tagxref.tagid=(SELECT tagid FROM tag WHERE tagname='branch')
326 @ AND tagtype>0),
327 @ count(*),
328 @ (SELECT uuid FROM blob WHERE rid=tagxref.rid)
 
329 @ FROM tagxref, tag, event
330 @ WHERE tagxref.tagid=tag.tagid
331 @ AND tagxref.tagtype>0
332 @ AND tag.tagname='branch'
333 @ AND event.objid=tagxref.rid
@@ -344,14 +345,16 @@
344 ** if there are no query parameters.
345 */
346 static void new_brlist_page(void){
347 Stmt q;
348 double rNow;
 
349 login_check_credentials();
350 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
351 style_header("Branches");
352 style_adunit_config(ADUNIT_RIGHT_OK);
 
353 login_anonymous_available();
354
355 db_prepare(&q, brlistQuery/*works-like:""*/);
356 rNow = db_double(0.0, "SELECT julianday('now')");
357 @ <div class="brlist"><table id="branchlisttable">
@@ -367,14 +370,26 @@
367 double rMtime = db_column_double(&q, 1);
368 int isClosed = db_column_int(&q, 2);
369 const char *zMergeTo = db_column_text(&q, 3);
370 int nCkin = db_column_int(&q, 4);
371 const char *zLastCkin = db_column_text(&q, 5);
 
372 char *zAge = human_readable_age(rNow - rMtime);
373 sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0);
374 if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0;
375 @ <tr>
 
 
 
 
 
 
 
 
 
 
 
376 @ <td>%z(href("%R/timeline?n=100&r=%T",zBranch))%h(zBranch)</a></td>
377 @ <td data-sortkey="%016llx(-iMtime)">%s(zAge)</td>
378 @ <td>%d(nCkin)</td>
379 fossil_free(zAge);
380 @ <td>%s(isClosed?"closed":"")</td>
381
--- src/branch.c
+++ src/branch.c
@@ -323,11 +323,12 @@
323 @ WHERE plink.pid=event.objid
324 @ AND tagxref.rid=plink.cid
325 @ AND tagxref.tagid=(SELECT tagid FROM tag WHERE tagname='branch')
326 @ AND tagtype>0),
327 @ count(*),
328 @ (SELECT uuid FROM blob WHERE rid=tagxref.rid),
329 @ event.bgcolor
330 @ FROM tagxref, tag, event
331 @ WHERE tagxref.tagid=tag.tagid
332 @ AND tagxref.tagtype>0
333 @ AND tag.tagname='branch'
334 @ AND event.objid=tagxref.rid
@@ -344,14 +345,16 @@
345 ** if there are no query parameters.
346 */
347 static void new_brlist_page(void){
348 Stmt q;
349 double rNow;
350 int show_colors = PB("colors");
351 login_check_credentials();
352 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
353 style_header("Branches");
354 style_adunit_config(ADUNIT_RIGHT_OK);
355 style_submenu_binary("colors", "Show branch colors", "No branch colors", 0);
356 login_anonymous_available();
357
358 db_prepare(&q, brlistQuery/*works-like:""*/);
359 rNow = db_double(0.0, "SELECT julianday('now')");
360 @ <div class="brlist"><table id="branchlisttable">
@@ -367,14 +370,26 @@
370 double rMtime = db_column_double(&q, 1);
371 int isClosed = db_column_int(&q, 2);
372 const char *zMergeTo = db_column_text(&q, 3);
373 int nCkin = db_column_int(&q, 4);
374 const char *zLastCkin = db_column_text(&q, 5);
375 const char *zBgClr = db_column_text(&q, 6);
376 char *zAge = human_readable_age(rNow - rMtime);
377 sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0);
378 if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0;
379 if( zBgClr == 0 ){
380 if( zBranch==0 || strcmp(zBranch,"trunk")==0 ){
381 zBgClr = 0;
382 }else{
383 zBgClr = hash_color(zBranch);
384 }
385 }
386 if( zBgClr && zBgClr[0] && show_colors ){
387 @ <tr style="background-color:%s(zBgClr)">
388 }else{
389 @ <tr>
390 }
391 @ <td>%z(href("%R/timeline?n=100&r=%T",zBranch))%h(zBranch)</a></td>
392 @ <td data-sortkey="%016llx(-iMtime)">%s(zAge)</td>
393 @ <td>%d(nCkin)</td>
394 fossil_free(zAge);
395 @ <td>%s(isClosed?"closed":"")</td>
396
--- www/changes.wiki
+++ www/changes.wiki
@@ -4,11 +4,12 @@
44
<h2>Changes for Version 1.37 (2017-XX-YY)</h2>
55
66
* Fix a C99-ism that prevents the 1.36 release from building with MSVC.
77
* Fix [/help?cmd=ticket|ticket set] when using the "+" prefix with fields
88
from the "ticketchng" table.
9
- * Remove "fusefs" command from builds that do not have the underlying
9
+ * Enhance the "brlist" page to make use of branch colors.
10
+ * Remove the "fusefs" command from builds that do not have the underlying
1011
support enabled.
1112
1213
<a name='v1_36'></a>
1314
<h2>Changes for Version 1.36 (2016-10-24)</h2>
1415
1516
--- www/changes.wiki
+++ www/changes.wiki
@@ -4,11 +4,12 @@
4 <h2>Changes for Version 1.37 (2017-XX-YY)</h2>
5
6 * Fix a C99-ism that prevents the 1.36 release from building with MSVC.
7 * Fix [/help?cmd=ticket|ticket set] when using the "+" prefix with fields
8 from the "ticketchng" table.
9 * Remove "fusefs" command from builds that do not have the underlying
 
10 support enabled.
11
12 <a name='v1_36'></a>
13 <h2>Changes for Version 1.36 (2016-10-24)</h2>
14
15
--- www/changes.wiki
+++ www/changes.wiki
@@ -4,11 +4,12 @@
4 <h2>Changes for Version 1.37 (2017-XX-YY)</h2>
5
6 * Fix a C99-ism that prevents the 1.36 release from building with MSVC.
7 * Fix [/help?cmd=ticket|ticket set] when using the "+" prefix with fields
8 from the "ticketchng" table.
9 * Enhance the "brlist" page to make use of branch colors.
10 * Remove the "fusefs" command from builds that do not have the underlying
11 support enabled.
12
13 <a name='v1_36'></a>
14 <h2>Changes for Version 1.36 (2016-10-24)</h2>
15
16
--- www/changes.wiki
+++ www/changes.wiki
@@ -4,11 +4,12 @@
44
<h2>Changes for Version 1.37 (2017-XX-YY)</h2>
55
66
* Fix a C99-ism that prevents the 1.36 release from building with MSVC.
77
* Fix [/help?cmd=ticket|ticket set] when using the "+" prefix with fields
88
from the "ticketchng" table.
9
- * Remove "fusefs" command from builds that do not have the underlying
9
+ * Enhance the "brlist" page to make use of branch colors.
10
+ * Remove the "fusefs" command from builds that do not have the underlying
1011
support enabled.
1112
1213
<a name='v1_36'></a>
1314
<h2>Changes for Version 1.36 (2016-10-24)</h2>
1415
1516
--- www/changes.wiki
+++ www/changes.wiki
@@ -4,11 +4,12 @@
4 <h2>Changes for Version 1.37 (2017-XX-YY)</h2>
5
6 * Fix a C99-ism that prevents the 1.36 release from building with MSVC.
7 * Fix [/help?cmd=ticket|ticket set] when using the "+" prefix with fields
8 from the "ticketchng" table.
9 * Remove "fusefs" command from builds that do not have the underlying
 
10 support enabled.
11
12 <a name='v1_36'></a>
13 <h2>Changes for Version 1.36 (2016-10-24)</h2>
14
15
--- www/changes.wiki
+++ www/changes.wiki
@@ -4,11 +4,12 @@
4 <h2>Changes for Version 1.37 (2017-XX-YY)</h2>
5
6 * Fix a C99-ism that prevents the 1.36 release from building with MSVC.
7 * Fix [/help?cmd=ticket|ticket set] when using the "+" prefix with fields
8 from the "ticketchng" table.
9 * Enhance the "brlist" page to make use of branch colors.
10 * Remove the "fusefs" command from builds that do not have the underlying
11 support enabled.
12
13 <a name='v1_36'></a>
14 <h2>Changes for Version 1.36 (2016-10-24)</h2>
15
16

Keyboard Shortcuts

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