Fossil SCM

Correctly determine whether the limit was really reached, this time without my mistake in [d54ada1cea] which didn't handle "-n 0" correctly.

jan.nijtmans 2013-10-22 07:41 UTC timeline_cmd_dash_n_fix
Commit feb175065c028d12e1ec3928ee4b224dd956cdd1
1 file changed +9 -8
+9 -8
--- src/timeline.c
+++ src/timeline.c
@@ -1540,10 +1540,19 @@
15401540
char *zFree = 0;
15411541
int n = 0;
15421542
char zPrefix[80];
15431543
char zUuid[UUID_SIZE+1];
15441544
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
+ }
15451554
sqlite3_snprintf(sizeof(zUuid), zUuid, "%.10s", zId);
15461555
if( memcmp(zDate, zPrevDate, 10) ){
15471556
fossil_print("=== %.10s ===\n", zDate);
15481557
memcpy(zPrevDate, zDate, 10);
15491558
nLine++; /* record another line */
@@ -1602,18 +1611,10 @@
16021611
nLine++; /* record another line */
16031612
}
16041613
db_reset(&fchngQuery);
16051614
}
16061615
nEntry++; /* record another complete entry */
1607
- if( !nAbsLimit ) continue; /* no limit, continue */
1608
- if( nLimit<0 && nLine>=nAbsLimit ){
1609
- fossil_print("=== line limit reached ===\n");
1610
- break; /* line count limit hit, stop. */
1611
- }else if( nEntry>=nAbsLimit ){
1612
- fossil_print("=== entry limit reached ===\n");
1613
- break; /* entry count limit hit, stop. */
1614
- }
16151616
}
16161617
if( fchngQueryInit ) db_finalize(&fchngQuery);
16171618
}
16181619
16191620
/*
16201621
--- src/timeline.c
+++ src/timeline.c
@@ -1540,10 +1540,19 @@
1540 char *zFree = 0;
1541 int n = 0;
1542 char zPrefix[80];
1543 char zUuid[UUID_SIZE+1];
1544
 
 
 
 
 
 
 
 
 
1545 sqlite3_snprintf(sizeof(zUuid), zUuid, "%.10s", zId);
1546 if( memcmp(zDate, zPrevDate, 10) ){
1547 fossil_print("=== %.10s ===\n", zDate);
1548 memcpy(zPrevDate, zDate, 10);
1549 nLine++; /* record another line */
@@ -1602,18 +1611,10 @@
1602 nLine++; /* record another line */
1603 }
1604 db_reset(&fchngQuery);
1605 }
1606 nEntry++; /* record another complete entry */
1607 if( !nAbsLimit ) continue; /* no limit, continue */
1608 if( nLimit<0 && nLine>=nAbsLimit ){
1609 fossil_print("=== line limit reached ===\n");
1610 break; /* line count limit hit, stop. */
1611 }else if( nEntry>=nAbsLimit ){
1612 fossil_print("=== entry limit reached ===\n");
1613 break; /* entry count limit hit, stop. */
1614 }
1615 }
1616 if( fchngQueryInit ) db_finalize(&fchngQuery);
1617 }
1618
1619 /*
1620
--- src/timeline.c
+++ src/timeline.c
@@ -1540,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 */
@@ -1602,18 +1611,10 @@
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 /*
1621

Keyboard Shortcuts

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