Fossil SCM

Improvements to the timeline when displaying check-ins with a given tag.

drh 2009-01-21 18:42 trunk
Commit e631d8af6d653275aa8c99b82daf783aae426f01
3 files changed +2 -3 +3 -4 +18 -14
+2 -3
--- src/branch.c
+++ src/branch.c
@@ -221,21 +221,20 @@
221221
** to the end of the line.
222222
*/
223223
static void brlist_extra(int rid){
224224
Stmt q;
225225
db_prepare(&q,
226
- "SELECT tagname, tagxref.tagid FROM tagxref, tag"
226
+ "SELECT substr(tagname,5) FROM tagxref, tag"
227227
" WHERE tagxref.rid=%d"
228228
" AND tagxref.tagid=tag.tagid"
229229
" AND tagxref.tagtype>0"
230230
" AND tag.tagname GLOB 'sym-*'",
231231
rid
232232
);
233233
while( db_step(&q)==SQLITE_ROW ){
234234
const char *zTagName = db_column_text(&q, 0);
235
- int tagid = db_column_int(&q, 1);
236
- @ [<a href="%s(g.zBaseURL)/timeline?t=%d(tagid)">%h(&zTagName[4])</a>]
235
+ @ [<a href="%s(g.zBaseURL)/timeline?t=%T(zTagName)">%h(zTagName)</a>]
237236
}
238237
db_finalize(&q);
239238
}
240239
241240
/*
242241
--- src/branch.c
+++ src/branch.c
@@ -221,21 +221,20 @@
221 ** to the end of the line.
222 */
223 static void brlist_extra(int rid){
224 Stmt q;
225 db_prepare(&q,
226 "SELECT tagname, tagxref.tagid FROM tagxref, tag"
227 " WHERE tagxref.rid=%d"
228 " AND tagxref.tagid=tag.tagid"
229 " AND tagxref.tagtype>0"
230 " AND tag.tagname GLOB 'sym-*'",
231 rid
232 );
233 while( db_step(&q)==SQLITE_ROW ){
234 const char *zTagName = db_column_text(&q, 0);
235 int tagid = db_column_int(&q, 1);
236 @ [<a href="%s(g.zBaseURL)/timeline?t=%d(tagid)">%h(&zTagName[4])</a>]
237 }
238 db_finalize(&q);
239 }
240
241 /*
242
--- src/branch.c
+++ src/branch.c
@@ -221,21 +221,20 @@
221 ** to the end of the line.
222 */
223 static void brlist_extra(int rid){
224 Stmt q;
225 db_prepare(&q,
226 "SELECT substr(tagname,5) FROM tagxref, tag"
227 " WHERE tagxref.rid=%d"
228 " AND tagxref.tagid=tag.tagid"
229 " AND tagxref.tagtype>0"
230 " AND tag.tagname GLOB 'sym-*'",
231 rid
232 );
233 while( db_step(&q)==SQLITE_ROW ){
234 const char *zTagName = db_column_text(&q, 0);
235 @ [<a href="%s(g.zBaseURL)/timeline?t=%T(zTagName)">%h(zTagName)</a>]
 
236 }
237 db_finalize(&q);
238 }
239
240 /*
241
+3 -4
--- src/info.c
+++ src/info.c
@@ -385,18 +385,17 @@
385385
Stmt q;
386386
@ <tr><th>Timelines:</th><td>
387387
@ <a href="%s(g.zBaseURL)/timeline?p=%d(rid)">ancestors</a>
388388
@ | <a href="%s(g.zBaseURL)/timeline?d=%d(rid)">descendants</a>
389389
@ | <a href="%s(g.zBaseURL)/timeline?d=%d(rid)&p=%d(rid)">both</a>
390
- db_prepare(&q, "SELECT tag.tagid, tag.tagname FROM tagxref, tag "
390
+ db_prepare(&q, "SELECT substr(tag.tagname,5) FROM tagxref, tag "
391391
" WHERE rid=%d AND tagtype>0 "
392392
" AND tag.tagid=tagxref.tagid "
393393
" AND +tag.tagname GLOB 'sym-*'", rid);
394394
while( db_step(&q)==SQLITE_ROW ){
395
- int tagid = db_column_int(&q, 0);
396
- const char *zTagName = db_column_text(&q, 1);
397
- @ | <a href="%s(g.zBaseURL)/timeline?t=%d(tagid)">%h(&zTagName[4])</a>
395
+ const char *zTagName = db_column_text(&q, 0);
396
+ @ | <a href="%s(g.zBaseURL)/timeline?t=%T(zTagName)">%h(zTagName)</a>
398397
}
399398
db_finalize(&q);
400399
@ </td></tr>
401400
@ <tr><th>Commands:</th>
402401
@ <td>
403402
--- src/info.c
+++ src/info.c
@@ -385,18 +385,17 @@
385 Stmt q;
386 @ <tr><th>Timelines:</th><td>
387 @ <a href="%s(g.zBaseURL)/timeline?p=%d(rid)">ancestors</a>
388 @ | <a href="%s(g.zBaseURL)/timeline?d=%d(rid)">descendants</a>
389 @ | <a href="%s(g.zBaseURL)/timeline?d=%d(rid)&p=%d(rid)">both</a>
390 db_prepare(&q, "SELECT tag.tagid, tag.tagname FROM tagxref, tag "
391 " WHERE rid=%d AND tagtype>0 "
392 " AND tag.tagid=tagxref.tagid "
393 " AND +tag.tagname GLOB 'sym-*'", rid);
394 while( db_step(&q)==SQLITE_ROW ){
395 int tagid = db_column_int(&q, 0);
396 const char *zTagName = db_column_text(&q, 1);
397 @ | <a href="%s(g.zBaseURL)/timeline?t=%d(tagid)">%h(&zTagName[4])</a>
398 }
399 db_finalize(&q);
400 @ </td></tr>
401 @ <tr><th>Commands:</th>
402 @ <td>
403
--- src/info.c
+++ src/info.c
@@ -385,18 +385,17 @@
385 Stmt q;
386 @ <tr><th>Timelines:</th><td>
387 @ <a href="%s(g.zBaseURL)/timeline?p=%d(rid)">ancestors</a>
388 @ | <a href="%s(g.zBaseURL)/timeline?d=%d(rid)">descendants</a>
389 @ | <a href="%s(g.zBaseURL)/timeline?d=%d(rid)&p=%d(rid)">both</a>
390 db_prepare(&q, "SELECT substr(tag.tagname,5) FROM tagxref, tag "
391 " WHERE rid=%d AND tagtype>0 "
392 " AND tag.tagid=tagxref.tagid "
393 " AND +tag.tagname GLOB 'sym-*'", rid);
394 while( db_step(&q)==SQLITE_ROW ){
395 const char *zTagName = db_column_text(&q, 0);
396 @ | <a href="%s(g.zBaseURL)/timeline?t=%T(zTagName)">%h(zTagName)</a>
 
397 }
398 db_finalize(&q);
399 @ </td></tr>
400 @ <tr><th>Commands:</th>
401 @ <td>
402
+18 -14
--- src/timeline.c
+++ src/timeline.c
@@ -306,21 +306,27 @@
306306
Blob sql; /* text of SQL used to generate timeline */
307307
Blob desc; /* Description of the timeline */
308308
int nEntry = atoi(PD("n","20")); /* Max number of entries on timeline */
309309
int p_rid = atoi(PD("p","0")); /* artifact p and its parents */
310310
int d_rid = atoi(PD("d","0")); /* artifact d and its descendants */
311
- int tagid = atoi(PD("t","0")); /* Show checkins of a given tag */
312311
const char *zUser = P("u"); /* All entries by this user if not NULL */
313312
const char *zType = PD("y","all"); /* Type of events. All if NULL */
314313
const char *zAfter = P("a"); /* Events after this time */
315314
const char *zBefore = P("b"); /* Events before this time */
315
+ const char *zTagName = P("t"); /* Show events with this tag */
316316
HQuery url; /* URL for various branch links */
317
+ int tagid; /* Tag ID */
317318
318319
/* To view the timeline, must have permission to read project data.
319320
*/
320321
login_check_credentials();
321322
if( !g.okRead ){ login_needed(); return; }
323
+ if( zTagName ){
324
+ tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'", zTagName);
325
+ }else{
326
+ tagid = 0;
327
+ }
322328
323329
style_header("Timeline");
324330
login_anonymous_available();
325331
timeline_temp_table();
326332
blob_zero(&sql);
@@ -362,29 +368,24 @@
362368
blob_appendf(&desc, " of <a href='%s/info/%s'>[%.10s]</a>",
363369
g.zBaseURL, zUuid, zUuid);
364370
}else{
365371
blob_appendf(&desc, " of [%.10s]", zUuid);
366372
}
367
- }else if( tagid>0 ){
368
- /* If t= is present, ignore all other parameters. Show everything
369
- ** with that tag. */
370
- blob_appendf(&sql, " AND event.type='ci'");
371
- blob_appendf(&sql, " AND EXISTS (SELECT 1 FROM tagxref WHERE tagid=%d"
372
- " AND tagtype>0 AND rid=blob.rid)",
373
- tagid);
374
- db_multi_exec("%s", blob_str(&sql));
375
- blob_appendf(&desc, "All check-ins tagged with \"%h\"",
376
- db_text("??", "SELECT substr(tagname,5) FROM tag WHERE tagid=%d",
377
- tagid)
378
- );
379373
}else{
380374
int n;
381375
const char *zEType = "event";
382376
char *zDate;
383377
char *zNEntry = mprintf("%d", nEntry);
384378
url_initialize(&url, "timeline");
385379
url_add_parameter(&url, "n", zNEntry);
380
+ if( tagid>0 ){
381
+ zType = "ci";
382
+ url_add_parameter(&url, "t", zTagName);
383
+ blob_appendf(&sql, " AND EXISTS (SELECT 1 FROM tagxref WHERE tagid=%d"
384
+ " AND tagtype>0 AND rid=blob.rid)",
385
+ tagid);
386
+ }
386387
if( zType[0]!='a' ){
387388
blob_appendf(&sql, " AND event.type=%Q", zType);
388389
url_add_parameter(&url, "y", zType);
389390
if( zType[0]=='c' ){
390391
zEType = "checkin";
@@ -435,10 +436,13 @@
435436
blob_appendf(&desc, "%d %ss", n, zEType);
436437
}
437438
if( zUser ){
438439
blob_appendf(&desc, " by user %h", zUser);
439440
}
441
+ if( tagid>0 ){
442
+ blob_appendf(&desc, " tagged with \"%h\"", zTagName);
443
+ }
440444
if( zAfter ){
441445
blob_appendf(&desc, " occurring on or after %h.<br>", zAfter);
442446
}else if( zBefore ){
443447
blob_appendf(&desc, " occurring on or before %h.<br>", zBefore);
444448
}
@@ -450,11 +454,11 @@
450454
}
451455
if( zBefore || (zAfter && n==nEntry) ){
452456
zDate = db_text(0, "SELECT max(timestamp) FROM timeline");
453457
timeline_submenu(&url, "Newer", "a", zDate, "b");
454458
free(zDate);
455
- }else{
459
+ }else if( tagid==0 ){
456460
if( zType[0]!='a' ){
457461
timeline_submenu(&url, "All Types", "y", "all", 0);
458462
}
459463
if( zType[0]!='w' ){
460464
timeline_submenu(&url, "Wiki Only", "y", "w", 0);
461465
--- src/timeline.c
+++ src/timeline.c
@@ -306,21 +306,27 @@
306 Blob sql; /* text of SQL used to generate timeline */
307 Blob desc; /* Description of the timeline */
308 int nEntry = atoi(PD("n","20")); /* Max number of entries on timeline */
309 int p_rid = atoi(PD("p","0")); /* artifact p and its parents */
310 int d_rid = atoi(PD("d","0")); /* artifact d and its descendants */
311 int tagid = atoi(PD("t","0")); /* Show checkins of a given tag */
312 const char *zUser = P("u"); /* All entries by this user if not NULL */
313 const char *zType = PD("y","all"); /* Type of events. All if NULL */
314 const char *zAfter = P("a"); /* Events after this time */
315 const char *zBefore = P("b"); /* Events before this time */
 
316 HQuery url; /* URL for various branch links */
 
317
318 /* To view the timeline, must have permission to read project data.
319 */
320 login_check_credentials();
321 if( !g.okRead ){ login_needed(); return; }
 
 
 
 
 
322
323 style_header("Timeline");
324 login_anonymous_available();
325 timeline_temp_table();
326 blob_zero(&sql);
@@ -362,29 +368,24 @@
362 blob_appendf(&desc, " of <a href='%s/info/%s'>[%.10s]</a>",
363 g.zBaseURL, zUuid, zUuid);
364 }else{
365 blob_appendf(&desc, " of [%.10s]", zUuid);
366 }
367 }else if( tagid>0 ){
368 /* If t= is present, ignore all other parameters. Show everything
369 ** with that tag. */
370 blob_appendf(&sql, " AND event.type='ci'");
371 blob_appendf(&sql, " AND EXISTS (SELECT 1 FROM tagxref WHERE tagid=%d"
372 " AND tagtype>0 AND rid=blob.rid)",
373 tagid);
374 db_multi_exec("%s", blob_str(&sql));
375 blob_appendf(&desc, "All check-ins tagged with \"%h\"",
376 db_text("??", "SELECT substr(tagname,5) FROM tag WHERE tagid=%d",
377 tagid)
378 );
379 }else{
380 int n;
381 const char *zEType = "event";
382 char *zDate;
383 char *zNEntry = mprintf("%d", nEntry);
384 url_initialize(&url, "timeline");
385 url_add_parameter(&url, "n", zNEntry);
 
 
 
 
 
 
 
386 if( zType[0]!='a' ){
387 blob_appendf(&sql, " AND event.type=%Q", zType);
388 url_add_parameter(&url, "y", zType);
389 if( zType[0]=='c' ){
390 zEType = "checkin";
@@ -435,10 +436,13 @@
435 blob_appendf(&desc, "%d %ss", n, zEType);
436 }
437 if( zUser ){
438 blob_appendf(&desc, " by user %h", zUser);
439 }
 
 
 
440 if( zAfter ){
441 blob_appendf(&desc, " occurring on or after %h.<br>", zAfter);
442 }else if( zBefore ){
443 blob_appendf(&desc, " occurring on or before %h.<br>", zBefore);
444 }
@@ -450,11 +454,11 @@
450 }
451 if( zBefore || (zAfter && n==nEntry) ){
452 zDate = db_text(0, "SELECT max(timestamp) FROM timeline");
453 timeline_submenu(&url, "Newer", "a", zDate, "b");
454 free(zDate);
455 }else{
456 if( zType[0]!='a' ){
457 timeline_submenu(&url, "All Types", "y", "all", 0);
458 }
459 if( zType[0]!='w' ){
460 timeline_submenu(&url, "Wiki Only", "y", "w", 0);
461
--- src/timeline.c
+++ src/timeline.c
@@ -306,21 +306,27 @@
306 Blob sql; /* text of SQL used to generate timeline */
307 Blob desc; /* Description of the timeline */
308 int nEntry = atoi(PD("n","20")); /* Max number of entries on timeline */
309 int p_rid = atoi(PD("p","0")); /* artifact p and its parents */
310 int d_rid = atoi(PD("d","0")); /* artifact d and its descendants */
 
311 const char *zUser = P("u"); /* All entries by this user if not NULL */
312 const char *zType = PD("y","all"); /* Type of events. All if NULL */
313 const char *zAfter = P("a"); /* Events after this time */
314 const char *zBefore = P("b"); /* Events before this time */
315 const char *zTagName = P("t"); /* Show events with this tag */
316 HQuery url; /* URL for various branch links */
317 int tagid; /* Tag ID */
318
319 /* To view the timeline, must have permission to read project data.
320 */
321 login_check_credentials();
322 if( !g.okRead ){ login_needed(); return; }
323 if( zTagName ){
324 tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'", zTagName);
325 }else{
326 tagid = 0;
327 }
328
329 style_header("Timeline");
330 login_anonymous_available();
331 timeline_temp_table();
332 blob_zero(&sql);
@@ -362,29 +368,24 @@
368 blob_appendf(&desc, " of <a href='%s/info/%s'>[%.10s]</a>",
369 g.zBaseURL, zUuid, zUuid);
370 }else{
371 blob_appendf(&desc, " of [%.10s]", zUuid);
372 }
 
 
 
 
 
 
 
 
 
 
 
 
373 }else{
374 int n;
375 const char *zEType = "event";
376 char *zDate;
377 char *zNEntry = mprintf("%d", nEntry);
378 url_initialize(&url, "timeline");
379 url_add_parameter(&url, "n", zNEntry);
380 if( tagid>0 ){
381 zType = "ci";
382 url_add_parameter(&url, "t", zTagName);
383 blob_appendf(&sql, " AND EXISTS (SELECT 1 FROM tagxref WHERE tagid=%d"
384 " AND tagtype>0 AND rid=blob.rid)",
385 tagid);
386 }
387 if( zType[0]!='a' ){
388 blob_appendf(&sql, " AND event.type=%Q", zType);
389 url_add_parameter(&url, "y", zType);
390 if( zType[0]=='c' ){
391 zEType = "checkin";
@@ -435,10 +436,13 @@
436 blob_appendf(&desc, "%d %ss", n, zEType);
437 }
438 if( zUser ){
439 blob_appendf(&desc, " by user %h", zUser);
440 }
441 if( tagid>0 ){
442 blob_appendf(&desc, " tagged with \"%h\"", zTagName);
443 }
444 if( zAfter ){
445 blob_appendf(&desc, " occurring on or after %h.<br>", zAfter);
446 }else if( zBefore ){
447 blob_appendf(&desc, " occurring on or before %h.<br>", zBefore);
448 }
@@ -450,11 +454,11 @@
454 }
455 if( zBefore || (zAfter && n==nEntry) ){
456 zDate = db_text(0, "SELECT max(timestamp) FROM timeline");
457 timeline_submenu(&url, "Newer", "a", zDate, "b");
458 free(zDate);
459 }else if( tagid==0 ){
460 if( zType[0]!='a' ){
461 timeline_submenu(&url, "All Types", "y", "all", 0);
462 }
463 if( zType[0]!='w' ){
464 timeline_submenu(&url, "Wiki Only", "y", "w", 0);
465

Keyboard Shortcuts

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