Fossil SCM

Fix timeline -n 0 to display an unlimited number of lines (rather than zero) to match documentation. Correct timeline -n for negative N documentation to match actual behavior. Limit compute_ancestors() and compute_descendants() on the assumption that there is no more than one entry per line.

andygoth 2016-11-15 00:30 trunk
Commit def9af43a3921234fe6d1a5dce0d31a201698c0d
2 files changed +14 -4 +3 -2
--- src/descendants.c
+++ src/descendants.c
@@ -158,14 +158,19 @@
158158
);
159159
}
160160
}
161161
162162
/*
163
-** Load the record ID rid and up to N-1 closest ancestors into
164
-** the "ok" table.
163
+** Load the record ID rid and up to |N|-1 closest ancestors into
164
+** the "ok" table. If N is zero, no limit.
165165
*/
166166
void compute_ancestors(int rid, int N, int directOnly){
167
+ if( !N ){
168
+ N = -1;
169
+ }else if( N<0 ){
170
+ N = -N;
171
+ }
167172
db_multi_exec(
168173
"WITH RECURSIVE "
169174
" ancestor(rid, mtime) AS ("
170175
" SELECT %d, mtime FROM event WHERE objid=%d "
171176
" UNION "
@@ -236,14 +241,19 @@
236241
db_reset(&q);
237242
return 0;
238243
}
239244
240245
/*
241
-** Load the record ID rid and up to N-1 closest descendants into
242
-** the "ok" table.
246
+** Load the record ID rid and up to |N|-1 closest descendants into
247
+** the "ok" table. If N is zero, no limit.
243248
*/
244249
void compute_descendants(int rid, int N){
250
+ if( !N ){
251
+ N = -1;
252
+ }else if( N<0 ){
253
+ N = -N;
254
+ }
245255
db_multi_exec(
246256
"WITH RECURSIVE"
247257
" dx(rid,mtime) AS ("
248258
" SELECT %d, 0"
249259
" UNION"
250260
--- src/descendants.c
+++ src/descendants.c
@@ -158,14 +158,19 @@
158 );
159 }
160 }
161
162 /*
163 ** Load the record ID rid and up to N-1 closest ancestors into
164 ** the "ok" table.
165 */
166 void compute_ancestors(int rid, int N, int directOnly){
 
 
 
 
 
167 db_multi_exec(
168 "WITH RECURSIVE "
169 " ancestor(rid, mtime) AS ("
170 " SELECT %d, mtime FROM event WHERE objid=%d "
171 " UNION "
@@ -236,14 +241,19 @@
236 db_reset(&q);
237 return 0;
238 }
239
240 /*
241 ** Load the record ID rid and up to N-1 closest descendants into
242 ** the "ok" table.
243 */
244 void compute_descendants(int rid, int N){
 
 
 
 
 
245 db_multi_exec(
246 "WITH RECURSIVE"
247 " dx(rid,mtime) AS ("
248 " SELECT %d, 0"
249 " UNION"
250
--- src/descendants.c
+++ src/descendants.c
@@ -158,14 +158,19 @@
158 );
159 }
160 }
161
162 /*
163 ** Load the record ID rid and up to |N|-1 closest ancestors into
164 ** the "ok" table. If N is zero, no limit.
165 */
166 void compute_ancestors(int rid, int N, int directOnly){
167 if( !N ){
168 N = -1;
169 }else if( N<0 ){
170 N = -N;
171 }
172 db_multi_exec(
173 "WITH RECURSIVE "
174 " ancestor(rid, mtime) AS ("
175 " SELECT %d, mtime FROM event WHERE objid=%d "
176 " UNION "
@@ -236,14 +241,19 @@
241 db_reset(&q);
242 return 0;
243 }
244
245 /*
246 ** Load the record ID rid and up to |N|-1 closest descendants into
247 ** the "ok" table. If N is zero, no limit.
248 */
249 void compute_descendants(int rid, int N){
250 if( !N ){
251 N = -1;
252 }else if( N<0 ){
253 N = -N;
254 }
255 db_multi_exec(
256 "WITH RECURSIVE"
257 " dx(rid,mtime) AS ("
258 " SELECT %d, 0"
259 " UNION"
260
+3 -2
--- src/timeline.c
+++ src/timeline.c
@@ -2335,12 +2335,13 @@
23352335
** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z"
23362336
** means UTC.
23372337
**
23382338
**
23392339
** Options:
2340
-** -n|--limit N Output the first N entries (default 20 lines).
2341
-** N=0 means no limit.
2340
+** -n|--limit N If N is positive, output the first N entries. If
2341
+** N is negative, output the first -N lines. If N is
2342
+** zero, no limit. Default is -20 meaning 20 lines.
23422343
** -p|--path PATH Output items affecting PATH only.
23432344
** PATH can be a file or a sub directory.
23442345
** --offset P skip P changes
23452346
** -t|--type TYPE Output items from the given types only, such as:
23462347
** ci = file commits only
23472348
--- src/timeline.c
+++ src/timeline.c
@@ -2335,12 +2335,13 @@
2335 ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z"
2336 ** means UTC.
2337 **
2338 **
2339 ** Options:
2340 ** -n|--limit N Output the first N entries (default 20 lines).
2341 ** N=0 means no limit.
 
2342 ** -p|--path PATH Output items affecting PATH only.
2343 ** PATH can be a file or a sub directory.
2344 ** --offset P skip P changes
2345 ** -t|--type TYPE Output items from the given types only, such as:
2346 ** ci = file commits only
2347
--- src/timeline.c
+++ src/timeline.c
@@ -2335,12 +2335,13 @@
2335 ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z"
2336 ** means UTC.
2337 **
2338 **
2339 ** Options:
2340 ** -n|--limit N If N is positive, output the first N entries. If
2341 ** N is negative, output the first -N lines. If N is
2342 ** zero, no limit. Default is -20 meaning 20 lines.
2343 ** -p|--path PATH Output items affecting PATH only.
2344 ** PATH can be a file or a sub directory.
2345 ** --offset P skip P changes
2346 ** -t|--type TYPE Output items from the given types only, such as:
2347 ** ci = file commits only
2348

Keyboard Shortcuts

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