Fossil SCM

Restore the end-of-timeline marker only when no limit is active; otherwise, use a 'no more data' marker instead. Use -1 to indicate no limit in the SQL clause.

mistachkin 2013-11-12 19:41 trunk
Commit 465f8ecd4aaf638089e9b56aa05b452d2cb8ed18
1 file changed +15 -3
+15 -3
--- src/timeline.c
+++ src/timeline.c
@@ -1521,18 +1521,19 @@
15211521
int nEntry = 0;
15221522
char zPrevDate[20];
15231523
const char *zCurrentUuid = 0;
15241524
int fchngQueryInit = 0; /* True if fchngQuery is initialized */
15251525
Stmt fchngQuery; /* Query for file changes on check-ins */
1526
+ int rc;
15261527
15271528
zPrevDate[0] = 0;
15281529
if( g.localOpen ){
15291530
int rid = db_lget_int("checkout", 0);
15301531
zCurrentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
15311532
}
15321533
1533
- while( db_step(q)==SQLITE_ROW ){
1534
+ while( (rc=db_step(q))==SQLITE_ROW ){
15341535
int rid = db_column_int(q, 0);
15351536
const char *zId = db_column_text(q, 1);
15361537
const char *zDate = db_column_text(q, 2);
15371538
const char *zCom = db_column_text(q, 3);
15381539
int nChild = db_column_int(q, 4);
@@ -1611,10 +1612,18 @@
16111612
nLine++; /* record another line */
16121613
}
16131614
db_reset(&fchngQuery);
16141615
}
16151616
nEntry++; /* record another complete entry */
1617
+ }
1618
+ if( rc==SQLITE_DONE ){
1619
+ /* Did the underlying query actually have all entries? */
1620
+ if( nAbsLimit==0 ){
1621
+ fossil_print("+++ end of timeline (%d) +++\n", nEntry);
1622
+ }else{
1623
+ fossil_print("+++ no more data (%d) +++\n", nEntry);
1624
+ }
16161625
}
16171626
if( fchngQueryInit ) db_finalize(&fchngQuery);
16181627
}
16191628
16201629
/*
@@ -1752,11 +1761,12 @@
17521761
}else if( strncmp(g.argv[2],"ancestors",k)==0 && k>1 ){
17531762
mode = 4;
17541763
}else if( strncmp(g.argv[2],"parents",k)==0 ){
17551764
mode = 4;
17561765
}else if(!zType && !zLimit){
1757
- usage("?WHEN? ?BASELINE|DATETIME? ?-n|--limit #? ?-t|--type TYPE? ?-W|--width WIDTH?");
1766
+ usage("?WHEN? ?BASELINE|DATETIME? ?-n|--limit #? ?-t|--type TYPE? "
1767
+ "?-W|--width WIDTH?");
17581768
}
17591769
if( '-' != *g.argv[3] ){
17601770
zOrigin = g.argv[3];
17611771
}else{
17621772
zOrigin = "now";
@@ -1813,11 +1823,13 @@
18131823
if( zType && (zType[0]!='a') ){
18141824
blob_appendf(&sql, " AND event.type=%Q ", zType);
18151825
}
18161826
blob_appendf(&sql, " ORDER BY event.mtime DESC");
18171827
if( iOffset>0 ){
1818
- blob_appendf(&sql, " LIMIT %d OFFSET %d", n>0?n+1:99999, iOffset);
1828
+ int n2 = (n >= 0) ? n : -n;
1829
+ if( n2==0 ) n2 = -1; /* NO LIMIT */
1830
+ blob_appendf(&sql, " LIMIT %d OFFSET %d", n2, iOffset);
18191831
}
18201832
db_prepare(&q, blob_str(&sql));
18211833
blob_reset(&sql);
18221834
print_timeline(&q, n, width, verboseFlag);
18231835
db_finalize(&q);
18241836
--- src/timeline.c
+++ src/timeline.c
@@ -1521,18 +1521,19 @@
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
1527 zPrevDate[0] = 0;
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);
@@ -1611,10 +1612,18 @@
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 /*
@@ -1752,11 +1761,12 @@
1752 }else if( strncmp(g.argv[2],"ancestors",k)==0 && k>1 ){
1753 mode = 4;
1754 }else if( strncmp(g.argv[2],"parents",k)==0 ){
1755 mode = 4;
1756 }else if(!zType && !zLimit){
1757 usage("?WHEN? ?BASELINE|DATETIME? ?-n|--limit #? ?-t|--type TYPE? ?-W|--width WIDTH?");
 
1758 }
1759 if( '-' != *g.argv[3] ){
1760 zOrigin = g.argv[3];
1761 }else{
1762 zOrigin = "now";
@@ -1813,11 +1823,13 @@
1813 if( zType && (zType[0]!='a') ){
1814 blob_appendf(&sql, " AND event.type=%Q ", zType);
1815 }
1816 blob_appendf(&sql, " ORDER BY event.mtime DESC");
1817 if( iOffset>0 ){
1818 blob_appendf(&sql, " LIMIT %d OFFSET %d", n>0?n+1:99999, iOffset);
 
 
1819 }
1820 db_prepare(&q, blob_str(&sql));
1821 blob_reset(&sql);
1822 print_timeline(&q, n, width, verboseFlag);
1823 db_finalize(&q);
1824
--- src/timeline.c
+++ src/timeline.c
@@ -1521,18 +1521,19 @@
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 int rc;
1527
1528 zPrevDate[0] = 0;
1529 if( g.localOpen ){
1530 int rid = db_lget_int("checkout", 0);
1531 zCurrentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1532 }
1533
1534 while( (rc=db_step(q))==SQLITE_ROW ){
1535 int rid = db_column_int(q, 0);
1536 const char *zId = db_column_text(q, 1);
1537 const char *zDate = db_column_text(q, 2);
1538 const char *zCom = db_column_text(q, 3);
1539 int nChild = db_column_int(q, 4);
@@ -1611,10 +1612,18 @@
1612 nLine++; /* record another line */
1613 }
1614 db_reset(&fchngQuery);
1615 }
1616 nEntry++; /* record another complete entry */
1617 }
1618 if( rc==SQLITE_DONE ){
1619 /* Did the underlying query actually have all entries? */
1620 if( nAbsLimit==0 ){
1621 fossil_print("+++ end of timeline (%d) +++\n", nEntry);
1622 }else{
1623 fossil_print("+++ no more data (%d) +++\n", nEntry);
1624 }
1625 }
1626 if( fchngQueryInit ) db_finalize(&fchngQuery);
1627 }
1628
1629 /*
@@ -1752,11 +1761,12 @@
1761 }else if( strncmp(g.argv[2],"ancestors",k)==0 && k>1 ){
1762 mode = 4;
1763 }else if( strncmp(g.argv[2],"parents",k)==0 ){
1764 mode = 4;
1765 }else if(!zType && !zLimit){
1766 usage("?WHEN? ?BASELINE|DATETIME? ?-n|--limit #? ?-t|--type TYPE? "
1767 "?-W|--width WIDTH?");
1768 }
1769 if( '-' != *g.argv[3] ){
1770 zOrigin = g.argv[3];
1771 }else{
1772 zOrigin = "now";
@@ -1813,11 +1823,13 @@
1823 if( zType && (zType[0]!='a') ){
1824 blob_appendf(&sql, " AND event.type=%Q ", zType);
1825 }
1826 blob_appendf(&sql, " ORDER BY event.mtime DESC");
1827 if( iOffset>0 ){
1828 int n2 = (n >= 0) ? n : -n;
1829 if( n2==0 ) n2 = -1; /* NO LIMIT */
1830 blob_appendf(&sql, " LIMIT %d OFFSET %d", n2, iOffset);
1831 }
1832 db_prepare(&q, blob_str(&sql));
1833 blob_reset(&sql);
1834 print_timeline(&q, n, width, verboseFlag);
1835 db_finalize(&q);
1836

Keyboard Shortcuts

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