Fossil SCM
Added the "detail" query parameter to the timeline web page.
Commit
bde16926b023e361358b7d55ef4f1d0939049482
Parent
a8b0c6ffdbd89b1…
1 file changed
+45
+45
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -128,10 +128,11 @@ | ||
| 128 | 128 | #define TIMELINE_ARTID 0x0001 /* Show artifact IDs on non-check-in lines */ |
| 129 | 129 | #define TIMELINE_LEAFONLY 0x0002 /* Show "Leaf", but not "Merge", "Fork" etc */ |
| 130 | 130 | #define TIMELINE_BRIEF 0x0004 /* Combine adjacent elements of same object */ |
| 131 | 131 | #define TIMELINE_GRAPH 0x0008 /* Compute a graph */ |
| 132 | 132 | #define TIMELINE_DISJOINT 0x0010 /* Elements are not contiguous */ |
| 133 | +#define TIMELINE_FCHANGES 0x0020 /* Detail file changes */ | |
| 133 | 134 | #endif |
| 134 | 135 | |
| 135 | 136 | /* |
| 136 | 137 | ** Output a timeline in the web format given a query. The query |
| 137 | 138 | ** should return these columns: |
| @@ -161,10 +162,12 @@ | ||
| 161 | 162 | int prevTagid = 0; |
| 162 | 163 | int suppressCnt = 0; |
| 163 | 164 | char zPrevDate[20]; |
| 164 | 165 | GraphContext *pGraph = 0; |
| 165 | 166 | int prevWasDivider = 0; /* True if previous output row was <hr> */ |
| 167 | + int fchngQueryInit = 0; /* True if fchngQuery is initialized */ | |
| 168 | + Stmt fchngQuery; /* Query for file changes on check-ins */ | |
| 166 | 169 | |
| 167 | 170 | zPrevDate[0] = 0; |
| 168 | 171 | mxWikiLen = db_get_int("timeline-max-comment", 0); |
| 169 | 172 | if( db_get_boolean("timeline-block-markup", 0) ){ |
| 170 | 173 | wikiFlags = WIKI_INLINE; |
| @@ -339,10 +342,47 @@ | ||
| 339 | 342 | |
| 340 | 343 | /* Generate extra hyperlinks at the end of the comment */ |
| 341 | 344 | if( xExtra ){ |
| 342 | 345 | xExtra(rid); |
| 343 | 346 | } |
| 347 | + | |
| 348 | + /* Generate the file-change list if requested */ | |
| 349 | + if( (tmFlags & TIMELINE_FCHANGES)!=0 && zType[0]=='c' ){ | |
| 350 | + int inUl = 0; | |
| 351 | + if( !fchngQueryInit ){ | |
| 352 | + db_prepare(&fchngQuery, | |
| 353 | + "SELECT (pid==0) AS isnew," | |
| 354 | + " (fid==0) AS isdel," | |
| 355 | + " (SELECT name FROM filename WHERE fnid=mlink.fnid) AS name" | |
| 356 | + " FROM mlink" | |
| 357 | + " WHERE mid=:mid AND pid!=fid" | |
| 358 | + " ORDER BY 3" | |
| 359 | + ); | |
| 360 | + fchngQueryInit = 1; | |
| 361 | + } | |
| 362 | + db_bind_int(&fchngQuery, ":mid", rid); | |
| 363 | + while( db_step(&fchngQuery)==SQLITE_ROW ){ | |
| 364 | + const char *zFilename = db_column_text(&fchngQuery, 2); | |
| 365 | + int isNew = db_column_int(&fchngQuery, 0); | |
| 366 | + int isDel = db_column_int(&fchngQuery, 1); | |
| 367 | + if( !inUl ){ | |
| 368 | + @ <ul> | |
| 369 | + inUl = 1; | |
| 370 | + } | |
| 371 | + if( isNew ){ | |
| 372 | + @ <li> %h(zFilename) (new file)</li> | |
| 373 | + }else if( isDel ){ | |
| 374 | + @ <li> %h(zFilename) (deleted)</li> | |
| 375 | + }else{ | |
| 376 | + @ <li> %h(zFilename) </li> | |
| 377 | + } | |
| 378 | + } | |
| 379 | + db_reset(&fchngQuery); | |
| 380 | + if( inUl ){ | |
| 381 | + @ </ul> | |
| 382 | + } | |
| 383 | + } | |
| 344 | 384 | @ </td></tr> |
| 345 | 385 | } |
| 346 | 386 | if( suppressCnt ){ |
| 347 | 387 | @ <tr><td /><td /><td> |
| 348 | 388 | @ <span class="timelineDisabled">... %d(suppressCnt) similar |
| @@ -362,10 +402,11 @@ | ||
| 362 | 402 | @ <div id="grbtm" style="width:%d(pGraph->mxRail*20+30)px;"></div> |
| 363 | 403 | @ </td></tr> |
| 364 | 404 | } |
| 365 | 405 | } |
| 366 | 406 | @ </table> |
| 407 | + if( fchngQueryInit ) db_finalize(&fchngQuery); | |
| 367 | 408 | timeline_output_graph_javascript(pGraph, (tmFlags & TIMELINE_DISJOINT)!=0); |
| 368 | 409 | } |
| 369 | 410 | |
| 370 | 411 | /* |
| 371 | 412 | ** Generate all of the necessary javascript to generate a timeline |
| @@ -736,10 +777,11 @@ | ||
| 736 | 777 | ** u=USER only if belonging to this user |
| 737 | 778 | ** y=TYPE 'ci', 'w', 't', 'e' |
| 738 | 779 | ** s=TEXT string search (comment and brief) |
| 739 | 780 | ** ng Suppress the graph if present |
| 740 | 781 | ** nd Suppress "divider" lines |
| 782 | +** detail Show details of files changed | |
| 741 | 783 | ** f=RID Show family (immediate parents and children) of RID |
| 742 | 784 | ** from=RID Path from... |
| 743 | 785 | ** to=RID ... to this |
| 744 | 786 | ** nomerge ... avoid merge links on the path |
| 745 | 787 | ** |
| @@ -798,10 +840,13 @@ | ||
| 798 | 840 | tmFlags = TIMELINE_GRAPH; |
| 799 | 841 | } |
| 800 | 842 | if( P("ng")!=0 || zSearch!=0 ){ |
| 801 | 843 | tmFlags &= ~TIMELINE_GRAPH; |
| 802 | 844 | } |
| 845 | + if( P("detail")!=0 ){ | |
| 846 | + tmFlags |= TIMELINE_FCHANGES; | |
| 847 | + } | |
| 803 | 848 | |
| 804 | 849 | style_header("Timeline"); |
| 805 | 850 | login_anonymous_available(); |
| 806 | 851 | timeline_temp_table(); |
| 807 | 852 | blob_zero(&sql); |
| 808 | 853 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -128,10 +128,11 @@ | |
| 128 | #define TIMELINE_ARTID 0x0001 /* Show artifact IDs on non-check-in lines */ |
| 129 | #define TIMELINE_LEAFONLY 0x0002 /* Show "Leaf", but not "Merge", "Fork" etc */ |
| 130 | #define TIMELINE_BRIEF 0x0004 /* Combine adjacent elements of same object */ |
| 131 | #define TIMELINE_GRAPH 0x0008 /* Compute a graph */ |
| 132 | #define TIMELINE_DISJOINT 0x0010 /* Elements are not contiguous */ |
| 133 | #endif |
| 134 | |
| 135 | /* |
| 136 | ** Output a timeline in the web format given a query. The query |
| 137 | ** should return these columns: |
| @@ -161,10 +162,12 @@ | |
| 161 | int prevTagid = 0; |
| 162 | int suppressCnt = 0; |
| 163 | char zPrevDate[20]; |
| 164 | GraphContext *pGraph = 0; |
| 165 | int prevWasDivider = 0; /* True if previous output row was <hr> */ |
| 166 | |
| 167 | zPrevDate[0] = 0; |
| 168 | mxWikiLen = db_get_int("timeline-max-comment", 0); |
| 169 | if( db_get_boolean("timeline-block-markup", 0) ){ |
| 170 | wikiFlags = WIKI_INLINE; |
| @@ -339,10 +342,47 @@ | |
| 339 | |
| 340 | /* Generate extra hyperlinks at the end of the comment */ |
| 341 | if( xExtra ){ |
| 342 | xExtra(rid); |
| 343 | } |
| 344 | @ </td></tr> |
| 345 | } |
| 346 | if( suppressCnt ){ |
| 347 | @ <tr><td /><td /><td> |
| 348 | @ <span class="timelineDisabled">... %d(suppressCnt) similar |
| @@ -362,10 +402,11 @@ | |
| 362 | @ <div id="grbtm" style="width:%d(pGraph->mxRail*20+30)px;"></div> |
| 363 | @ </td></tr> |
| 364 | } |
| 365 | } |
| 366 | @ </table> |
| 367 | timeline_output_graph_javascript(pGraph, (tmFlags & TIMELINE_DISJOINT)!=0); |
| 368 | } |
| 369 | |
| 370 | /* |
| 371 | ** Generate all of the necessary javascript to generate a timeline |
| @@ -736,10 +777,11 @@ | |
| 736 | ** u=USER only if belonging to this user |
| 737 | ** y=TYPE 'ci', 'w', 't', 'e' |
| 738 | ** s=TEXT string search (comment and brief) |
| 739 | ** ng Suppress the graph if present |
| 740 | ** nd Suppress "divider" lines |
| 741 | ** f=RID Show family (immediate parents and children) of RID |
| 742 | ** from=RID Path from... |
| 743 | ** to=RID ... to this |
| 744 | ** nomerge ... avoid merge links on the path |
| 745 | ** |
| @@ -798,10 +840,13 @@ | |
| 798 | tmFlags = TIMELINE_GRAPH; |
| 799 | } |
| 800 | if( P("ng")!=0 || zSearch!=0 ){ |
| 801 | tmFlags &= ~TIMELINE_GRAPH; |
| 802 | } |
| 803 | |
| 804 | style_header("Timeline"); |
| 805 | login_anonymous_available(); |
| 806 | timeline_temp_table(); |
| 807 | blob_zero(&sql); |
| 808 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -128,10 +128,11 @@ | |
| 128 | #define TIMELINE_ARTID 0x0001 /* Show artifact IDs on non-check-in lines */ |
| 129 | #define TIMELINE_LEAFONLY 0x0002 /* Show "Leaf", but not "Merge", "Fork" etc */ |
| 130 | #define TIMELINE_BRIEF 0x0004 /* Combine adjacent elements of same object */ |
| 131 | #define TIMELINE_GRAPH 0x0008 /* Compute a graph */ |
| 132 | #define TIMELINE_DISJOINT 0x0010 /* Elements are not contiguous */ |
| 133 | #define TIMELINE_FCHANGES 0x0020 /* Detail file changes */ |
| 134 | #endif |
| 135 | |
| 136 | /* |
| 137 | ** Output a timeline in the web format given a query. The query |
| 138 | ** should return these columns: |
| @@ -161,10 +162,12 @@ | |
| 162 | int prevTagid = 0; |
| 163 | int suppressCnt = 0; |
| 164 | char zPrevDate[20]; |
| 165 | GraphContext *pGraph = 0; |
| 166 | int prevWasDivider = 0; /* True if previous output row was <hr> */ |
| 167 | int fchngQueryInit = 0; /* True if fchngQuery is initialized */ |
| 168 | Stmt fchngQuery; /* Query for file changes on check-ins */ |
| 169 | |
| 170 | zPrevDate[0] = 0; |
| 171 | mxWikiLen = db_get_int("timeline-max-comment", 0); |
| 172 | if( db_get_boolean("timeline-block-markup", 0) ){ |
| 173 | wikiFlags = WIKI_INLINE; |
| @@ -339,10 +342,47 @@ | |
| 342 | |
| 343 | /* Generate extra hyperlinks at the end of the comment */ |
| 344 | if( xExtra ){ |
| 345 | xExtra(rid); |
| 346 | } |
| 347 | |
| 348 | /* Generate the file-change list if requested */ |
| 349 | if( (tmFlags & TIMELINE_FCHANGES)!=0 && zType[0]=='c' ){ |
| 350 | int inUl = 0; |
| 351 | if( !fchngQueryInit ){ |
| 352 | db_prepare(&fchngQuery, |
| 353 | "SELECT (pid==0) AS isnew," |
| 354 | " (fid==0) AS isdel," |
| 355 | " (SELECT name FROM filename WHERE fnid=mlink.fnid) AS name" |
| 356 | " FROM mlink" |
| 357 | " WHERE mid=:mid AND pid!=fid" |
| 358 | " ORDER BY 3" |
| 359 | ); |
| 360 | fchngQueryInit = 1; |
| 361 | } |
| 362 | db_bind_int(&fchngQuery, ":mid", rid); |
| 363 | while( db_step(&fchngQuery)==SQLITE_ROW ){ |
| 364 | const char *zFilename = db_column_text(&fchngQuery, 2); |
| 365 | int isNew = db_column_int(&fchngQuery, 0); |
| 366 | int isDel = db_column_int(&fchngQuery, 1); |
| 367 | if( !inUl ){ |
| 368 | @ <ul> |
| 369 | inUl = 1; |
| 370 | } |
| 371 | if( isNew ){ |
| 372 | @ <li> %h(zFilename) (new file)</li> |
| 373 | }else if( isDel ){ |
| 374 | @ <li> %h(zFilename) (deleted)</li> |
| 375 | }else{ |
| 376 | @ <li> %h(zFilename) </li> |
| 377 | } |
| 378 | } |
| 379 | db_reset(&fchngQuery); |
| 380 | if( inUl ){ |
| 381 | @ </ul> |
| 382 | } |
| 383 | } |
| 384 | @ </td></tr> |
| 385 | } |
| 386 | if( suppressCnt ){ |
| 387 | @ <tr><td /><td /><td> |
| 388 | @ <span class="timelineDisabled">... %d(suppressCnt) similar |
| @@ -362,10 +402,11 @@ | |
| 402 | @ <div id="grbtm" style="width:%d(pGraph->mxRail*20+30)px;"></div> |
| 403 | @ </td></tr> |
| 404 | } |
| 405 | } |
| 406 | @ </table> |
| 407 | if( fchngQueryInit ) db_finalize(&fchngQuery); |
| 408 | timeline_output_graph_javascript(pGraph, (tmFlags & TIMELINE_DISJOINT)!=0); |
| 409 | } |
| 410 | |
| 411 | /* |
| 412 | ** Generate all of the necessary javascript to generate a timeline |
| @@ -736,10 +777,11 @@ | |
| 777 | ** u=USER only if belonging to this user |
| 778 | ** y=TYPE 'ci', 'w', 't', 'e' |
| 779 | ** s=TEXT string search (comment and brief) |
| 780 | ** ng Suppress the graph if present |
| 781 | ** nd Suppress "divider" lines |
| 782 | ** detail Show details of files changed |
| 783 | ** f=RID Show family (immediate parents and children) of RID |
| 784 | ** from=RID Path from... |
| 785 | ** to=RID ... to this |
| 786 | ** nomerge ... avoid merge links on the path |
| 787 | ** |
| @@ -798,10 +840,13 @@ | |
| 840 | tmFlags = TIMELINE_GRAPH; |
| 841 | } |
| 842 | if( P("ng")!=0 || zSearch!=0 ){ |
| 843 | tmFlags &= ~TIMELINE_GRAPH; |
| 844 | } |
| 845 | if( P("detail")!=0 ){ |
| 846 | tmFlags |= TIMELINE_FCHANGES; |
| 847 | } |
| 848 | |
| 849 | style_header("Timeline"); |
| 850 | login_anonymous_available(); |
| 851 | timeline_temp_table(); |
| 852 | blob_zero(&sql); |
| 853 |