Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Switch to time based color hash generation for other pages (brlist, finfo, info, and ci_edit). Now abandoned. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | datetime-color-hash |
| Files: | files | file ages | folders |
| SHA3-256: |
4a90f3352dc7f49c9b2a69ff6b146857 |
| User & Date: | andybradford 2025-09-27 16:26:16.798 |
| Original Comment: | Switch to time based color hash generation for other pages (brlist, finfo, and info). |
Context
|
2025-09-27
| ||
| 16:26 | Switch to time based color hash generation for other pages (brlist, finfo, info, and ci_edit). Now abandoned. Closed-Leaf check-in: 4a90f3352d user: andybradford tags: datetime-color-hash | |
| 00:47 | Use the datetime of the start of the branch as the input for the color hash. See suggestion made by Stephan Beal in [forum:/forumpost/a9a92d73c4a172f9|forum post a9a92d73c4a172f9]. check-in: 1851b26d2b user: andybradford tags: datetime-color-hash | |
Changes
Changes to src/branch.c.
| ︙ | ︙ | |||
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | ** mtime Time of last check-in on this branch ** isclosed True if the branch is closed ** mergeto Another branch this branch was merged into ** nckin Number of checkins on this branch ** ckin Hash of the last check-in on this branch ** isprivate True if the branch is private ** bgclr Background color for this branch */ static const char createBrlistQuery[] = @ CREATE TEMP TABLE IF NOT EXISTS tmp_brlist AS @ SELECT @ tagxref.value AS name, @ max(event.mtime) AS mtime, @ EXISTS(SELECT 1 FROM tagxref AS tx @ WHERE tx.rid=tagxref.rid @ AND tx.tagid=(SELECT tagid FROM tag WHERE tagname='closed') @ AND tx.tagtype>0) AS isclosed, @ (SELECT tagxref.value @ FROM plink CROSS JOIN tagxref @ WHERE plink.pid=event.objid @ AND tagxref.rid=plink.cid @ AND tagxref.tagid=(SELECT tagid FROM tag WHERE tagname='branch') @ AND tagtype>0) AS mergeto, @ count(*) AS nckin, @ (SELECT uuid FROM blob WHERE rid=tagxref.rid) AS ckin, @ event.bgcolor AS bgclr, | > | > | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | ** mtime Time of last check-in on this branch ** isclosed True if the branch is closed ** mergeto Another branch this branch was merged into ** nckin Number of checkins on this branch ** ckin Hash of the last check-in on this branch ** isprivate True if the branch is private ** bgclr Background color for this branch ** rid RID of the last check-in on this branch */ static const char createBrlistQuery[] = @ CREATE TEMP TABLE IF NOT EXISTS tmp_brlist AS @ SELECT @ tagxref.value AS name, @ max(event.mtime) AS mtime, @ EXISTS(SELECT 1 FROM tagxref AS tx @ WHERE tx.rid=tagxref.rid @ AND tx.tagid=(SELECT tagid FROM tag WHERE tagname='closed') @ AND tx.tagtype>0) AS isclosed, @ (SELECT tagxref.value @ FROM plink CROSS JOIN tagxref @ WHERE plink.pid=event.objid @ AND tagxref.rid=plink.cid @ AND tagxref.tagid=(SELECT tagid FROM tag WHERE tagname='branch') @ AND tagtype>0) AS mergeto, @ count(*) AS nckin, @ (SELECT uuid FROM blob WHERE rid=tagxref.rid) AS ckin, @ event.bgcolor AS bgclr, @ EXISTS(SELECT 1 FROM private WHERE rid=tagxref.rid) AS isprivate, @ event.objid AS rid @ FROM tagxref, tag, event @ WHERE tagxref.tagid=tag.tagid @ AND tagxref.tagtype>0 @ AND tag.tagname='branch' @ AND event.objid=tagxref.rid @ GROUP BY 1; ; |
| ︙ | ︙ | |||
863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 |
const char *zBranch = db_column_text(&q, 0);
double rMtime = db_column_double(&q, 1);
int isClosed = db_column_int(&q, 2);
const char *zMergeTo = db_column_text(&q, 3);
int nCkin = db_column_int(&q, 4);
const char *zLastCkin = db_column_text(&q, 5);
const char *zBgClr = db_column_text(&q, 6);
char *zAge = human_readable_age(rNow - rMtime);
sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0);
if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0;
if( zBgClr ) zBgClr = reasonable_bg_color(zBgClr, 0);
if( zBgClr==0 ){
if( zBranch==0 || strcmp(zBranch,"trunk")==0 ){
zBgClr = 0;
}else{
| > > | | 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 |
const char *zBranch = db_column_text(&q, 0);
double rMtime = db_column_double(&q, 1);
int isClosed = db_column_int(&q, 2);
const char *zMergeTo = db_column_text(&q, 3);
int nCkin = db_column_int(&q, 4);
const char *zLastCkin = db_column_text(&q, 5);
const char *zBgClr = db_column_text(&q, 6);
int rid = db_column_int(&q, 8);
const char *zBrDate = datetime_of_rid(start_of_branch(rid,1));
char *zAge = human_readable_age(rNow - rMtime);
sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0);
if( zMergeTo && zMergeTo[0]==0 ) zMergeTo = 0;
if( zBgClr ) zBgClr = reasonable_bg_color(zBgClr, 0);
if( zBgClr==0 ){
if( zBranch==0 || strcmp(zBranch,"trunk")==0 ){
zBgClr = 0;
}else{
zBgClr = hash_color(zBrDate);
}
}
if( zBgClr && zBgClr[0] && show_colors ){
@ <tr style="background-color:%s(zBgClr)">
}else{
@ <tr>
}
|
| ︙ | ︙ |
Changes to src/finfo.c.
| ︙ | ︙ | |||
486 487 488 489 490 491 492 |
" event.bgcolor,\n" /* Background color */
" (SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0"
" AND tagxref.rid=mlink.mid),\n" /* Branchname */
" mlink.mid,\n" /* check-in ID */
" mlink.pfnid,\n" /* Previous filename */
" blob.size,\n" /* File size */
" mlink.fnid,\n" /* Current filename */
| | > | 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 |
" event.bgcolor,\n" /* Background color */
" (SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0"
" AND tagxref.rid=mlink.mid),\n" /* Branchname */
" mlink.mid,\n" /* check-in ID */
" mlink.pfnid,\n" /* Previous filename */
" blob.size,\n" /* File size */
" mlink.fnid,\n" /* Current filename */
" filename.name,\n" /* Current filename */
" event.objid AS rid\n" /* RID for event */
"FROM clade CROSS JOIN mlink, event"
" LEFT JOIN blob ON blob.rid=clade.fid"
" LEFT JOIN filename ON filename.fnid=clade.fnid\n"
"WHERE mlink.fnid=clade.fnid AND mlink.fid=clade.fid\n"
" AND event.objid=mlink.mid\n",
TAG_BRANCH
);
|
| ︙ | ︙ | |||
615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 |
const char *zBgClr = db_column_text(&q, 8);
const char *zBr = db_column_text(&q, 9);
int fmid = db_column_int(&q, 10);
int pfnid = db_column_int(&q, 11);
int szFile = db_column_int(&q, 12);
int fnid = db_column_int(&q, 13);
const char *zFName = db_column_text(&q,14);
int gidx;
char zTime[10];
int nParent = 0;
int bIsModified = 0;
GraphRowId aParent[GR_MAX_RAIL];
db_bind_int(&qparent, ":fid", frid);
db_bind_int(&qparent, ":mid", fmid);
db_bind_int(&qparent, ":fnid", fnid);
while( db_step(&qparent)==SQLITE_ROW && nParent<count(aParent) ){
aParent[nParent] = db_column_int64(&qparent, 0);
nParent++;
}
db_reset(&qparent);
if( zBr==0 ) zBr = "trunk";
if( uBg ){
zBgClr = user_color(zUser);
}else if( brBg || zBgClr==0 || zBgClr[0]==0 ){
| > > | | 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 |
const char *zBgClr = db_column_text(&q, 8);
const char *zBr = db_column_text(&q, 9);
int fmid = db_column_int(&q, 10);
int pfnid = db_column_int(&q, 11);
int szFile = db_column_int(&q, 12);
int fnid = db_column_int(&q, 13);
const char *zFName = db_column_text(&q,14);
int rid = db_column_int(&q, 15);
const char *zBrDate = datetime_of_rid(start_of_branch(rid,1));
int gidx;
char zTime[10];
int nParent = 0;
int bIsModified = 0;
GraphRowId aParent[GR_MAX_RAIL];
db_bind_int(&qparent, ":fid", frid);
db_bind_int(&qparent, ":mid", fmid);
db_bind_int(&qparent, ":fnid", fnid);
while( db_step(&qparent)==SQLITE_ROW && nParent<count(aParent) ){
aParent[nParent] = db_column_int64(&qparent, 0);
nParent++;
}
db_reset(&qparent);
if( zBr==0 ) zBr = "trunk";
if( uBg ){
zBgClr = user_color(zUser);
}else if( brBg || zBgClr==0 || zBgClr[0]==0 ){
zBgClr = strcmp(zBr,"trunk")==0 ? "" : hash_color(zBrDate);
}else if( zBgClr ){
zBgClr = reasonable_bg_color(zBgClr,0);
}
gidx = graph_add_row(pGraph,
frid>0 ? (GraphRowId)frid*(mxfnid+1)+fnid : fpid+1000000000,
nParent, 0, aParent, zBr, zBgClr,
zUuid, 0);
|
| ︙ | ︙ |
Changes to src/info.c.
| ︙ | ︙ | |||
3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 |
blob_append(&comment, zNewComment, -1);
zUuid[10] = 0;
style_header("Edit Check-in [%s]", zUuid);
if( P("preview") ){
Blob suffix;
int nTag = 0;
const char *zDplyBr; /* Branch name used to determine BG color */
if( zNewBrFlag[0] && zNewBranch[0] ){
zDplyBr = zNewBranch;
}else{
zDplyBr = zBranchName;
}
@ <b>Preview:</b>
@ <blockquote>
@ <table border=0>
if( zNewColorFlag[0] && zNewColor && zNewColor[0] ){
@ <tr><td style="background-color:%h(reasonable_bg_color(zNewColor,0));">
}else if( zColor[0] ){
@ <tr><td style="background-color:%h(reasonable_bg_color(zColor,0));">
}else if( zDplyBr && fossil_strcmp(zDplyBr,"trunk")!=0 ){
| > | | 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 |
blob_append(&comment, zNewComment, -1);
zUuid[10] = 0;
style_header("Edit Check-in [%s]", zUuid);
if( P("preview") ){
Blob suffix;
int nTag = 0;
const char *zDplyBr; /* Branch name used to determine BG color */
const char *zBrDate = datetime_of_rid(start_of_branch(rid,1));
if( zNewBrFlag[0] && zNewBranch[0] ){
zDplyBr = zNewBranch;
}else{
zDplyBr = zBranchName;
}
@ <b>Preview:</b>
@ <blockquote>
@ <table border=0>
if( zNewColorFlag[0] && zNewColor && zNewColor[0] ){
@ <tr><td style="background-color:%h(reasonable_bg_color(zNewColor,0));">
}else if( zColor[0] ){
@ <tr><td style="background-color:%h(reasonable_bg_color(zColor,0));">
}else if( zDplyBr && fossil_strcmp(zDplyBr,"trunk")!=0 ){
@ <tr><td style="background-color:%h(hash_color(zBrDate));">
}else{
@ <tr><td>
}
@ %!W(blob_str(&comment))
blob_zero(&suffix);
blob_appendf(&suffix, "(user: %h", zNewUser);
db_prepare(&q, "SELECT substr(tagname,5) FROM tagxref, tag"
|
| ︙ | ︙ |