Fossil SCM

Make option -n|--limit of "fossil timeline" now specify the number of entries, just like all other commands which have the -n|--limit option. Suggested by Martin Gagnon.

jan.nijtmans 2013-10-30 08:42 UTC trunk merge
Commit 6e4e16fb8c0568bc83258b1990ade15c7e7cca37
--- src/descendants.c
+++ src/descendants.c
@@ -329,11 +329,11 @@
329329
"%s"
330330
" AND event.objid IN (SELECT rid FROM leaves)"
331331
" ORDER BY event.mtime DESC",
332332
timeline_query_for_tty()
333333
);
334
- print_timeline(&q, 20, 79, 0);
334
+ print_timeline(&q, -20, 79, 0);
335335
db_finalize(&q);
336336
}
337337
338338
/*
339339
** COMMAND: leaves*
340340
--- src/descendants.c
+++ src/descendants.c
@@ -329,11 +329,11 @@
329 "%s"
330 " AND event.objid IN (SELECT rid FROM leaves)"
331 " ORDER BY event.mtime DESC",
332 timeline_query_for_tty()
333 );
334 print_timeline(&q, 20, 79, 0);
335 db_finalize(&q);
336 }
337
338 /*
339 ** COMMAND: leaves*
340
--- src/descendants.c
+++ src/descendants.c
@@ -329,11 +329,11 @@
329 "%s"
330 " AND event.objid IN (SELECT rid FROM leaves)"
331 " ORDER BY event.mtime DESC",
332 timeline_query_for_tty()
333 );
334 print_timeline(&q, -20, 79, 0);
335 db_finalize(&q);
336 }
337
338 /*
339 ** COMMAND: leaves*
340
+1 -1
--- src/finfo.c
+++ src/finfo.c
@@ -43,11 +43,11 @@
4343
** Options:
4444
** -b|--brief display a brief (one line / revision) summary
4545
** --case-sensitive B Enable or disable case-sensitive filenames. B is a
4646
** boolean: "yes", "no", "true", "false", etc.
4747
** -l|--log select log mode (the default)
48
-** -n|--limit N display the first N changes
48
+** -n|--limit N display the first N changes. N=0 means no limit.
4949
** --offset P skip P changes
5050
** -p|--print select print mode
5151
** -r|--revision R print the given revision (or ckout, if none is given)
5252
** to stdout (only in print mode)
5353
** -s|--status select status mode (print a status indicator for FILE)
5454
--- src/finfo.c
+++ src/finfo.c
@@ -43,11 +43,11 @@
43 ** Options:
44 ** -b|--brief display a brief (one line / revision) summary
45 ** --case-sensitive B Enable or disable case-sensitive filenames. B is a
46 ** boolean: "yes", "no", "true", "false", etc.
47 ** -l|--log select log mode (the default)
48 ** -n|--limit N display the first N changes
49 ** --offset P skip P changes
50 ** -p|--print select print mode
51 ** -r|--revision R print the given revision (or ckout, if none is given)
52 ** to stdout (only in print mode)
53 ** -s|--status select status mode (print a status indicator for FILE)
54
--- src/finfo.c
+++ src/finfo.c
@@ -43,11 +43,11 @@
43 ** Options:
44 ** -b|--brief display a brief (one line / revision) summary
45 ** --case-sensitive B Enable or disable case-sensitive filenames. B is a
46 ** boolean: "yes", "no", "true", "false", etc.
47 ** -l|--log select log mode (the default)
48 ** -n|--limit N display the first N changes. N=0 means no limit.
49 ** --offset P skip P changes
50 ** -p|--print select print mode
51 ** -r|--revision R print the given revision (or ckout, if none is given)
52 ** to stdout (only in print mode)
53 ** -s|--status select status mode (print a status indicator for FILE)
54
+1 -1
--- src/finfo.c
+++ src/finfo.c
@@ -43,11 +43,11 @@
4343
** Options:
4444
** -b|--brief display a brief (one line / revision) summary
4545
** --case-sensitive B Enable or disable case-sensitive filenames. B is a
4646
** boolean: "yes", "no", "true", "false", etc.
4747
** -l|--log select log mode (the default)
48
-** -n|--limit N display the first N changes
48
+** -n|--limit N display the first N changes. N=0 means no limit.
4949
** --offset P skip P changes
5050
** -p|--print select print mode
5151
** -r|--revision R print the given revision (or ckout, if none is given)
5252
** to stdout (only in print mode)
5353
** -s|--status select status mode (print a status indicator for FILE)
5454
--- src/finfo.c
+++ src/finfo.c
@@ -43,11 +43,11 @@
43 ** Options:
44 ** -b|--brief display a brief (one line / revision) summary
45 ** --case-sensitive B Enable or disable case-sensitive filenames. B is a
46 ** boolean: "yes", "no", "true", "false", etc.
47 ** -l|--log select log mode (the default)
48 ** -n|--limit N display the first N changes
49 ** --offset P skip P changes
50 ** -p|--print select print mode
51 ** -r|--revision R print the given revision (or ckout, if none is given)
52 ** to stdout (only in print mode)
53 ** -s|--status select status mode (print a status indicator for FILE)
54
--- src/finfo.c
+++ src/finfo.c
@@ -43,11 +43,11 @@
43 ** Options:
44 ** -b|--brief display a brief (one line / revision) summary
45 ** --case-sensitive B Enable or disable case-sensitive filenames. B is a
46 ** boolean: "yes", "no", "true", "false", etc.
47 ** -l|--log select log mode (the default)
48 ** -n|--limit N display the first N changes. N=0 means no limit.
49 ** --offset P skip P changes
50 ** -p|--print select print mode
51 ** -r|--revision R print the given revision (or ckout, if none is given)
52 ** to stdout (only in print mode)
53 ** -s|--status select status mode (print a status indicator for FILE)
54
+3 -6
--- src/search.c
+++ src/search.c
@@ -189,12 +189,12 @@
189189
int iBest;
190190
char fAll = NULL != find_option("all", "a", 0); /* If set, do not lop
191191
off the end of the
192192
results. */
193193
char const * zLimit = find_option("limit","n",1);
194
- int const nLimit = zLimit ? atoi(zLimit) : -1; /* Max number of entries
195
- to list */
194
+ int nLimit = zLimit ? atoi(zLimit) : -1000; /* Max number of matching
195
+ lines/entries to list */
196196
197197
db_must_be_within_tree();
198198
if( g.argc<2 ) return;
199199
blob_init(&pattern, g.argv[2], -1);
200200
for(i=3; i<g.argc; i++){
@@ -220,13 +220,10 @@
220220
"WHERE 1 ", -1);
221221
if(!fAll){
222222
blob_appendf(&sql,"AND x>%d ", iBest/3);
223223
}
224224
blob_append(&sql, "ORDER BY x DESC, date DESC ", -1);
225
- if(nLimit>0){
226
- blob_appendf(&sql, "LIMIT %d", nLimit);
227
- }
228225
db_prepare(&q, blob_str(&sql));
229226
blob_reset(&sql);
230
- print_timeline(&q, 1000, 79, 0);
227
+ print_timeline(&q, nLimit, 79, 0);
231228
db_finalize(&q);
232229
}
233230
--- src/search.c
+++ src/search.c
@@ -189,12 +189,12 @@
189 int iBest;
190 char fAll = NULL != find_option("all", "a", 0); /* If set, do not lop
191 off the end of the
192 results. */
193 char const * zLimit = find_option("limit","n",1);
194 int const nLimit = zLimit ? atoi(zLimit) : -1; /* Max number of entries
195 to list */
196
197 db_must_be_within_tree();
198 if( g.argc<2 ) return;
199 blob_init(&pattern, g.argv[2], -1);
200 for(i=3; i<g.argc; i++){
@@ -220,13 +220,10 @@
220 "WHERE 1 ", -1);
221 if(!fAll){
222 blob_appendf(&sql,"AND x>%d ", iBest/3);
223 }
224 blob_append(&sql, "ORDER BY x DESC, date DESC ", -1);
225 if(nLimit>0){
226 blob_appendf(&sql, "LIMIT %d", nLimit);
227 }
228 db_prepare(&q, blob_str(&sql));
229 blob_reset(&sql);
230 print_timeline(&q, 1000, 79, 0);
231 db_finalize(&q);
232 }
233
--- src/search.c
+++ src/search.c
@@ -189,12 +189,12 @@
189 int iBest;
190 char fAll = NULL != find_option("all", "a", 0); /* If set, do not lop
191 off the end of the
192 results. */
193 char const * zLimit = find_option("limit","n",1);
194 int nLimit = zLimit ? atoi(zLimit) : -1000; /* Max number of matching
195 lines/entries to list */
196
197 db_must_be_within_tree();
198 if( g.argc<2 ) return;
199 blob_init(&pattern, g.argv[2], -1);
200 for(i=3; i<g.argc; i++){
@@ -220,13 +220,10 @@
220 "WHERE 1 ", -1);
221 if(!fAll){
222 blob_appendf(&sql,"AND x>%d ", iBest/3);
223 }
224 blob_append(&sql, "ORDER BY x DESC, date DESC ", -1);
 
 
 
225 db_prepare(&q, blob_str(&sql));
226 blob_reset(&sql);
227 print_timeline(&q, nLimit, 79, 0);
228 db_finalize(&q);
229 }
230
+2 -5
--- src/tag.c
+++ src/tag.c
@@ -389,11 +389,11 @@
389389
int n;
390390
int fRaw = find_option("raw","",0)!=0;
391391
int fPropagate = find_option("propagate","",0)!=0;
392392
const char *zPrefix = fRaw ? "" : "sym-";
393393
char const * zFindLimit = find_option("limit","n",1);
394
- int const nFindLimit = zFindLimit ? atoi(zFindLimit) : 0;
394
+ int const nFindLimit = zFindLimit ? atoi(zFindLimit) : -2000;
395395
396396
db_find_and_open_repository(0, 0);
397397
if( g.argc<3 ){
398398
goto tag_cmd_usage;
399399
}
@@ -467,16 +467,13 @@
467467
" WHERE tagtype>0 AND tagid=%d"
468468
")"
469469
" ORDER BY event.mtime DESC",
470470
timeline_query_for_tty(), zType, tagid
471471
);
472
- if( nFindLimit>0 ){
473
- blob_appendf(&sql, " LIMIT %d", nFindLimit);
474
- }
475472
db_prepare(&q, "%s", blob_str(&sql));
476473
blob_reset(&sql);
477
- print_timeline(&q, 2000, 79, 0);
474
+ print_timeline(&q, nFindLimit, 79, 0);
478475
db_finalize(&q);
479476
}
480477
}
481478
}else
482479
483480
--- src/tag.c
+++ src/tag.c
@@ -389,11 +389,11 @@
389 int n;
390 int fRaw = find_option("raw","",0)!=0;
391 int fPropagate = find_option("propagate","",0)!=0;
392 const char *zPrefix = fRaw ? "" : "sym-";
393 char const * zFindLimit = find_option("limit","n",1);
394 int const nFindLimit = zFindLimit ? atoi(zFindLimit) : 0;
395
396 db_find_and_open_repository(0, 0);
397 if( g.argc<3 ){
398 goto tag_cmd_usage;
399 }
@@ -467,16 +467,13 @@
467 " WHERE tagtype>0 AND tagid=%d"
468 ")"
469 " ORDER BY event.mtime DESC",
470 timeline_query_for_tty(), zType, tagid
471 );
472 if( nFindLimit>0 ){
473 blob_appendf(&sql, " LIMIT %d", nFindLimit);
474 }
475 db_prepare(&q, "%s", blob_str(&sql));
476 blob_reset(&sql);
477 print_timeline(&q, 2000, 79, 0);
478 db_finalize(&q);
479 }
480 }
481 }else
482
483
--- src/tag.c
+++ src/tag.c
@@ -389,11 +389,11 @@
389 int n;
390 int fRaw = find_option("raw","",0)!=0;
391 int fPropagate = find_option("propagate","",0)!=0;
392 const char *zPrefix = fRaw ? "" : "sym-";
393 char const * zFindLimit = find_option("limit","n",1);
394 int const nFindLimit = zFindLimit ? atoi(zFindLimit) : -2000;
395
396 db_find_and_open_repository(0, 0);
397 if( g.argc<3 ){
398 goto tag_cmd_usage;
399 }
@@ -467,16 +467,13 @@
467 " WHERE tagtype>0 AND tagid=%d"
468 ")"
469 " ORDER BY event.mtime DESC",
470 timeline_query_for_tty(), zType, tagid
471 );
 
 
 
472 db_prepare(&q, "%s", blob_str(&sql));
473 blob_reset(&sql);
474 print_timeline(&q, nFindLimit, 79, 0);
475 db_finalize(&q);
476 }
477 }
478 }else
479
480
+25 -9
--- src/timeline.c
+++ src/timeline.c
@@ -1494,14 +1494,17 @@
14941494
14951495
/*
14961496
** The input query q selects various records. Print a human-readable
14971497
** summary of those records.
14981498
**
1499
-** Limit the number of lines printed to mxLine. If mxLine is zero or
1500
-** negative there is no limit. The line limit is approximate because
1501
-** it is only checked on a per-entry basis. In verbose mode, the file
1502
-** name details are considered to be part of the entry.
1499
+** Limit number of lines or entries printed to nLimit. If nLimit is zero
1500
+** there is no limit. If nLimit is greater than zero, limit the number of
1501
+** complete entries printed. If nLimit is less than zero, attempt to limit
1502
+** the number of lines printed (this is basically the legacy behavior).
1503
+** The line limit, if used, is approximate because it is only checked on a
1504
+** per-entry basis. If verbose mode, the file name details are considered
1505
+** to be part of the entry.
15031506
**
15041507
** The query should return these columns:
15051508
**
15061509
** 0. rid
15071510
** 1. uuid
@@ -1510,12 +1513,14 @@
15101513
** 4. Number of non-merge children
15111514
** 5. Number of parents
15121515
** 6. mtime
15131516
** 7. branch
15141517
*/
1515
-void print_timeline(Stmt *q, int mxLine, int width, int verboseFlag){
1518
+void print_timeline(Stmt *q, int nLimit, int width, int verboseFlag){
1519
+ int nAbsLimit = (nLimit >= 0) ? nLimit : -nLimit;
15161520
int nLine = 0;
1521
+ int nEntry = 0;
15171522
char zPrevDate[20];
15181523
const char *zCurrentUuid=0;
15191524
int fchngQueryInit = 0; /* True if fchngQuery is initialized */
15201525
Stmt fchngQuery; /* Query for file changes on check-ins */
15211526
zPrevDate[0] = 0;
@@ -1523,11 +1528,11 @@
15231528
if( g.localOpen ){
15241529
int rid = db_lget_int("checkout", 0);
15251530
zCurrentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
15261531
}
15271532
1528
- while( db_step(q)==SQLITE_ROW && (mxLine<=0 || nLine<=mxLine) ){
1533
+ while( db_step(q)==SQLITE_ROW ){
15291534
int rid = db_column_int(q, 0);
15301535
const char *zId = db_column_text(q, 1);
15311536
const char *zDate = db_column_text(q, 2);
15321537
const char *zCom = db_column_text(q, 3);
15331538
int nChild = db_column_int(q, 4);
@@ -1535,10 +1540,19 @@
15351540
char *zFree = 0;
15361541
int n = 0;
15371542
char zPrefix[80];
15381543
char zUuid[UUID_SIZE+1];
15391544
1545
+ if( nAbsLimit!=0 ){
1546
+ if( nLimit<0 && nLine>=nAbsLimit ){
1547
+ fossil_print("=== line limit (%d) reached ===\n", nAbsLimit);
1548
+ break; /* line count limit hit, stop. */
1549
+ }else if( nEntry>=nAbsLimit ){
1550
+ fossil_print("=== entry limit (%d) reached ===\n", nAbsLimit);
1551
+ break; /* entry count limit hit, stop. */
1552
+ }
1553
+ }
15401554
sqlite3_snprintf(sizeof(zUuid), zUuid, "%.10s", zId);
15411555
if( memcmp(zDate, zPrevDate, 10) ){
15421556
fossil_print("=== %.10s ===\n", zDate);
15431557
memcpy(zPrevDate, zDate, 10);
15441558
nLine++; /* record another line */
@@ -1596,10 +1610,11 @@
15961610
}
15971611
nLine++; /* record another line */
15981612
}
15991613
db_reset(&fchngQuery);
16001614
}
1615
+ nEntry++; /* record another complete entry */
16011616
}
16021617
if( fchngQueryInit ) db_finalize(&fchngQuery);
16031618
}
16041619
16051620
/*
@@ -1666,11 +1681,12 @@
16661681
** The DATETIME should be in the ISO8601 format. For
16671682
** examples: "2007-08-18 07:21:21". You can also say "current"
16681683
** for the current version or "now" for the current time.
16691684
**
16701685
** Options:
1671
-** -n|--limit N Output the first N changes (default 20)
1686
+** -n|--limit N Output the first N entries (default 20 lines).
1687
+** N=0 means no limit.
16721688
** -t|--type TYPE Output items from the given types only, such as:
16731689
** ci = file commits only
16741690
** e = events only
16751691
** t = tickets only
16761692
** w = wiki commits only
@@ -1704,11 +1720,11 @@
17041720
zLimit = find_option("count",0,1);
17051721
}
17061722
if( zLimit ){
17071723
n = atoi(zLimit);
17081724
}else{
1709
- n = 20;
1725
+ n = -20;
17101726
}
17111727
if( zWidth ){
17121728
width = atoi(zWidth);
17131729
if( (width!=0) && (width<=20) ){
17141730
fossil_fatal("--width|-W value must be >20 or 0");
@@ -1729,11 +1745,11 @@
17291745
}else if( strncmp(g.argv[2],"ancestors",k)==0 && k>1 ){
17301746
mode = 4;
17311747
}else if( strncmp(g.argv[2],"parents",k)==0 ){
17321748
mode = 4;
17331749
}else if(!zType && !zLimit){
1734
- usage("?WHEN? ?BASELINE|DATETIME? ?-n|--limit N? ?-t|--type TYPE? ?-W|--width WIDTH?");
1750
+ usage("?WHEN? ?BASELINE|DATETIME? ?-n|--limit #? ?-t|--type TYPE? ?-W|--width WIDTH?");
17351751
}
17361752
if( '-' != *g.argv[3] ){
17371753
zOrigin = g.argv[3];
17381754
}else{
17391755
zOrigin = "now";
17401756
--- src/timeline.c
+++ src/timeline.c
@@ -1494,14 +1494,17 @@
1494
1495 /*
1496 ** The input query q selects various records. Print a human-readable
1497 ** summary of those records.
1498 **
1499 ** Limit the number of lines printed to mxLine. If mxLine is zero or
1500 ** negative there is no limit. The line limit is approximate because
1501 ** it is only checked on a per-entry basis. In verbose mode, the file
1502 ** name details are considered to be part of the entry.
 
 
 
1503 **
1504 ** The query should return these columns:
1505 **
1506 ** 0. rid
1507 ** 1. uuid
@@ -1510,12 +1513,14 @@
1510 ** 4. Number of non-merge children
1511 ** 5. Number of parents
1512 ** 6. mtime
1513 ** 7. branch
1514 */
1515 void print_timeline(Stmt *q, int mxLine, int width, int verboseFlag){
 
1516 int nLine = 0;
 
1517 char zPrevDate[20];
1518 const char *zCurrentUuid=0;
1519 int fchngQueryInit = 0; /* True if fchngQuery is initialized */
1520 Stmt fchngQuery; /* Query for file changes on check-ins */
1521 zPrevDate[0] = 0;
@@ -1523,11 +1528,11 @@
1523 if( g.localOpen ){
1524 int rid = db_lget_int("checkout", 0);
1525 zCurrentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1526 }
1527
1528 while( db_step(q)==SQLITE_ROW && (mxLine<=0 || nLine<=mxLine) ){
1529 int rid = db_column_int(q, 0);
1530 const char *zId = db_column_text(q, 1);
1531 const char *zDate = db_column_text(q, 2);
1532 const char *zCom = db_column_text(q, 3);
1533 int nChild = db_column_int(q, 4);
@@ -1535,10 +1540,19 @@
1535 char *zFree = 0;
1536 int n = 0;
1537 char zPrefix[80];
1538 char zUuid[UUID_SIZE+1];
1539
 
 
 
 
 
 
 
 
 
1540 sqlite3_snprintf(sizeof(zUuid), zUuid, "%.10s", zId);
1541 if( memcmp(zDate, zPrevDate, 10) ){
1542 fossil_print("=== %.10s ===\n", zDate);
1543 memcpy(zPrevDate, zDate, 10);
1544 nLine++; /* record another line */
@@ -1596,10 +1610,11 @@
1596 }
1597 nLine++; /* record another line */
1598 }
1599 db_reset(&fchngQuery);
1600 }
 
1601 }
1602 if( fchngQueryInit ) db_finalize(&fchngQuery);
1603 }
1604
1605 /*
@@ -1666,11 +1681,12 @@
1666 ** The DATETIME should be in the ISO8601 format. For
1667 ** examples: "2007-08-18 07:21:21". You can also say "current"
1668 ** for the current version or "now" for the current time.
1669 **
1670 ** Options:
1671 ** -n|--limit N Output the first N changes (default 20)
 
1672 ** -t|--type TYPE Output items from the given types only, such as:
1673 ** ci = file commits only
1674 ** e = events only
1675 ** t = tickets only
1676 ** w = wiki commits only
@@ -1704,11 +1720,11 @@
1704 zLimit = find_option("count",0,1);
1705 }
1706 if( zLimit ){
1707 n = atoi(zLimit);
1708 }else{
1709 n = 20;
1710 }
1711 if( zWidth ){
1712 width = atoi(zWidth);
1713 if( (width!=0) && (width<=20) ){
1714 fossil_fatal("--width|-W value must be >20 or 0");
@@ -1729,11 +1745,11 @@
1729 }else if( strncmp(g.argv[2],"ancestors",k)==0 && k>1 ){
1730 mode = 4;
1731 }else if( strncmp(g.argv[2],"parents",k)==0 ){
1732 mode = 4;
1733 }else if(!zType && !zLimit){
1734 usage("?WHEN? ?BASELINE|DATETIME? ?-n|--limit N? ?-t|--type TYPE? ?-W|--width WIDTH?");
1735 }
1736 if( '-' != *g.argv[3] ){
1737 zOrigin = g.argv[3];
1738 }else{
1739 zOrigin = "now";
1740
--- src/timeline.c
+++ src/timeline.c
@@ -1494,14 +1494,17 @@
1494
1495 /*
1496 ** The input query q selects various records. Print a human-readable
1497 ** summary of those records.
1498 **
1499 ** Limit number of lines or entries printed to nLimit. If nLimit is zero
1500 ** there is no limit. If nLimit is greater than zero, limit the number of
1501 ** complete entries printed. If nLimit is less than zero, attempt to limit
1502 ** the number of lines printed (this is basically the legacy behavior).
1503 ** The line limit, if used, is approximate because it is only checked on a
1504 ** per-entry basis. If verbose mode, the file name details are considered
1505 ** to be part of the entry.
1506 **
1507 ** The query should return these columns:
1508 **
1509 ** 0. rid
1510 ** 1. uuid
@@ -1510,12 +1513,14 @@
1513 ** 4. Number of non-merge children
1514 ** 5. Number of parents
1515 ** 6. mtime
1516 ** 7. branch
1517 */
1518 void print_timeline(Stmt *q, int nLimit, int width, int verboseFlag){
1519 int nAbsLimit = (nLimit >= 0) ? nLimit : -nLimit;
1520 int nLine = 0;
1521 int nEntry = 0;
1522 char zPrevDate[20];
1523 const char *zCurrentUuid=0;
1524 int fchngQueryInit = 0; /* True if fchngQuery is initialized */
1525 Stmt fchngQuery; /* Query for file changes on check-ins */
1526 zPrevDate[0] = 0;
@@ -1523,11 +1528,11 @@
1528 if( g.localOpen ){
1529 int rid = db_lget_int("checkout", 0);
1530 zCurrentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1531 }
1532
1533 while( db_step(q)==SQLITE_ROW ){
1534 int rid = db_column_int(q, 0);
1535 const char *zId = db_column_text(q, 1);
1536 const char *zDate = db_column_text(q, 2);
1537 const char *zCom = db_column_text(q, 3);
1538 int nChild = db_column_int(q, 4);
@@ -1535,10 +1540,19 @@
1540 char *zFree = 0;
1541 int n = 0;
1542 char zPrefix[80];
1543 char zUuid[UUID_SIZE+1];
1544
1545 if( nAbsLimit!=0 ){
1546 if( nLimit<0 && nLine>=nAbsLimit ){
1547 fossil_print("=== line limit (%d) reached ===\n", nAbsLimit);
1548 break; /* line count limit hit, stop. */
1549 }else if( nEntry>=nAbsLimit ){
1550 fossil_print("=== entry limit (%d) reached ===\n", nAbsLimit);
1551 break; /* entry count limit hit, stop. */
1552 }
1553 }
1554 sqlite3_snprintf(sizeof(zUuid), zUuid, "%.10s", zId);
1555 if( memcmp(zDate, zPrevDate, 10) ){
1556 fossil_print("=== %.10s ===\n", zDate);
1557 memcpy(zPrevDate, zDate, 10);
1558 nLine++; /* record another line */
@@ -1596,10 +1610,11 @@
1610 }
1611 nLine++; /* record another line */
1612 }
1613 db_reset(&fchngQuery);
1614 }
1615 nEntry++; /* record another complete entry */
1616 }
1617 if( fchngQueryInit ) db_finalize(&fchngQuery);
1618 }
1619
1620 /*
@@ -1666,11 +1681,12 @@
1681 ** The DATETIME should be in the ISO8601 format. For
1682 ** examples: "2007-08-18 07:21:21". You can also say "current"
1683 ** for the current version or "now" for the current time.
1684 **
1685 ** Options:
1686 ** -n|--limit N Output the first N entries (default 20 lines).
1687 ** N=0 means no limit.
1688 ** -t|--type TYPE Output items from the given types only, such as:
1689 ** ci = file commits only
1690 ** e = events only
1691 ** t = tickets only
1692 ** w = wiki commits only
@@ -1704,11 +1720,11 @@
1720 zLimit = find_option("count",0,1);
1721 }
1722 if( zLimit ){
1723 n = atoi(zLimit);
1724 }else{
1725 n = -20;
1726 }
1727 if( zWidth ){
1728 width = atoi(zWidth);
1729 if( (width!=0) && (width<=20) ){
1730 fossil_fatal("--width|-W value must be >20 or 0");
@@ -1729,11 +1745,11 @@
1745 }else if( strncmp(g.argv[2],"ancestors",k)==0 && k>1 ){
1746 mode = 4;
1747 }else if( strncmp(g.argv[2],"parents",k)==0 ){
1748 mode = 4;
1749 }else if(!zType && !zLimit){
1750 usage("?WHEN? ?BASELINE|DATETIME? ?-n|--limit #? ?-t|--type TYPE? ?-W|--width WIDTH?");
1751 }
1752 if( '-' != *g.argv[3] ){
1753 zOrigin = g.argv[3];
1754 }else{
1755 zOrigin = "now";
1756
+25 -9
--- src/timeline.c
+++ src/timeline.c
@@ -1494,14 +1494,17 @@
14941494
14951495
/*
14961496
** The input query q selects various records. Print a human-readable
14971497
** summary of those records.
14981498
**
1499
-** Limit the number of lines printed to mxLine. If mxLine is zero or
1500
-** negative there is no limit. The line limit is approximate because
1501
-** it is only checked on a per-entry basis. In verbose mode, the file
1502
-** name details are considered to be part of the entry.
1499
+** Limit number of lines or entries printed to nLimit. If nLimit is zero
1500
+** there is no limit. If nLimit is greater than zero, limit the number of
1501
+** complete entries printed. If nLimit is less than zero, attempt to limit
1502
+** the number of lines printed (this is basically the legacy behavior).
1503
+** The line limit, if used, is approximate because it is only checked on a
1504
+** per-entry basis. If verbose mode, the file name details are considered
1505
+** to be part of the entry.
15031506
**
15041507
** The query should return these columns:
15051508
**
15061509
** 0. rid
15071510
** 1. uuid
@@ -1510,12 +1513,14 @@
15101513
** 4. Number of non-merge children
15111514
** 5. Number of parents
15121515
** 6. mtime
15131516
** 7. branch
15141517
*/
1515
-void print_timeline(Stmt *q, int mxLine, int width, int verboseFlag){
1518
+void print_timeline(Stmt *q, int nLimit, int width, int verboseFlag){
1519
+ int nAbsLimit = (nLimit >= 0) ? nLimit : -nLimit;
15161520
int nLine = 0;
1521
+ int nEntry = 0;
15171522
char zPrevDate[20];
15181523
const char *zCurrentUuid=0;
15191524
int fchngQueryInit = 0; /* True if fchngQuery is initialized */
15201525
Stmt fchngQuery; /* Query for file changes on check-ins */
15211526
zPrevDate[0] = 0;
@@ -1523,11 +1528,11 @@
15231528
if( g.localOpen ){
15241529
int rid = db_lget_int("checkout", 0);
15251530
zCurrentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
15261531
}
15271532
1528
- while( db_step(q)==SQLITE_ROW && (mxLine<=0 || nLine<=mxLine) ){
1533
+ while( db_step(q)==SQLITE_ROW ){
15291534
int rid = db_column_int(q, 0);
15301535
const char *zId = db_column_text(q, 1);
15311536
const char *zDate = db_column_text(q, 2);
15321537
const char *zCom = db_column_text(q, 3);
15331538
int nChild = db_column_int(q, 4);
@@ -1535,10 +1540,19 @@
15351540
char *zFree = 0;
15361541
int n = 0;
15371542
char zPrefix[80];
15381543
char zUuid[UUID_SIZE+1];
15391544
1545
+ if( nAbsLimit!=0 ){
1546
+ if( nLimit<0 && nLine>=nAbsLimit ){
1547
+ fossil_print("=== line limit (%d) reached ===\n", nAbsLimit);
1548
+ break; /* line count limit hit, stop. */
1549
+ }else if( nEntry>=nAbsLimit ){
1550
+ fossil_print("=== entry limit (%d) reached ===\n", nAbsLimit);
1551
+ break; /* entry count limit hit, stop. */
1552
+ }
1553
+ }
15401554
sqlite3_snprintf(sizeof(zUuid), zUuid, "%.10s", zId);
15411555
if( memcmp(zDate, zPrevDate, 10) ){
15421556
fossil_print("=== %.10s ===\n", zDate);
15431557
memcpy(zPrevDate, zDate, 10);
15441558
nLine++; /* record another line */
@@ -1596,10 +1610,11 @@
15961610
}
15971611
nLine++; /* record another line */
15981612
}
15991613
db_reset(&fchngQuery);
16001614
}
1615
+ nEntry++; /* record another complete entry */
16011616
}
16021617
if( fchngQueryInit ) db_finalize(&fchngQuery);
16031618
}
16041619
16051620
/*
@@ -1666,11 +1681,12 @@
16661681
** The DATETIME should be in the ISO8601 format. For
16671682
** examples: "2007-08-18 07:21:21". You can also say "current"
16681683
** for the current version or "now" for the current time.
16691684
**
16701685
** Options:
1671
-** -n|--limit N Output the first N changes (default 20)
1686
+** -n|--limit N Output the first N entries (default 20 lines).
1687
+** N=0 means no limit.
16721688
** -t|--type TYPE Output items from the given types only, such as:
16731689
** ci = file commits only
16741690
** e = events only
16751691
** t = tickets only
16761692
** w = wiki commits only
@@ -1704,11 +1720,11 @@
17041720
zLimit = find_option("count",0,1);
17051721
}
17061722
if( zLimit ){
17071723
n = atoi(zLimit);
17081724
}else{
1709
- n = 20;
1725
+ n = -20;
17101726
}
17111727
if( zWidth ){
17121728
width = atoi(zWidth);
17131729
if( (width!=0) && (width<=20) ){
17141730
fossil_fatal("--width|-W value must be >20 or 0");
@@ -1729,11 +1745,11 @@
17291745
}else if( strncmp(g.argv[2],"ancestors",k)==0 && k>1 ){
17301746
mode = 4;
17311747
}else if( strncmp(g.argv[2],"parents",k)==0 ){
17321748
mode = 4;
17331749
}else if(!zType && !zLimit){
1734
- usage("?WHEN? ?BASELINE|DATETIME? ?-n|--limit N? ?-t|--type TYPE? ?-W|--width WIDTH?");
1750
+ usage("?WHEN? ?BASELINE|DATETIME? ?-n|--limit #? ?-t|--type TYPE? ?-W|--width WIDTH?");
17351751
}
17361752
if( '-' != *g.argv[3] ){
17371753
zOrigin = g.argv[3];
17381754
}else{
17391755
zOrigin = "now";
17401756
--- src/timeline.c
+++ src/timeline.c
@@ -1494,14 +1494,17 @@
1494
1495 /*
1496 ** The input query q selects various records. Print a human-readable
1497 ** summary of those records.
1498 **
1499 ** Limit the number of lines printed to mxLine. If mxLine is zero or
1500 ** negative there is no limit. The line limit is approximate because
1501 ** it is only checked on a per-entry basis. In verbose mode, the file
1502 ** name details are considered to be part of the entry.
 
 
 
1503 **
1504 ** The query should return these columns:
1505 **
1506 ** 0. rid
1507 ** 1. uuid
@@ -1510,12 +1513,14 @@
1510 ** 4. Number of non-merge children
1511 ** 5. Number of parents
1512 ** 6. mtime
1513 ** 7. branch
1514 */
1515 void print_timeline(Stmt *q, int mxLine, int width, int verboseFlag){
 
1516 int nLine = 0;
 
1517 char zPrevDate[20];
1518 const char *zCurrentUuid=0;
1519 int fchngQueryInit = 0; /* True if fchngQuery is initialized */
1520 Stmt fchngQuery; /* Query for file changes on check-ins */
1521 zPrevDate[0] = 0;
@@ -1523,11 +1528,11 @@
1523 if( g.localOpen ){
1524 int rid = db_lget_int("checkout", 0);
1525 zCurrentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1526 }
1527
1528 while( db_step(q)==SQLITE_ROW && (mxLine<=0 || nLine<=mxLine) ){
1529 int rid = db_column_int(q, 0);
1530 const char *zId = db_column_text(q, 1);
1531 const char *zDate = db_column_text(q, 2);
1532 const char *zCom = db_column_text(q, 3);
1533 int nChild = db_column_int(q, 4);
@@ -1535,10 +1540,19 @@
1535 char *zFree = 0;
1536 int n = 0;
1537 char zPrefix[80];
1538 char zUuid[UUID_SIZE+1];
1539
 
 
 
 
 
 
 
 
 
1540 sqlite3_snprintf(sizeof(zUuid), zUuid, "%.10s", zId);
1541 if( memcmp(zDate, zPrevDate, 10) ){
1542 fossil_print("=== %.10s ===\n", zDate);
1543 memcpy(zPrevDate, zDate, 10);
1544 nLine++; /* record another line */
@@ -1596,10 +1610,11 @@
1596 }
1597 nLine++; /* record another line */
1598 }
1599 db_reset(&fchngQuery);
1600 }
 
1601 }
1602 if( fchngQueryInit ) db_finalize(&fchngQuery);
1603 }
1604
1605 /*
@@ -1666,11 +1681,12 @@
1666 ** The DATETIME should be in the ISO8601 format. For
1667 ** examples: "2007-08-18 07:21:21". You can also say "current"
1668 ** for the current version or "now" for the current time.
1669 **
1670 ** Options:
1671 ** -n|--limit N Output the first N changes (default 20)
 
1672 ** -t|--type TYPE Output items from the given types only, such as:
1673 ** ci = file commits only
1674 ** e = events only
1675 ** t = tickets only
1676 ** w = wiki commits only
@@ -1704,11 +1720,11 @@
1704 zLimit = find_option("count",0,1);
1705 }
1706 if( zLimit ){
1707 n = atoi(zLimit);
1708 }else{
1709 n = 20;
1710 }
1711 if( zWidth ){
1712 width = atoi(zWidth);
1713 if( (width!=0) && (width<=20) ){
1714 fossil_fatal("--width|-W value must be >20 or 0");
@@ -1729,11 +1745,11 @@
1729 }else if( strncmp(g.argv[2],"ancestors",k)==0 && k>1 ){
1730 mode = 4;
1731 }else if( strncmp(g.argv[2],"parents",k)==0 ){
1732 mode = 4;
1733 }else if(!zType && !zLimit){
1734 usage("?WHEN? ?BASELINE|DATETIME? ?-n|--limit N? ?-t|--type TYPE? ?-W|--width WIDTH?");
1735 }
1736 if( '-' != *g.argv[3] ){
1737 zOrigin = g.argv[3];
1738 }else{
1739 zOrigin = "now";
1740
--- src/timeline.c
+++ src/timeline.c
@@ -1494,14 +1494,17 @@
1494
1495 /*
1496 ** The input query q selects various records. Print a human-readable
1497 ** summary of those records.
1498 **
1499 ** Limit number of lines or entries printed to nLimit. If nLimit is zero
1500 ** there is no limit. If nLimit is greater than zero, limit the number of
1501 ** complete entries printed. If nLimit is less than zero, attempt to limit
1502 ** the number of lines printed (this is basically the legacy behavior).
1503 ** The line limit, if used, is approximate because it is only checked on a
1504 ** per-entry basis. If verbose mode, the file name details are considered
1505 ** to be part of the entry.
1506 **
1507 ** The query should return these columns:
1508 **
1509 ** 0. rid
1510 ** 1. uuid
@@ -1510,12 +1513,14 @@
1513 ** 4. Number of non-merge children
1514 ** 5. Number of parents
1515 ** 6. mtime
1516 ** 7. branch
1517 */
1518 void print_timeline(Stmt *q, int nLimit, int width, int verboseFlag){
1519 int nAbsLimit = (nLimit >= 0) ? nLimit : -nLimit;
1520 int nLine = 0;
1521 int nEntry = 0;
1522 char zPrevDate[20];
1523 const char *zCurrentUuid=0;
1524 int fchngQueryInit = 0; /* True if fchngQuery is initialized */
1525 Stmt fchngQuery; /* Query for file changes on check-ins */
1526 zPrevDate[0] = 0;
@@ -1523,11 +1528,11 @@
1528 if( g.localOpen ){
1529 int rid = db_lget_int("checkout", 0);
1530 zCurrentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1531 }
1532
1533 while( db_step(q)==SQLITE_ROW ){
1534 int rid = db_column_int(q, 0);
1535 const char *zId = db_column_text(q, 1);
1536 const char *zDate = db_column_text(q, 2);
1537 const char *zCom = db_column_text(q, 3);
1538 int nChild = db_column_int(q, 4);
@@ -1535,10 +1540,19 @@
1540 char *zFree = 0;
1541 int n = 0;
1542 char zPrefix[80];
1543 char zUuid[UUID_SIZE+1];
1544
1545 if( nAbsLimit!=0 ){
1546 if( nLimit<0 && nLine>=nAbsLimit ){
1547 fossil_print("=== line limit (%d) reached ===\n", nAbsLimit);
1548 break; /* line count limit hit, stop. */
1549 }else if( nEntry>=nAbsLimit ){
1550 fossil_print("=== entry limit (%d) reached ===\n", nAbsLimit);
1551 break; /* entry count limit hit, stop. */
1552 }
1553 }
1554 sqlite3_snprintf(sizeof(zUuid), zUuid, "%.10s", zId);
1555 if( memcmp(zDate, zPrevDate, 10) ){
1556 fossil_print("=== %.10s ===\n", zDate);
1557 memcpy(zPrevDate, zDate, 10);
1558 nLine++; /* record another line */
@@ -1596,10 +1610,11 @@
1610 }
1611 nLine++; /* record another line */
1612 }
1613 db_reset(&fchngQuery);
1614 }
1615 nEntry++; /* record another complete entry */
1616 }
1617 if( fchngQueryInit ) db_finalize(&fchngQuery);
1618 }
1619
1620 /*
@@ -1666,11 +1681,12 @@
1681 ** The DATETIME should be in the ISO8601 format. For
1682 ** examples: "2007-08-18 07:21:21". You can also say "current"
1683 ** for the current version or "now" for the current time.
1684 **
1685 ** Options:
1686 ** -n|--limit N Output the first N entries (default 20 lines).
1687 ** N=0 means no limit.
1688 ** -t|--type TYPE Output items from the given types only, such as:
1689 ** ci = file commits only
1690 ** e = events only
1691 ** t = tickets only
1692 ** w = wiki commits only
@@ -1704,11 +1720,11 @@
1720 zLimit = find_option("count",0,1);
1721 }
1722 if( zLimit ){
1723 n = atoi(zLimit);
1724 }else{
1725 n = -20;
1726 }
1727 if( zWidth ){
1728 width = atoi(zWidth);
1729 if( (width!=0) && (width<=20) ){
1730 fossil_fatal("--width|-W value must be >20 or 0");
@@ -1729,11 +1745,11 @@
1745 }else if( strncmp(g.argv[2],"ancestors",k)==0 && k>1 ){
1746 mode = 4;
1747 }else if( strncmp(g.argv[2],"parents",k)==0 ){
1748 mode = 4;
1749 }else if(!zType && !zLimit){
1750 usage("?WHEN? ?BASELINE|DATETIME? ?-n|--limit #? ?-t|--type TYPE? ?-W|--width WIDTH?");
1751 }
1752 if( '-' != *g.argv[3] ){
1753 zOrigin = g.argv[3];
1754 }else{
1755 zOrigin = "now";
1756
+1 -1
--- src/update.c
+++ src/update.c
@@ -188,11 +188,11 @@
188188
"%s "
189189
" AND event.objid IN leaves"
190190
" ORDER BY event.mtime DESC",
191191
timeline_query_for_tty()
192192
);
193
- print_timeline(&q, 100, 79, 0);
193
+ print_timeline(&q, -100, 79, 0);
194194
db_finalize(&q);
195195
fossil_fatal("Multiple descendants");
196196
}
197197
}
198198
tid = db_int(0, "SELECT rid FROM leaves, event"
199199
--- src/update.c
+++ src/update.c
@@ -188,11 +188,11 @@
188 "%s "
189 " AND event.objid IN leaves"
190 " ORDER BY event.mtime DESC",
191 timeline_query_for_tty()
192 );
193 print_timeline(&q, 100, 79, 0);
194 db_finalize(&q);
195 fossil_fatal("Multiple descendants");
196 }
197 }
198 tid = db_int(0, "SELECT rid FROM leaves, event"
199
--- src/update.c
+++ src/update.c
@@ -188,11 +188,11 @@
188 "%s "
189 " AND event.objid IN leaves"
190 " ORDER BY event.mtime DESC",
191 timeline_query_for_tty()
192 );
193 print_timeline(&q, -100, 79, 0);
194 db_finalize(&q);
195 fossil_fatal("Multiple descendants");
196 }
197 }
198 tid = db_int(0, "SELECT rid FROM leaves, event"
199
--- www/changes.wiki
+++ www/changes.wiki
@@ -20,10 +20,15 @@
2020
"[/help?cmd=clean | fossil clean]" command.
2121
* Ten-fold performance improvement in large "fossil blame" or
2222
"fossil annotate" commands.
2323
* Add option -W|--width to the "[/help?cmd=timeline | fossil timeline]"
2424
and "[/help?cmd=finfo | fossil finfo]" commands.
25
+ * Option -n|--limit of "[/help?cmd=timeline | fossil timeline]" now
26
+ specifies the number of entries, just like all other commands which
27
+ have the -n|--limit option. The various timeline-related functions
28
+ now output "=== ?? limit (??) reached ===" at the end whenever
29
+ appropriate. Use "-n 0" if no limit is desired.
2530
2631
<h2>Changes For Version 1.27 (2013-09-11)</h2>
2732
* Enhance the [/help?cmd=changes | fossil changes],
2833
[/help?cmd=clean | fossil clean], [/help?cmd=extras | fossil extras],
2934
[/help?cmd=ls | fossil ls] and [/help?cmd=status | fossil status] commands
3035
--- www/changes.wiki
+++ www/changes.wiki
@@ -20,10 +20,15 @@
20 "[/help?cmd=clean | fossil clean]" command.
21 * Ten-fold performance improvement in large "fossil blame" or
22 "fossil annotate" commands.
23 * Add option -W|--width to the "[/help?cmd=timeline | fossil timeline]"
24 and "[/help?cmd=finfo | fossil finfo]" commands.
 
 
 
 
 
25
26 <h2>Changes For Version 1.27 (2013-09-11)</h2>
27 * Enhance the [/help?cmd=changes | fossil changes],
28 [/help?cmd=clean | fossil clean], [/help?cmd=extras | fossil extras],
29 [/help?cmd=ls | fossil ls] and [/help?cmd=status | fossil status] commands
30
--- www/changes.wiki
+++ www/changes.wiki
@@ -20,10 +20,15 @@
20 "[/help?cmd=clean | fossil clean]" command.
21 * Ten-fold performance improvement in large "fossil blame" or
22 "fossil annotate" commands.
23 * Add option -W|--width to the "[/help?cmd=timeline | fossil timeline]"
24 and "[/help?cmd=finfo | fossil finfo]" commands.
25 * Option -n|--limit of "[/help?cmd=timeline | fossil timeline]" now
26 specifies the number of entries, just like all other commands which
27 have the -n|--limit option. The various timeline-related functions
28 now output "=== ?? limit (??) reached ===" at the end whenever
29 appropriate. Use "-n 0" if no limit is desired.
30
31 <h2>Changes For Version 1.27 (2013-09-11)</h2>
32 * Enhance the [/help?cmd=changes | fossil changes],
33 [/help?cmd=clean | fossil clean], [/help?cmd=extras | fossil extras],
34 [/help?cmd=ls | fossil ls] and [/help?cmd=status | fossil status] commands
35
--- www/changes.wiki
+++ www/changes.wiki
@@ -20,10 +20,15 @@
2020
"[/help?cmd=clean | fossil clean]" command.
2121
* Ten-fold performance improvement in large "fossil blame" or
2222
"fossil annotate" commands.
2323
* Add option -W|--width to the "[/help?cmd=timeline | fossil timeline]"
2424
and "[/help?cmd=finfo | fossil finfo]" commands.
25
+ * Option -n|--limit of "[/help?cmd=timeline | fossil timeline]" now
26
+ specifies the number of entries, just like all other commands which
27
+ have the -n|--limit option. The various timeline-related functions
28
+ now output "=== ?? limit (??) reached ===" at the end whenever
29
+ appropriate. Use "-n 0" if no limit is desired.
2530
2631
<h2>Changes For Version 1.27 (2013-09-11)</h2>
2732
* Enhance the [/help?cmd=changes | fossil changes],
2833
[/help?cmd=clean | fossil clean], [/help?cmd=extras | fossil extras],
2934
[/help?cmd=ls | fossil ls] and [/help?cmd=status | fossil status] commands
3035
--- www/changes.wiki
+++ www/changes.wiki
@@ -20,10 +20,15 @@
20 "[/help?cmd=clean | fossil clean]" command.
21 * Ten-fold performance improvement in large "fossil blame" or
22 "fossil annotate" commands.
23 * Add option -W|--width to the "[/help?cmd=timeline | fossil timeline]"
24 and "[/help?cmd=finfo | fossil finfo]" commands.
 
 
 
 
 
25
26 <h2>Changes For Version 1.27 (2013-09-11)</h2>
27 * Enhance the [/help?cmd=changes | fossil changes],
28 [/help?cmd=clean | fossil clean], [/help?cmd=extras | fossil extras],
29 [/help?cmd=ls | fossil ls] and [/help?cmd=status | fossil status] commands
30
--- www/changes.wiki
+++ www/changes.wiki
@@ -20,10 +20,15 @@
20 "[/help?cmd=clean | fossil clean]" command.
21 * Ten-fold performance improvement in large "fossil blame" or
22 "fossil annotate" commands.
23 * Add option -W|--width to the "[/help?cmd=timeline | fossil timeline]"
24 and "[/help?cmd=finfo | fossil finfo]" commands.
25 * Option -n|--limit of "[/help?cmd=timeline | fossil timeline]" now
26 specifies the number of entries, just like all other commands which
27 have the -n|--limit option. The various timeline-related functions
28 now output "=== ?? limit (??) reached ===" at the end whenever
29 appropriate. Use "-n 0" if no limit is desired.
30
31 <h2>Changes For Version 1.27 (2013-09-11)</h2>
32 * Enhance the [/help?cmd=changes | fossil changes],
33 [/help?cmd=clean | fossil clean], [/help?cmd=extras | fossil extras],
34 [/help?cmd=ls | fossil ls] and [/help?cmd=status | fossil status] commands
35

Keyboard Shortcuts

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