Fossil SCM

Added the "detail" query parameter to the timeline web page.

drh 2011-03-30 21:45 trunk
Commit bde16926b023e361358b7d55ef4f1d0939049482
1 file changed +45
--- src/timeline.c
+++ src/timeline.c
@@ -128,10 +128,11 @@
128128
#define TIMELINE_ARTID 0x0001 /* Show artifact IDs on non-check-in lines */
129129
#define TIMELINE_LEAFONLY 0x0002 /* Show "Leaf", but not "Merge", "Fork" etc */
130130
#define TIMELINE_BRIEF 0x0004 /* Combine adjacent elements of same object */
131131
#define TIMELINE_GRAPH 0x0008 /* Compute a graph */
132132
#define TIMELINE_DISJOINT 0x0010 /* Elements are not contiguous */
133
+#define TIMELINE_FCHANGES 0x0020 /* Detail file changes */
133134
#endif
134135
135136
/*
136137
** Output a timeline in the web format given a query. The query
137138
** should return these columns:
@@ -161,10 +162,12 @@
161162
int prevTagid = 0;
162163
int suppressCnt = 0;
163164
char zPrevDate[20];
164165
GraphContext *pGraph = 0;
165166
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 */
166169
167170
zPrevDate[0] = 0;
168171
mxWikiLen = db_get_int("timeline-max-comment", 0);
169172
if( db_get_boolean("timeline-block-markup", 0) ){
170173
wikiFlags = WIKI_INLINE;
@@ -339,10 +342,47 @@
339342
340343
/* Generate extra hyperlinks at the end of the comment */
341344
if( xExtra ){
342345
xExtra(rid);
343346
}
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
+ }
344384
@ </td></tr>
345385
}
346386
if( suppressCnt ){
347387
@ <tr><td /><td /><td>
348388
@ <span class="timelineDisabled">... %d(suppressCnt) similar
@@ -362,10 +402,11 @@
362402
@ <div id="grbtm" style="width:%d(pGraph->mxRail*20+30)px;"></div>
363403
@ </td></tr>
364404
}
365405
}
366406
@ </table>
407
+ if( fchngQueryInit ) db_finalize(&fchngQuery);
367408
timeline_output_graph_javascript(pGraph, (tmFlags & TIMELINE_DISJOINT)!=0);
368409
}
369410
370411
/*
371412
** Generate all of the necessary javascript to generate a timeline
@@ -736,10 +777,11 @@
736777
** u=USER only if belonging to this user
737778
** y=TYPE 'ci', 'w', 't', 'e'
738779
** s=TEXT string search (comment and brief)
739780
** ng Suppress the graph if present
740781
** nd Suppress "divider" lines
782
+** detail Show details of files changed
741783
** f=RID Show family (immediate parents and children) of RID
742784
** from=RID Path from...
743785
** to=RID ... to this
744786
** nomerge ... avoid merge links on the path
745787
**
@@ -798,10 +840,13 @@
798840
tmFlags = TIMELINE_GRAPH;
799841
}
800842
if( P("ng")!=0 || zSearch!=0 ){
801843
tmFlags &= ~TIMELINE_GRAPH;
802844
}
845
+ if( P("detail")!=0 ){
846
+ tmFlags |= TIMELINE_FCHANGES;
847
+ }
803848
804849
style_header("Timeline");
805850
login_anonymous_available();
806851
timeline_temp_table();
807852
blob_zero(&sql);
808853
--- 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

Keyboard Shortcuts

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