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>.
Commit
eee36897b637ea8bac8923bfc63c78d04f874a5bd2fbc8f963d28deb3196c16b
Parent
271a6bd31d5087f…
1 file changed
+9
+9
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -3740,15 +3740,24 @@ | ||
| 3740 | 3740 | } |
| 3741 | 3741 | } |
| 3742 | 3742 | |
| 3743 | 3743 | if( mode==TIMELINE_MODE_NONE ) mode = TIMELINE_MODE_BEFORE; |
| 3744 | 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 | + } | |
| 3745 | 3749 | blob_append(&sql, timeline_query_for_tty(), -1); |
| 3746 | 3750 | blob_append_sql(&sql, "\n AND event.mtime %s %s", |
| 3747 | 3751 | ( mode==TIMELINE_MODE_BEFORE || |
| 3748 | 3752 | mode==TIMELINE_MODE_PARENTS ) ? "<=" : ">=", zDate /*safe-for-%s*/ |
| 3749 | 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 | + } | |
| 3750 | 3759 | |
| 3751 | 3760 | /* When zFilePattern is specified, compute complete ancestry; |
| 3752 | 3761 | * limit later at print_timeline() */ |
| 3753 | 3762 | if( mode==TIMELINE_MODE_CHILDREN || mode==TIMELINE_MODE_PARENTS ){ |
| 3754 | 3763 | db_multi_exec("CREATE TEMP TABLE ok(rid INTEGER PRIMARY KEY)"); |
| 3755 | 3764 |
| --- 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 |