Fossil SCM

Fix the use of the "after" WHEN keyword for the fossil timeline command. "fossil timeline after <checkin|date>" when used with "-n N" was showing the N most recent checkins regardless the specified <checking|date> instead of the N checking following the specified <checkin|date>.

mgagnon 2025-04-02 23:31 trunk
Commit eee36897b637ea8bac8923bfc63c78d04f874a5bd2fbc8f963d28deb3196c16b
1 file changed +9
--- src/timeline.c
+++ src/timeline.c
@@ -3740,15 +3740,24 @@
37403740
}
37413741
}
37423742
37433743
if( mode==TIMELINE_MODE_NONE ) mode = TIMELINE_MODE_BEFORE;
37443744
blob_zero(&sql);
3745
+ if( mode==TIMELINE_MODE_AFTER ){
3746
+ /* Extra outer select to get older rows in reverse order */
3747
+ blob_append(&sql, "SELECT *\nFROM (", -1);
3748
+ }
37453749
blob_append(&sql, timeline_query_for_tty(), -1);
37463750
blob_append_sql(&sql, "\n AND event.mtime %s %s",
37473751
( mode==TIMELINE_MODE_BEFORE ||
37483752
mode==TIMELINE_MODE_PARENTS ) ? "<=" : ">=", zDate /*safe-for-%s*/
37493753
);
3754
+ if( mode==TIMELINE_MODE_AFTER ){
3755
+ /* Complete the outer above outer select. */
3756
+ blob_append_sql(&sql,
3757
+ "\nORDER BY event.mtime LIMIT %d) t ORDER BY t.mDateTime DESC;", n);
3758
+ }
37503759
37513760
/* When zFilePattern is specified, compute complete ancestry;
37523761
* limit later at print_timeline() */
37533762
if( mode==TIMELINE_MODE_CHILDREN || mode==TIMELINE_MODE_PARENTS ){
37543763
db_multi_exec("CREATE TEMP TABLE ok(rid INTEGER PRIMARY KEY)");
37553764
--- src/timeline.c
+++ src/timeline.c
@@ -3740,15 +3740,24 @@
3740 }
3741 }
3742
3743 if( mode==TIMELINE_MODE_NONE ) mode = TIMELINE_MODE_BEFORE;
3744 blob_zero(&sql);
 
 
 
 
3745 blob_append(&sql, timeline_query_for_tty(), -1);
3746 blob_append_sql(&sql, "\n AND event.mtime %s %s",
3747 ( mode==TIMELINE_MODE_BEFORE ||
3748 mode==TIMELINE_MODE_PARENTS ) ? "<=" : ">=", zDate /*safe-for-%s*/
3749 );
 
 
 
 
 
3750
3751 /* When zFilePattern is specified, compute complete ancestry;
3752 * limit later at print_timeline() */
3753 if( mode==TIMELINE_MODE_CHILDREN || mode==TIMELINE_MODE_PARENTS ){
3754 db_multi_exec("CREATE TEMP TABLE ok(rid INTEGER PRIMARY KEY)");
3755
--- src/timeline.c
+++ src/timeline.c
@@ -3740,15 +3740,24 @@
3740 }
3741 }
3742
3743 if( mode==TIMELINE_MODE_NONE ) mode = TIMELINE_MODE_BEFORE;
3744 blob_zero(&sql);
3745 if( mode==TIMELINE_MODE_AFTER ){
3746 /* Extra outer select to get older rows in reverse order */
3747 blob_append(&sql, "SELECT *\nFROM (", -1);
3748 }
3749 blob_append(&sql, timeline_query_for_tty(), -1);
3750 blob_append_sql(&sql, "\n AND event.mtime %s %s",
3751 ( mode==TIMELINE_MODE_BEFORE ||
3752 mode==TIMELINE_MODE_PARENTS ) ? "<=" : ">=", zDate /*safe-for-%s*/
3753 );
3754 if( mode==TIMELINE_MODE_AFTER ){
3755 /* Complete the outer above outer select. */
3756 blob_append_sql(&sql,
3757 "\nORDER BY event.mtime LIMIT %d) t ORDER BY t.mDateTime DESC;", n);
3758 }
3759
3760 /* When zFilePattern is specified, compute complete ancestry;
3761 * limit later at print_timeline() */
3762 if( mode==TIMELINE_MODE_CHILDREN || mode==TIMELINE_MODE_PARENTS ){
3763 db_multi_exec("CREATE TEMP TABLE ok(rid INTEGER PRIMARY KEY)");
3764

Keyboard Shortcuts

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