Fossil SCM
Use the automatic background color algorithm for individual file timelines in addition to the global timeline.
Commit
abe7b8335f83c08e2139c1b10566badcb62a7105
Parent
dd74352d2c919e7…
2 files changed
+9
+3
-3
+9
| --- src/finfo.c | ||
| +++ src/finfo.c | ||
| @@ -193,10 +193,12 @@ | ||
| 193 | 193 | ** Additional query parameters: |
| 194 | 194 | ** |
| 195 | 195 | ** a=DATE Only show changes after DATE |
| 196 | 196 | ** b=DATE Only show changes before DATE |
| 197 | 197 | ** n=NUM Show the first NUM changes only |
| 198 | +** brbg Background color by branch name | |
| 199 | +** ubg Background color by user name | |
| 198 | 200 | */ |
| 199 | 201 | void finfo_page(void){ |
| 200 | 202 | Stmt q; |
| 201 | 203 | const char *zFilename; |
| 202 | 204 | char zPrevDate[20]; |
| @@ -204,10 +206,12 @@ | ||
| 204 | 206 | const char *zB; |
| 205 | 207 | int n; |
| 206 | 208 | Blob title; |
| 207 | 209 | Blob sql; |
| 208 | 210 | GraphContext *pGraph; |
| 211 | + int brBg = P("brbg")!=0; | |
| 212 | + int uBg = P("ubg")!=0; | |
| 209 | 213 | |
| 210 | 214 | login_check_credentials(); |
| 211 | 215 | if( !g.okRead ){ login_needed(); return; } |
| 212 | 216 | style_header("File History"); |
| 213 | 217 | login_anonymous_available(); |
| @@ -268,10 +272,15 @@ | ||
| 268 | 272 | int gidx; |
| 269 | 273 | char zTime[10]; |
| 270 | 274 | char zShort[20]; |
| 271 | 275 | char zShortCkin[20]; |
| 272 | 276 | if( zBr==0 ) zBr = "trunk"; |
| 277 | + if( uBg ){ | |
| 278 | + zBgClr = hash_color(zUser); | |
| 279 | + }else if( brBg || zBgClr==0 || zBgClr[0]==0 ){ | |
| 280 | + zBgClr = strcmp(zBr,"trunk")==0 ? "white" : hash_color(zBr); | |
| 281 | + } | |
| 273 | 282 | gidx = graph_add_row(pGraph, frid, fpid>0 ? 1 : 0, &fpid, zBr, zBgClr, 0); |
| 274 | 283 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 275 | 284 | sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate); |
| 276 | 285 | @ <tr><td> |
| 277 | 286 | @ <div class="divider">%s(zPrevDate)</div> |
| 278 | 287 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -193,10 +193,12 @@ | |
| 193 | ** Additional query parameters: |
| 194 | ** |
| 195 | ** a=DATE Only show changes after DATE |
| 196 | ** b=DATE Only show changes before DATE |
| 197 | ** n=NUM Show the first NUM changes only |
| 198 | */ |
| 199 | void finfo_page(void){ |
| 200 | Stmt q; |
| 201 | const char *zFilename; |
| 202 | char zPrevDate[20]; |
| @@ -204,10 +206,12 @@ | |
| 204 | const char *zB; |
| 205 | int n; |
| 206 | Blob title; |
| 207 | Blob sql; |
| 208 | GraphContext *pGraph; |
| 209 | |
| 210 | login_check_credentials(); |
| 211 | if( !g.okRead ){ login_needed(); return; } |
| 212 | style_header("File History"); |
| 213 | login_anonymous_available(); |
| @@ -268,10 +272,15 @@ | |
| 268 | int gidx; |
| 269 | char zTime[10]; |
| 270 | char zShort[20]; |
| 271 | char zShortCkin[20]; |
| 272 | if( zBr==0 ) zBr = "trunk"; |
| 273 | gidx = graph_add_row(pGraph, frid, fpid>0 ? 1 : 0, &fpid, zBr, zBgClr, 0); |
| 274 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 275 | sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate); |
| 276 | @ <tr><td> |
| 277 | @ <div class="divider">%s(zPrevDate)</div> |
| 278 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -193,10 +193,12 @@ | |
| 193 | ** Additional query parameters: |
| 194 | ** |
| 195 | ** a=DATE Only show changes after DATE |
| 196 | ** b=DATE Only show changes before DATE |
| 197 | ** n=NUM Show the first NUM changes only |
| 198 | ** brbg Background color by branch name |
| 199 | ** ubg Background color by user name |
| 200 | */ |
| 201 | void finfo_page(void){ |
| 202 | Stmt q; |
| 203 | const char *zFilename; |
| 204 | char zPrevDate[20]; |
| @@ -204,10 +206,12 @@ | |
| 206 | const char *zB; |
| 207 | int n; |
| 208 | Blob title; |
| 209 | Blob sql; |
| 210 | GraphContext *pGraph; |
| 211 | int brBg = P("brbg")!=0; |
| 212 | int uBg = P("ubg")!=0; |
| 213 | |
| 214 | login_check_credentials(); |
| 215 | if( !g.okRead ){ login_needed(); return; } |
| 216 | style_header("File History"); |
| 217 | login_anonymous_available(); |
| @@ -268,10 +272,15 @@ | |
| 272 | int gidx; |
| 273 | char zTime[10]; |
| 274 | char zShort[20]; |
| 275 | char zShortCkin[20]; |
| 276 | if( zBr==0 ) zBr = "trunk"; |
| 277 | if( uBg ){ |
| 278 | zBgClr = hash_color(zUser); |
| 279 | }else if( brBg || zBgClr==0 || zBgClr[0]==0 ){ |
| 280 | zBgClr = strcmp(zBr,"trunk")==0 ? "white" : hash_color(zBr); |
| 281 | } |
| 282 | gidx = graph_add_row(pGraph, frid, fpid>0 ? 1 : 0, &fpid, zBr, zBgClr, 0); |
| 283 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 284 | sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate); |
| 285 | @ <tr><td> |
| 286 | @ <div class="divider">%s(zPrevDate)</div> |
| 287 |
+3
-3
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -114,11 +114,11 @@ | ||
| 114 | 114 | #endif |
| 115 | 115 | |
| 116 | 116 | /* |
| 117 | 117 | ** Hash a string and use the hash to determine a background color. |
| 118 | 118 | */ |
| 119 | -const char *hashColor(const char *z){ | |
| 119 | +char *hash_color(const char *z){ | |
| 120 | 120 | int i; /* Loop counter */ |
| 121 | 121 | unsigned int h = 0; /* Hash on the branch name */ |
| 122 | 122 | int r, g, b; /* Values for red, green, and blue */ |
| 123 | 123 | int h1, h2, h3, h4; /* Elements of the hash value */ |
| 124 | 124 | int mx, mn; /* Components of HSV */ |
| @@ -258,11 +258,11 @@ | ||
| 258 | 258 | memcpy(zTime, &zDate[11], 5); |
| 259 | 259 | zTime[5] = 0; |
| 260 | 260 | @ <tr> |
| 261 | 261 | @ <td class="timelineTime">%s(zTime)</td> |
| 262 | 262 | @ <td class="timelineGraph"> |
| 263 | - if( tmFlags & TIMELINE_UCOLOR ) zBgClr = zUser ? hashColor(zUser) : 0; | |
| 263 | + if( tmFlags & TIMELINE_UCOLOR ) zBgClr = zUser ? hash_color(zUser) : 0; | |
| 264 | 264 | if( zType[0]=='c' |
| 265 | 265 | && (pGraph || zBgClr==0 || (tmFlags & TIMELINE_BRCOLOR)!=0) |
| 266 | 266 | ){ |
| 267 | 267 | db_reset(&qbranch); |
| 268 | 268 | db_bind_int(&qbranch, ":rid", rid); |
| @@ -273,11 +273,11 @@ | ||
| 273 | 273 | } |
| 274 | 274 | if( zBgClr==0 || (tmFlags & TIMELINE_BRCOLOR)!=0 ){ |
| 275 | 275 | if( zBr==0 || strcmp(zBr,"trunk")==0 ){ |
| 276 | 276 | zBgClr = 0; |
| 277 | 277 | }else{ |
| 278 | - zBgClr = hashColor(zBr); | |
| 278 | + zBgClr = hash_color(zBr); | |
| 279 | 279 | } |
| 280 | 280 | } |
| 281 | 281 | } |
| 282 | 282 | if( zType[0]=='c' && (pGraph || (tmFlags & TIMELINE_BRCOLOR)!=0) ){ |
| 283 | 283 | int nParent = 0; |
| 284 | 284 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -114,11 +114,11 @@ | |
| 114 | #endif |
| 115 | |
| 116 | /* |
| 117 | ** Hash a string and use the hash to determine a background color. |
| 118 | */ |
| 119 | const char *hashColor(const char *z){ |
| 120 | int i; /* Loop counter */ |
| 121 | unsigned int h = 0; /* Hash on the branch name */ |
| 122 | int r, g, b; /* Values for red, green, and blue */ |
| 123 | int h1, h2, h3, h4; /* Elements of the hash value */ |
| 124 | int mx, mn; /* Components of HSV */ |
| @@ -258,11 +258,11 @@ | |
| 258 | memcpy(zTime, &zDate[11], 5); |
| 259 | zTime[5] = 0; |
| 260 | @ <tr> |
| 261 | @ <td class="timelineTime">%s(zTime)</td> |
| 262 | @ <td class="timelineGraph"> |
| 263 | if( tmFlags & TIMELINE_UCOLOR ) zBgClr = zUser ? hashColor(zUser) : 0; |
| 264 | if( zType[0]=='c' |
| 265 | && (pGraph || zBgClr==0 || (tmFlags & TIMELINE_BRCOLOR)!=0) |
| 266 | ){ |
| 267 | db_reset(&qbranch); |
| 268 | db_bind_int(&qbranch, ":rid", rid); |
| @@ -273,11 +273,11 @@ | |
| 273 | } |
| 274 | if( zBgClr==0 || (tmFlags & TIMELINE_BRCOLOR)!=0 ){ |
| 275 | if( zBr==0 || strcmp(zBr,"trunk")==0 ){ |
| 276 | zBgClr = 0; |
| 277 | }else{ |
| 278 | zBgClr = hashColor(zBr); |
| 279 | } |
| 280 | } |
| 281 | } |
| 282 | if( zType[0]=='c' && (pGraph || (tmFlags & TIMELINE_BRCOLOR)!=0) ){ |
| 283 | int nParent = 0; |
| 284 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -114,11 +114,11 @@ | |
| 114 | #endif |
| 115 | |
| 116 | /* |
| 117 | ** Hash a string and use the hash to determine a background color. |
| 118 | */ |
| 119 | char *hash_color(const char *z){ |
| 120 | int i; /* Loop counter */ |
| 121 | unsigned int h = 0; /* Hash on the branch name */ |
| 122 | int r, g, b; /* Values for red, green, and blue */ |
| 123 | int h1, h2, h3, h4; /* Elements of the hash value */ |
| 124 | int mx, mn; /* Components of HSV */ |
| @@ -258,11 +258,11 @@ | |
| 258 | memcpy(zTime, &zDate[11], 5); |
| 259 | zTime[5] = 0; |
| 260 | @ <tr> |
| 261 | @ <td class="timelineTime">%s(zTime)</td> |
| 262 | @ <td class="timelineGraph"> |
| 263 | if( tmFlags & TIMELINE_UCOLOR ) zBgClr = zUser ? hash_color(zUser) : 0; |
| 264 | if( zType[0]=='c' |
| 265 | && (pGraph || zBgClr==0 || (tmFlags & TIMELINE_BRCOLOR)!=0) |
| 266 | ){ |
| 267 | db_reset(&qbranch); |
| 268 | db_bind_int(&qbranch, ":rid", rid); |
| @@ -273,11 +273,11 @@ | |
| 273 | } |
| 274 | if( zBgClr==0 || (tmFlags & TIMELINE_BRCOLOR)!=0 ){ |
| 275 | if( zBr==0 || strcmp(zBr,"trunk")==0 ){ |
| 276 | zBgClr = 0; |
| 277 | }else{ |
| 278 | zBgClr = hash_color(zBr); |
| 279 | } |
| 280 | } |
| 281 | } |
| 282 | if( zType[0]=='c' && (pGraph || (tmFlags & TIMELINE_BRCOLOR)!=0) ){ |
| 283 | int nParent = 0; |
| 284 |