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.
Commit
465f8ecd4aaf638089e9b56aa05b452d2cb8ed18
Parent
629d49752c2e174…
1 file changed
+15
-3
+15
-3
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -1521,18 +1521,19 @@ | ||
| 1521 | 1521 | int nEntry = 0; |
| 1522 | 1522 | char zPrevDate[20]; |
| 1523 | 1523 | const char *zCurrentUuid = 0; |
| 1524 | 1524 | int fchngQueryInit = 0; /* True if fchngQuery is initialized */ |
| 1525 | 1525 | Stmt fchngQuery; /* Query for file changes on check-ins */ |
| 1526 | + int rc; | |
| 1526 | 1527 | |
| 1527 | 1528 | zPrevDate[0] = 0; |
| 1528 | 1529 | if( g.localOpen ){ |
| 1529 | 1530 | int rid = db_lget_int("checkout", 0); |
| 1530 | 1531 | zCurrentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1531 | 1532 | } |
| 1532 | 1533 | |
| 1533 | - while( db_step(q)==SQLITE_ROW ){ | |
| 1534 | + while( (rc=db_step(q))==SQLITE_ROW ){ | |
| 1534 | 1535 | int rid = db_column_int(q, 0); |
| 1535 | 1536 | const char *zId = db_column_text(q, 1); |
| 1536 | 1537 | const char *zDate = db_column_text(q, 2); |
| 1537 | 1538 | const char *zCom = db_column_text(q, 3); |
| 1538 | 1539 | int nChild = db_column_int(q, 4); |
| @@ -1611,10 +1612,18 @@ | ||
| 1611 | 1612 | nLine++; /* record another line */ |
| 1612 | 1613 | } |
| 1613 | 1614 | db_reset(&fchngQuery); |
| 1614 | 1615 | } |
| 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 | + } | |
| 1616 | 1625 | } |
| 1617 | 1626 | if( fchngQueryInit ) db_finalize(&fchngQuery); |
| 1618 | 1627 | } |
| 1619 | 1628 | |
| 1620 | 1629 | /* |
| @@ -1752,11 +1761,12 @@ | ||
| 1752 | 1761 | }else if( strncmp(g.argv[2],"ancestors",k)==0 && k>1 ){ |
| 1753 | 1762 | mode = 4; |
| 1754 | 1763 | }else if( strncmp(g.argv[2],"parents",k)==0 ){ |
| 1755 | 1764 | mode = 4; |
| 1756 | 1765 | }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?"); | |
| 1758 | 1768 | } |
| 1759 | 1769 | if( '-' != *g.argv[3] ){ |
| 1760 | 1770 | zOrigin = g.argv[3]; |
| 1761 | 1771 | }else{ |
| 1762 | 1772 | zOrigin = "now"; |
| @@ -1813,11 +1823,13 @@ | ||
| 1813 | 1823 | if( zType && (zType[0]!='a') ){ |
| 1814 | 1824 | blob_appendf(&sql, " AND event.type=%Q ", zType); |
| 1815 | 1825 | } |
| 1816 | 1826 | blob_appendf(&sql, " ORDER BY event.mtime DESC"); |
| 1817 | 1827 | 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); | |
| 1819 | 1831 | } |
| 1820 | 1832 | db_prepare(&q, blob_str(&sql)); |
| 1821 | 1833 | blob_reset(&sql); |
| 1822 | 1834 | print_timeline(&q, n, width, verboseFlag); |
| 1823 | 1835 | db_finalize(&q); |
| 1824 | 1836 |
| --- 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 |