Fossil SCM

Fix timeline_query_for_tty() function (Oops....)

jan.nijtmans 2013-12-28 22:49 UTC pending-review
Commit 108548b28c356410171c5d87e4e87b8aa4ffce41
1 file changed +6 -2
+6 -2
--- src/timeline.c
+++ src/timeline.c
@@ -1675,15 +1675,16 @@
16751675
/*
16761676
** Return a pointer to a static string that forms the basis for
16771677
** a timeline query for display on a TTY.
16781678
*/
16791679
const char *timeline_query_for_tty(void){
1680
+ static const char *zBase = 0;
16801681
static const char zBaseSql[] =
16811682
@ SELECT
16821683
@ blob.rid AS rid,
16831684
@ uuid,
1684
- @ datetime(event.mtime%s(timeline_utc())) AS mDateTime,
1685
+ @ datetime(event.mtime%s) AS mDateTime,
16851686
@ coalesce(ecomment,comment)
16861687
@ || ' (user: ' || coalesce(euser,user,'?')
16871688
@ || (SELECT case when length(x)>0 then ' tags: ' || x else '' end
16881689
@ FROM (SELECT group_concat(substr(tagname,5), ', ') AS x
16891690
@ FROM tag, tagxref
@@ -1700,11 +1701,14 @@
17001701
@ AND tagxref.tagtype>0
17011702
@ AND tagxref.rid=blob.rid
17021703
@ WHERE blob.rid=event.objid
17031704
@ AND tag.tagname='branch'
17041705
;
1705
- return zBaseSql;
1706
+ if( zBase==0 ){
1707
+ zBase = mprintf(zBaseSql, timeline_utc());
1708
+ }
1709
+ return zBase;
17061710
}
17071711
17081712
/*
17091713
** Return true if the input string is a date in the ISO 8601 format:
17101714
** YYYY-MM-DD.
17111715
--- src/timeline.c
+++ src/timeline.c
@@ -1675,15 +1675,16 @@
1675 /*
1676 ** Return a pointer to a static string that forms the basis for
1677 ** a timeline query for display on a TTY.
1678 */
1679 const char *timeline_query_for_tty(void){
 
1680 static const char zBaseSql[] =
1681 @ SELECT
1682 @ blob.rid AS rid,
1683 @ uuid,
1684 @ datetime(event.mtime%s(timeline_utc())) AS mDateTime,
1685 @ coalesce(ecomment,comment)
1686 @ || ' (user: ' || coalesce(euser,user,'?')
1687 @ || (SELECT case when length(x)>0 then ' tags: ' || x else '' end
1688 @ FROM (SELECT group_concat(substr(tagname,5), ', ') AS x
1689 @ FROM tag, tagxref
@@ -1700,11 +1701,14 @@
1700 @ AND tagxref.tagtype>0
1701 @ AND tagxref.rid=blob.rid
1702 @ WHERE blob.rid=event.objid
1703 @ AND tag.tagname='branch'
1704 ;
1705 return zBaseSql;
 
 
 
1706 }
1707
1708 /*
1709 ** Return true if the input string is a date in the ISO 8601 format:
1710 ** YYYY-MM-DD.
1711
--- src/timeline.c
+++ src/timeline.c
@@ -1675,15 +1675,16 @@
1675 /*
1676 ** Return a pointer to a static string that forms the basis for
1677 ** a timeline query for display on a TTY.
1678 */
1679 const char *timeline_query_for_tty(void){
1680 static const char *zBase = 0;
1681 static const char zBaseSql[] =
1682 @ SELECT
1683 @ blob.rid AS rid,
1684 @ uuid,
1685 @ datetime(event.mtime%s) AS mDateTime,
1686 @ coalesce(ecomment,comment)
1687 @ || ' (user: ' || coalesce(euser,user,'?')
1688 @ || (SELECT case when length(x)>0 then ' tags: ' || x else '' end
1689 @ FROM (SELECT group_concat(substr(tagname,5), ', ') AS x
1690 @ FROM tag, tagxref
@@ -1700,11 +1701,14 @@
1701 @ AND tagxref.tagtype>0
1702 @ AND tagxref.rid=blob.rid
1703 @ WHERE blob.rid=event.objid
1704 @ AND tag.tagname='branch'
1705 ;
1706 if( zBase==0 ){
1707 zBase = mprintf(zBaseSql, timeline_utc());
1708 }
1709 return zBase;
1710 }
1711
1712 /*
1713 ** Return true if the input string is a date in the ISO 8601 format:
1714 ** YYYY-MM-DD.
1715

Keyboard Shortcuts

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