Fossil SCM

Add the "Context" subsection to the /info page for check-ins that shows a graph of all immediate ancestors and descendents of the check-in.

drh 2015-02-09 04:46 trunk
Commit b709be6517716eb9fac5981f77b8eb8702331f26
1 file changed +29 -5
+29 -5
--- src/info.c
+++ src/info.c
@@ -240,23 +240,23 @@
240240
show_common_info(rid, "uuid:", 1, 1);
241241
}
242242
}
243243
244244
/*
245
-** Show information about all tags on a given node.
245
+** Show information about all tags on a given check-in.
246246
*/
247
-static void showTags(int rid, const char *zNotGlob){
247
+static void showTags(int rid){
248248
Stmt q;
249249
int cnt = 0;
250250
db_prepare(&q,
251251
"SELECT tag.tagid, tagname, "
252252
" (SELECT uuid FROM blob WHERE rid=tagxref.srcid AND rid!=%d),"
253253
" value, datetime(tagxref.mtime%s), tagtype,"
254254
" (SELECT uuid FROM blob WHERE rid=tagxref.origid AND rid!=%d)"
255255
" FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid"
256
- " WHERE tagxref.rid=%d AND tagname NOT GLOB '%q'"
257
- " ORDER BY tagname /*sort*/", rid, timeline_utc(), rid, rid, zNotGlob
256
+ " WHERE tagxref.rid=%d"
257
+ " ORDER BY tagname /*sort*/", rid, timeline_utc(), rid, rid
258258
);
259259
while( db_step(&q)==SQLITE_ROW ){
260260
const char *zTagname = db_column_text(&q, 1);
261261
const char *zSrcUuid = db_column_text(&q, 2);
262262
const char *zValue = db_column_text(&q, 3);
@@ -305,10 +305,33 @@
305305
db_finalize(&q);
306306
if( cnt ){
307307
@ </ul>
308308
}
309309
}
310
+
311
+/*
312
+** Show the context graph (immediate parents and children) for
313
+** check-in rid.
314
+*/
315
+static void showContext(int rid){
316
+ Blob sql;
317
+ Stmt q;
318
+ @ <div class="section">Context</div>
319
+ blob_zero(&sql);
320
+ blob_append(&sql, timeline_query_for_www(), -1);
321
+ db_multi_exec(
322
+ "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);"
323
+ "INSERT INTO ok VALUES(%d);"
324
+ "INSERT OR IGNORE INTO ok SELECT pid FROM plink WHERE cid=%d;"
325
+ "INSERT OR IGNORE INTO ok SELECT cid FROM plink WHERE pid=%d;",
326
+ rid, rid, rid
327
+ );
328
+ blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC");
329
+ db_prepare(&q, "%s", blob_sql_text(&sql));
330
+ www_print_timeline(&q, TIMELINE_DISJOINT|TIMELINE_GRAPH, 0, 0, rid, 0);
331
+ db_finalize(&q);
332
+}
310333
311334
312335
/*
313336
** Append the difference between artifacts to the output
314337
*/
@@ -664,11 +687,12 @@
664687
}else{
665688
style_header("Check-in Information");
666689
login_anonymous_available();
667690
}
668691
db_finalize(&q1);
669
- showTags(rid, "");
692
+ showTags(rid);
693
+ showContext(rid);
670694
@ <div class="section">Changes</div>
671695
@ <div class="sectionmenu">
672696
verboseFlag = g.zPath[0]!='c';
673697
if( db_get_boolean("show-version-diffs", 0)==0 ){
674698
verboseFlag = !verboseFlag;
675699
--- src/info.c
+++ src/info.c
@@ -240,23 +240,23 @@
240 show_common_info(rid, "uuid:", 1, 1);
241 }
242 }
243
244 /*
245 ** Show information about all tags on a given node.
246 */
247 static void showTags(int rid, const char *zNotGlob){
248 Stmt q;
249 int cnt = 0;
250 db_prepare(&q,
251 "SELECT tag.tagid, tagname, "
252 " (SELECT uuid FROM blob WHERE rid=tagxref.srcid AND rid!=%d),"
253 " value, datetime(tagxref.mtime%s), tagtype,"
254 " (SELECT uuid FROM blob WHERE rid=tagxref.origid AND rid!=%d)"
255 " FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid"
256 " WHERE tagxref.rid=%d AND tagname NOT GLOB '%q'"
257 " ORDER BY tagname /*sort*/", rid, timeline_utc(), rid, rid, zNotGlob
258 );
259 while( db_step(&q)==SQLITE_ROW ){
260 const char *zTagname = db_column_text(&q, 1);
261 const char *zSrcUuid = db_column_text(&q, 2);
262 const char *zValue = db_column_text(&q, 3);
@@ -305,10 +305,33 @@
305 db_finalize(&q);
306 if( cnt ){
307 @ </ul>
308 }
309 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
310
311
312 /*
313 ** Append the difference between artifacts to the output
314 */
@@ -664,11 +687,12 @@
664 }else{
665 style_header("Check-in Information");
666 login_anonymous_available();
667 }
668 db_finalize(&q1);
669 showTags(rid, "");
 
670 @ <div class="section">Changes</div>
671 @ <div class="sectionmenu">
672 verboseFlag = g.zPath[0]!='c';
673 if( db_get_boolean("show-version-diffs", 0)==0 ){
674 verboseFlag = !verboseFlag;
675
--- src/info.c
+++ src/info.c
@@ -240,23 +240,23 @@
240 show_common_info(rid, "uuid:", 1, 1);
241 }
242 }
243
244 /*
245 ** Show information about all tags on a given check-in.
246 */
247 static void showTags(int rid){
248 Stmt q;
249 int cnt = 0;
250 db_prepare(&q,
251 "SELECT tag.tagid, tagname, "
252 " (SELECT uuid FROM blob WHERE rid=tagxref.srcid AND rid!=%d),"
253 " value, datetime(tagxref.mtime%s), tagtype,"
254 " (SELECT uuid FROM blob WHERE rid=tagxref.origid AND rid!=%d)"
255 " FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid"
256 " WHERE tagxref.rid=%d"
257 " ORDER BY tagname /*sort*/", rid, timeline_utc(), rid, rid
258 );
259 while( db_step(&q)==SQLITE_ROW ){
260 const char *zTagname = db_column_text(&q, 1);
261 const char *zSrcUuid = db_column_text(&q, 2);
262 const char *zValue = db_column_text(&q, 3);
@@ -305,10 +305,33 @@
305 db_finalize(&q);
306 if( cnt ){
307 @ </ul>
308 }
309 }
310
311 /*
312 ** Show the context graph (immediate parents and children) for
313 ** check-in rid.
314 */
315 static void showContext(int rid){
316 Blob sql;
317 Stmt q;
318 @ <div class="section">Context</div>
319 blob_zero(&sql);
320 blob_append(&sql, timeline_query_for_www(), -1);
321 db_multi_exec(
322 "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);"
323 "INSERT INTO ok VALUES(%d);"
324 "INSERT OR IGNORE INTO ok SELECT pid FROM plink WHERE cid=%d;"
325 "INSERT OR IGNORE INTO ok SELECT cid FROM plink WHERE pid=%d;",
326 rid, rid, rid
327 );
328 blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC");
329 db_prepare(&q, "%s", blob_sql_text(&sql));
330 www_print_timeline(&q, TIMELINE_DISJOINT|TIMELINE_GRAPH, 0, 0, rid, 0);
331 db_finalize(&q);
332 }
333
334
335 /*
336 ** Append the difference between artifacts to the output
337 */
@@ -664,11 +687,12 @@
687 }else{
688 style_header("Check-in Information");
689 login_anonymous_available();
690 }
691 db_finalize(&q1);
692 showTags(rid);
693 showContext(rid);
694 @ <div class="section">Changes</div>
695 @ <div class="sectionmenu">
696 verboseFlag = g.zPath[0]!='c';
697 if( db_get_boolean("show-version-diffs", 0)==0 ){
698 verboseFlag = !verboseFlag;
699

Keyboard Shortcuts

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