Overview
SHA1 Hash: | e631d8af6d653275aa8c99b82daf783aae426f01 |
---|---|
Date: | 2009-01-21 18:42:19 |
User: | drh |
Comment: | Improvements to the timeline when displaying check-ins with a given tag. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/branch.c from [ccb39ffef0] to [dc15e48baa].
@@ -221,21 +221,20 @@ ** to the end of the line. */ static void brlist_extra(int rid){ Stmt q; db_prepare(&q, - "SELECT tagname, tagxref.tagid FROM tagxref, tag" + "SELECT substr(tagname,5) FROM tagxref, tag" " WHERE tagxref.rid=%d" " AND tagxref.tagid=tag.tagid" " AND tagxref.tagtype>0" " AND tag.tagname GLOB 'sym-*'", rid ); while( db_step(&q)==SQLITE_ROW ){ const char *zTagName = db_column_text(&q, 0); - int tagid = db_column_int(&q, 1); - @ [<a href="%s(g.zBaseURL)/timeline?t=%d(tagid)">%h(&zTagName[4])</a>] + @ [<a href="%s(g.zBaseURL)/timeline?t=%T(zTagName)">%h(zTagName)</a>] } db_finalize(&q); } /*
Modified src/info.c from [f65e70f125] to [e44bb517cc].
@@ -385,18 +385,17 @@ Stmt q; @ <tr><th>Timelines:</th><td> @ <a href="%s(g.zBaseURL)/timeline?p=%d(rid)">ancestors</a> @ | <a href="%s(g.zBaseURL)/timeline?d=%d(rid)">descendants</a> @ | <a href="%s(g.zBaseURL)/timeline?d=%d(rid)&p=%d(rid)">both</a> - db_prepare(&q, "SELECT tag.tagid, tag.tagname FROM tagxref, tag " + db_prepare(&q, "SELECT substr(tag.tagname,5) FROM tagxref, tag " " WHERE rid=%d AND tagtype>0 " " AND tag.tagid=tagxref.tagid " " AND +tag.tagname GLOB 'sym-*'", rid); while( db_step(&q)==SQLITE_ROW ){ - int tagid = db_column_int(&q, 0); - const char *zTagName = db_column_text(&q, 1); - @ | <a href="%s(g.zBaseURL)/timeline?t=%d(tagid)">%h(&zTagName[4])</a> + const char *zTagName = db_column_text(&q, 0); + @ | <a href="%s(g.zBaseURL)/timeline?t=%T(zTagName)">%h(zTagName)</a> } db_finalize(&q); @ </td></tr> @ <tr><th>Commands:</th> @ <td>
Modified src/timeline.c from [a47960c40e] to [fed5b9a0d2].
@@ -306,21 +306,27 @@ Blob sql; /* text of SQL used to generate timeline */ Blob desc; /* Description of the timeline */ int nEntry = atoi(PD("n","20")); /* Max number of entries on timeline */ int p_rid = atoi(PD("p","0")); /* artifact p and its parents */ int d_rid = atoi(PD("d","0")); /* artifact d and its descendants */ - int tagid = atoi(PD("t","0")); /* Show checkins of a given tag */ const char *zUser = P("u"); /* All entries by this user if not NULL */ const char *zType = PD("y","all"); /* Type of events. All if NULL */ const char *zAfter = P("a"); /* Events after this time */ const char *zBefore = P("b"); /* Events before this time */ + const char *zTagName = P("t"); /* Show events with this tag */ HQuery url; /* URL for various branch links */ + int tagid; /* Tag ID */ /* To view the timeline, must have permission to read project data. */ login_check_credentials(); if( !g.okRead ){ login_needed(); return; } + if( zTagName ){ + tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'", zTagName); + }else{ + tagid = 0; + } style_header("Timeline"); login_anonymous_available(); timeline_temp_table(); blob_zero(&sql); @@ -362,29 +368,24 @@ blob_appendf(&desc, " of <a href='%s/info/%s'>[%.10s]</a>", g.zBaseURL, zUuid, zUuid); }else{ blob_appendf(&desc, " of [%.10s]", zUuid); } - }else if( tagid>0 ){ - /* If t= is present, ignore all other parameters. Show everything - ** with that tag. */ - blob_appendf(&sql, " AND event.type='ci'"); - blob_appendf(&sql, " AND EXISTS (SELECT 1 FROM tagxref WHERE tagid=%d" - " AND tagtype>0 AND rid=blob.rid)", - tagid); - db_multi_exec("%s", blob_str(&sql)); - blob_appendf(&desc, "All check-ins tagged with \"%h\"", - db_text("??", "SELECT substr(tagname,5) FROM tag WHERE tagid=%d", - tagid) - ); }else{ int n; const char *zEType = "event"; char *zDate; char *zNEntry = mprintf("%d", nEntry); url_initialize(&url, "timeline"); url_add_parameter(&url, "n", zNEntry); + if( tagid>0 ){ + zType = "ci"; + url_add_parameter(&url, "t", zTagName); + blob_appendf(&sql, " AND EXISTS (SELECT 1 FROM tagxref WHERE tagid=%d" + " AND tagtype>0 AND rid=blob.rid)", + tagid); + } if( zType[0]!='a' ){ blob_appendf(&sql, " AND event.type=%Q", zType); url_add_parameter(&url, "y", zType); if( zType[0]=='c' ){ zEType = "checkin"; @@ -435,10 +436,13 @@ blob_appendf(&desc, "%d %ss", n, zEType); } if( zUser ){ blob_appendf(&desc, " by user %h", zUser); } + if( tagid>0 ){ + blob_appendf(&desc, " tagged with \"%h\"", zTagName); + } if( zAfter ){ blob_appendf(&desc, " occurring on or after %h.<br>", zAfter); }else if( zBefore ){ blob_appendf(&desc, " occurring on or before %h.<br>", zBefore); } @@ -450,11 +454,11 @@ } if( zBefore || (zAfter && n==nEntry) ){ zDate = db_text(0, "SELECT max(timestamp) FROM timeline"); timeline_submenu(&url, "Newer", "a", zDate, "b"); free(zDate); - }else{ + }else if( tagid==0 ){ if( zType[0]!='a' ){ timeline_submenu(&url, "All Types", "y", "all", 0); } if( zType[0]!='w' ){ timeline_submenu(&url, "Wiki Only", "y", "w", 0);