Fossil SCM
Simplify www_print_timeline() so that it uses branch_of_rid() rather than computing the branch name for itself.
Commit
0150eda979ee86735142cc7bf4061606f7d1260caee4c3aae1531b66c6211663
Parent
dd20f34950e5b81…
1 file changed
+3
-14
+3
-14
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -205,11 +205,10 @@ | ||
| 205 | 205 | char zPrevDate[20]; |
| 206 | 206 | GraphContext *pGraph = 0; |
| 207 | 207 | int prevWasDivider = 0; /* True if previous output row was <hr> */ |
| 208 | 208 | int fchngQueryInit = 0; /* True if fchngQuery is initialized */ |
| 209 | 209 | Stmt fchngQuery; /* Query for file changes on check-ins */ |
| 210 | - static Stmt qbranch; | |
| 211 | 210 | int pendingEndTr = 0; /* True if a </td></tr> is needed */ |
| 212 | 211 | int vid = 0; /* Current check-out version */ |
| 213 | 212 | int dateFormat = 0; /* 0: HH:MM (default) */ |
| 214 | 213 | int bCommentGitStyle = 0; /* Only show comments through first blank line */ |
| 215 | 214 | const char *zStyle; /* Sub-name for classes for the style */ |
| @@ -243,14 +242,10 @@ | ||
| 243 | 242 | zDateFmt = P("datefmt"); |
| 244 | 243 | if( zDateFmt ) dateFormat = atoi(zDateFmt); |
| 245 | 244 | if( tmFlags & TIMELINE_GRAPH ){ |
| 246 | 245 | pGraph = graph_init(); |
| 247 | 246 | } |
| 248 | - db_static_prepare(&qbranch, | |
| 249 | - "SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0 AND rid=:rid", | |
| 250 | - TAG_BRANCH | |
| 251 | - ); | |
| 252 | 247 | if( (tmFlags & TIMELINE_CHPICK)!=0 |
| 253 | 248 | && !db_table_exists("repository","cherrypick") |
| 254 | 249 | ){ |
| 255 | 250 | tmFlags &= ~TIMELINE_CHPICK; |
| 256 | 251 | } |
| @@ -266,11 +261,11 @@ | ||
| 266 | 261 | const char *zType = db_column_text(pQuery, 7); |
| 267 | 262 | const char *zUser = db_column_text(pQuery, 4); |
| 268 | 263 | const char *zTagList = db_column_text(pQuery, 8); |
| 269 | 264 | int tagid = db_column_int(pQuery, 9); |
| 270 | 265 | const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous"; |
| 271 | - const char *zBr = 0; /* Branch */ | |
| 266 | + char *zBr = 0; /* Branch */ | |
| 272 | 267 | int commentColumn = 3; /* Column containing comment text */ |
| 273 | 268 | int modPending; /* Pending moderation */ |
| 274 | 269 | char *zDateLink; /* URL for the link on the timestamp */ |
| 275 | 270 | int drawDetailEllipsis; /* True to show ellipsis in place of detail */ |
| 276 | 271 | int gidx = 0; /* Graph row identifier */ |
| @@ -412,17 +407,11 @@ | ||
| 412 | 407 | } |
| 413 | 408 | } |
| 414 | 409 | if( zType[0]=='c' |
| 415 | 410 | && (pGraph || zBgClr==0 || (tmFlags & (TIMELINE_BRCOLOR|TIMELINE_DELTA))!=0) |
| 416 | 411 | ){ |
| 417 | - db_reset(&qbranch); | |
| 418 | - db_bind_int(&qbranch, ":rid", rid); | |
| 419 | - if( db_step(&qbranch)==SQLITE_ROW ){ | |
| 420 | - zBr = db_column_text(&qbranch, 0); | |
| 421 | - }else{ | |
| 422 | - zBr = "trunk"; | |
| 423 | - } | |
| 412 | + zBr = branch_of_rid(rid); | |
| 424 | 413 | if( zBgClr==0 || (tmFlags & TIMELINE_BRCOLOR)!=0 ){ |
| 425 | 414 | if( tmFlags & (TIMELINE_DELTA|TIMELINE_NOCOLOR) ){ |
| 426 | 415 | }else if( zBr==0 || strcmp(zBr,"trunk")==0 ){ |
| 427 | 416 | zBgClr = 0; |
| 428 | 417 | }else{ |
| @@ -459,19 +448,19 @@ | ||
| 459 | 448 | db_reset(&qcherrypick); |
| 460 | 449 | } |
| 461 | 450 | gidx = graph_add_row(pGraph, rid, nParent, nCherrypick, aParent, |
| 462 | 451 | zBr, zBgClr, zUuid, |
| 463 | 452 | isLeaf ? isLeaf + 2 * has_closed_tag(rid) : 0); |
| 464 | - db_reset(&qbranch); | |
| 465 | 453 | @ <div id="m%d(gidx)" class="tl-nodemark"></div> |
| 466 | 454 | }else if( zType[0]=='e' && pGraph && zBgClr && zBgClr[0] ){ |
| 467 | 455 | /* For technotes, make a graph node with nParent==(-1). This will |
| 468 | 456 | ** not actually draw anything on the graph, but it will set the |
| 469 | 457 | ** background color of the timeline entry */ |
| 470 | 458 | gidx = graph_add_row(pGraph, rid, -1, 0, 0, zBr, zBgClr, zUuid, 0); |
| 471 | 459 | @ <div id="m%d(gidx)" class="tl-nodemark"></div> |
| 472 | 460 | } |
| 461 | + fossil_free(zBr); | |
| 473 | 462 | @</td> |
| 474 | 463 | if( !isSelectedOrCurrent ){ |
| 475 | 464 | @ <td class="timeline%s(zStyle)Cell%s(zExtraClass)" id='mc%d(gidx)'> |
| 476 | 465 | }else{ |
| 477 | 466 | @ <td class="timeline%s(zStyle)Cell%s(zExtraClass)"> |
| 478 | 467 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -205,11 +205,10 @@ | |
| 205 | char zPrevDate[20]; |
| 206 | GraphContext *pGraph = 0; |
| 207 | int prevWasDivider = 0; /* True if previous output row was <hr> */ |
| 208 | int fchngQueryInit = 0; /* True if fchngQuery is initialized */ |
| 209 | Stmt fchngQuery; /* Query for file changes on check-ins */ |
| 210 | static Stmt qbranch; |
| 211 | int pendingEndTr = 0; /* True if a </td></tr> is needed */ |
| 212 | int vid = 0; /* Current check-out version */ |
| 213 | int dateFormat = 0; /* 0: HH:MM (default) */ |
| 214 | int bCommentGitStyle = 0; /* Only show comments through first blank line */ |
| 215 | const char *zStyle; /* Sub-name for classes for the style */ |
| @@ -243,14 +242,10 @@ | |
| 243 | zDateFmt = P("datefmt"); |
| 244 | if( zDateFmt ) dateFormat = atoi(zDateFmt); |
| 245 | if( tmFlags & TIMELINE_GRAPH ){ |
| 246 | pGraph = graph_init(); |
| 247 | } |
| 248 | db_static_prepare(&qbranch, |
| 249 | "SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0 AND rid=:rid", |
| 250 | TAG_BRANCH |
| 251 | ); |
| 252 | if( (tmFlags & TIMELINE_CHPICK)!=0 |
| 253 | && !db_table_exists("repository","cherrypick") |
| 254 | ){ |
| 255 | tmFlags &= ~TIMELINE_CHPICK; |
| 256 | } |
| @@ -266,11 +261,11 @@ | |
| 266 | const char *zType = db_column_text(pQuery, 7); |
| 267 | const char *zUser = db_column_text(pQuery, 4); |
| 268 | const char *zTagList = db_column_text(pQuery, 8); |
| 269 | int tagid = db_column_int(pQuery, 9); |
| 270 | const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous"; |
| 271 | const char *zBr = 0; /* Branch */ |
| 272 | int commentColumn = 3; /* Column containing comment text */ |
| 273 | int modPending; /* Pending moderation */ |
| 274 | char *zDateLink; /* URL for the link on the timestamp */ |
| 275 | int drawDetailEllipsis; /* True to show ellipsis in place of detail */ |
| 276 | int gidx = 0; /* Graph row identifier */ |
| @@ -412,17 +407,11 @@ | |
| 412 | } |
| 413 | } |
| 414 | if( zType[0]=='c' |
| 415 | && (pGraph || zBgClr==0 || (tmFlags & (TIMELINE_BRCOLOR|TIMELINE_DELTA))!=0) |
| 416 | ){ |
| 417 | db_reset(&qbranch); |
| 418 | db_bind_int(&qbranch, ":rid", rid); |
| 419 | if( db_step(&qbranch)==SQLITE_ROW ){ |
| 420 | zBr = db_column_text(&qbranch, 0); |
| 421 | }else{ |
| 422 | zBr = "trunk"; |
| 423 | } |
| 424 | if( zBgClr==0 || (tmFlags & TIMELINE_BRCOLOR)!=0 ){ |
| 425 | if( tmFlags & (TIMELINE_DELTA|TIMELINE_NOCOLOR) ){ |
| 426 | }else if( zBr==0 || strcmp(zBr,"trunk")==0 ){ |
| 427 | zBgClr = 0; |
| 428 | }else{ |
| @@ -459,19 +448,19 @@ | |
| 459 | db_reset(&qcherrypick); |
| 460 | } |
| 461 | gidx = graph_add_row(pGraph, rid, nParent, nCherrypick, aParent, |
| 462 | zBr, zBgClr, zUuid, |
| 463 | isLeaf ? isLeaf + 2 * has_closed_tag(rid) : 0); |
| 464 | db_reset(&qbranch); |
| 465 | @ <div id="m%d(gidx)" class="tl-nodemark"></div> |
| 466 | }else if( zType[0]=='e' && pGraph && zBgClr && zBgClr[0] ){ |
| 467 | /* For technotes, make a graph node with nParent==(-1). This will |
| 468 | ** not actually draw anything on the graph, but it will set the |
| 469 | ** background color of the timeline entry */ |
| 470 | gidx = graph_add_row(pGraph, rid, -1, 0, 0, zBr, zBgClr, zUuid, 0); |
| 471 | @ <div id="m%d(gidx)" class="tl-nodemark"></div> |
| 472 | } |
| 473 | @</td> |
| 474 | if( !isSelectedOrCurrent ){ |
| 475 | @ <td class="timeline%s(zStyle)Cell%s(zExtraClass)" id='mc%d(gidx)'> |
| 476 | }else{ |
| 477 | @ <td class="timeline%s(zStyle)Cell%s(zExtraClass)"> |
| 478 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -205,11 +205,10 @@ | |
| 205 | char zPrevDate[20]; |
| 206 | GraphContext *pGraph = 0; |
| 207 | int prevWasDivider = 0; /* True if previous output row was <hr> */ |
| 208 | int fchngQueryInit = 0; /* True if fchngQuery is initialized */ |
| 209 | Stmt fchngQuery; /* Query for file changes on check-ins */ |
| 210 | int pendingEndTr = 0; /* True if a </td></tr> is needed */ |
| 211 | int vid = 0; /* Current check-out version */ |
| 212 | int dateFormat = 0; /* 0: HH:MM (default) */ |
| 213 | int bCommentGitStyle = 0; /* Only show comments through first blank line */ |
| 214 | const char *zStyle; /* Sub-name for classes for the style */ |
| @@ -243,14 +242,10 @@ | |
| 242 | zDateFmt = P("datefmt"); |
| 243 | if( zDateFmt ) dateFormat = atoi(zDateFmt); |
| 244 | if( tmFlags & TIMELINE_GRAPH ){ |
| 245 | pGraph = graph_init(); |
| 246 | } |
| 247 | if( (tmFlags & TIMELINE_CHPICK)!=0 |
| 248 | && !db_table_exists("repository","cherrypick") |
| 249 | ){ |
| 250 | tmFlags &= ~TIMELINE_CHPICK; |
| 251 | } |
| @@ -266,11 +261,11 @@ | |
| 261 | const char *zType = db_column_text(pQuery, 7); |
| 262 | const char *zUser = db_column_text(pQuery, 4); |
| 263 | const char *zTagList = db_column_text(pQuery, 8); |
| 264 | int tagid = db_column_int(pQuery, 9); |
| 265 | const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous"; |
| 266 | char *zBr = 0; /* Branch */ |
| 267 | int commentColumn = 3; /* Column containing comment text */ |
| 268 | int modPending; /* Pending moderation */ |
| 269 | char *zDateLink; /* URL for the link on the timestamp */ |
| 270 | int drawDetailEllipsis; /* True to show ellipsis in place of detail */ |
| 271 | int gidx = 0; /* Graph row identifier */ |
| @@ -412,17 +407,11 @@ | |
| 407 | } |
| 408 | } |
| 409 | if( zType[0]=='c' |
| 410 | && (pGraph || zBgClr==0 || (tmFlags & (TIMELINE_BRCOLOR|TIMELINE_DELTA))!=0) |
| 411 | ){ |
| 412 | zBr = branch_of_rid(rid); |
| 413 | if( zBgClr==0 || (tmFlags & TIMELINE_BRCOLOR)!=0 ){ |
| 414 | if( tmFlags & (TIMELINE_DELTA|TIMELINE_NOCOLOR) ){ |
| 415 | }else if( zBr==0 || strcmp(zBr,"trunk")==0 ){ |
| 416 | zBgClr = 0; |
| 417 | }else{ |
| @@ -459,19 +448,19 @@ | |
| 448 | db_reset(&qcherrypick); |
| 449 | } |
| 450 | gidx = graph_add_row(pGraph, rid, nParent, nCherrypick, aParent, |
| 451 | zBr, zBgClr, zUuid, |
| 452 | isLeaf ? isLeaf + 2 * has_closed_tag(rid) : 0); |
| 453 | @ <div id="m%d(gidx)" class="tl-nodemark"></div> |
| 454 | }else if( zType[0]=='e' && pGraph && zBgClr && zBgClr[0] ){ |
| 455 | /* For technotes, make a graph node with nParent==(-1). This will |
| 456 | ** not actually draw anything on the graph, but it will set the |
| 457 | ** background color of the timeline entry */ |
| 458 | gidx = graph_add_row(pGraph, rid, -1, 0, 0, zBr, zBgClr, zUuid, 0); |
| 459 | @ <div id="m%d(gidx)" class="tl-nodemark"></div> |
| 460 | } |
| 461 | fossil_free(zBr); |
| 462 | @</td> |
| 463 | if( !isSelectedOrCurrent ){ |
| 464 | @ <td class="timeline%s(zStyle)Cell%s(zExtraClass)" id='mc%d(gidx)'> |
| 465 | }else{ |
| 466 | @ <td class="timeline%s(zStyle)Cell%s(zExtraClass)"> |
| 467 |