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.
Commit
6e4e16fb8c0568bc83258b1990ade15c7e7cca37
Parent
e4e2f9f7b89e1c7…
10 files changed
+1
-1
+1
-1
+1
-1
+3
-6
+2
-5
+25
-9
+25
-9
+1
-1
+5
+5
+1
-1
| --- src/descendants.c | ||
| +++ src/descendants.c | ||
| @@ -329,11 +329,11 @@ | ||
| 329 | 329 | "%s" |
| 330 | 330 | " AND event.objid IN (SELECT rid FROM leaves)" |
| 331 | 331 | " ORDER BY event.mtime DESC", |
| 332 | 332 | timeline_query_for_tty() |
| 333 | 333 | ); |
| 334 | - print_timeline(&q, 20, 79, 0); | |
| 334 | + print_timeline(&q, -20, 79, 0); | |
| 335 | 335 | db_finalize(&q); |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | /* |
| 339 | 339 | ** COMMAND: leaves* |
| 340 | 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 |
| --- 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 @@ | ||
| 43 | 43 | ** Options: |
| 44 | 44 | ** -b|--brief display a brief (one line / revision) summary |
| 45 | 45 | ** --case-sensitive B Enable or disable case-sensitive filenames. B is a |
| 46 | 46 | ** boolean: "yes", "no", "true", "false", etc. |
| 47 | 47 | ** -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. | |
| 49 | 49 | ** --offset P skip P changes |
| 50 | 50 | ** -p|--print select print mode |
| 51 | 51 | ** -r|--revision R print the given revision (or ckout, if none is given) |
| 52 | 52 | ** to stdout (only in print mode) |
| 53 | 53 | ** -s|--status select status mode (print a status indicator for FILE) |
| 54 | 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 |
| 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 @@ | ||
| 43 | 43 | ** Options: |
| 44 | 44 | ** -b|--brief display a brief (one line / revision) summary |
| 45 | 45 | ** --case-sensitive B Enable or disable case-sensitive filenames. B is a |
| 46 | 46 | ** boolean: "yes", "no", "true", "false", etc. |
| 47 | 47 | ** -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. | |
| 49 | 49 | ** --offset P skip P changes |
| 50 | 50 | ** -p|--print select print mode |
| 51 | 51 | ** -r|--revision R print the given revision (or ckout, if none is given) |
| 52 | 52 | ** to stdout (only in print mode) |
| 53 | 53 | ** -s|--status select status mode (print a status indicator for FILE) |
| 54 | 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 |
| 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 @@ | ||
| 189 | 189 | int iBest; |
| 190 | 190 | char fAll = NULL != find_option("all", "a", 0); /* If set, do not lop |
| 191 | 191 | off the end of the |
| 192 | 192 | results. */ |
| 193 | 193 | 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 */ | |
| 196 | 196 | |
| 197 | 197 | db_must_be_within_tree(); |
| 198 | 198 | if( g.argc<2 ) return; |
| 199 | 199 | blob_init(&pattern, g.argv[2], -1); |
| 200 | 200 | for(i=3; i<g.argc; i++){ |
| @@ -220,13 +220,10 @@ | ||
| 220 | 220 | "WHERE 1 ", -1); |
| 221 | 221 | if(!fAll){ |
| 222 | 222 | blob_appendf(&sql,"AND x>%d ", iBest/3); |
| 223 | 223 | } |
| 224 | 224 | blob_append(&sql, "ORDER BY x DESC, date DESC ", -1); |
| 225 | - if(nLimit>0){ | |
| 226 | - blob_appendf(&sql, "LIMIT %d", nLimit); | |
| 227 | - } | |
| 228 | 225 | db_prepare(&q, blob_str(&sql)); |
| 229 | 226 | blob_reset(&sql); |
| 230 | - print_timeline(&q, 1000, 79, 0); | |
| 227 | + print_timeline(&q, nLimit, 79, 0); | |
| 231 | 228 | db_finalize(&q); |
| 232 | 229 | } |
| 233 | 230 |
| --- 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 @@ | ||
| 389 | 389 | int n; |
| 390 | 390 | int fRaw = find_option("raw","",0)!=0; |
| 391 | 391 | int fPropagate = find_option("propagate","",0)!=0; |
| 392 | 392 | const char *zPrefix = fRaw ? "" : "sym-"; |
| 393 | 393 | char const * zFindLimit = find_option("limit","n",1); |
| 394 | - int const nFindLimit = zFindLimit ? atoi(zFindLimit) : 0; | |
| 394 | + int const nFindLimit = zFindLimit ? atoi(zFindLimit) : -2000; | |
| 395 | 395 | |
| 396 | 396 | db_find_and_open_repository(0, 0); |
| 397 | 397 | if( g.argc<3 ){ |
| 398 | 398 | goto tag_cmd_usage; |
| 399 | 399 | } |
| @@ -467,16 +467,13 @@ | ||
| 467 | 467 | " WHERE tagtype>0 AND tagid=%d" |
| 468 | 468 | ")" |
| 469 | 469 | " ORDER BY event.mtime DESC", |
| 470 | 470 | timeline_query_for_tty(), zType, tagid |
| 471 | 471 | ); |
| 472 | - if( nFindLimit>0 ){ | |
| 473 | - blob_appendf(&sql, " LIMIT %d", nFindLimit); | |
| 474 | - } | |
| 475 | 472 | db_prepare(&q, "%s", blob_str(&sql)); |
| 476 | 473 | blob_reset(&sql); |
| 477 | - print_timeline(&q, 2000, 79, 0); | |
| 474 | + print_timeline(&q, nFindLimit, 79, 0); | |
| 478 | 475 | db_finalize(&q); |
| 479 | 476 | } |
| 480 | 477 | } |
| 481 | 478 | }else |
| 482 | 479 | |
| 483 | 480 |
| --- 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 @@ | ||
| 1494 | 1494 | |
| 1495 | 1495 | /* |
| 1496 | 1496 | ** The input query q selects various records. Print a human-readable |
| 1497 | 1497 | ** summary of those records. |
| 1498 | 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. | |
| 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. | |
| 1503 | 1506 | ** |
| 1504 | 1507 | ** The query should return these columns: |
| 1505 | 1508 | ** |
| 1506 | 1509 | ** 0. rid |
| 1507 | 1510 | ** 1. uuid |
| @@ -1510,12 +1513,14 @@ | ||
| 1510 | 1513 | ** 4. Number of non-merge children |
| 1511 | 1514 | ** 5. Number of parents |
| 1512 | 1515 | ** 6. mtime |
| 1513 | 1516 | ** 7. branch |
| 1514 | 1517 | */ |
| 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; | |
| 1516 | 1520 | int nLine = 0; |
| 1521 | + int nEntry = 0; | |
| 1517 | 1522 | char zPrevDate[20]; |
| 1518 | 1523 | const char *zCurrentUuid=0; |
| 1519 | 1524 | int fchngQueryInit = 0; /* True if fchngQuery is initialized */ |
| 1520 | 1525 | Stmt fchngQuery; /* Query for file changes on check-ins */ |
| 1521 | 1526 | zPrevDate[0] = 0; |
| @@ -1523,11 +1528,11 @@ | ||
| 1523 | 1528 | if( g.localOpen ){ |
| 1524 | 1529 | int rid = db_lget_int("checkout", 0); |
| 1525 | 1530 | zCurrentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1526 | 1531 | } |
| 1527 | 1532 | |
| 1528 | - while( db_step(q)==SQLITE_ROW && (mxLine<=0 || nLine<=mxLine) ){ | |
| 1533 | + while( db_step(q)==SQLITE_ROW ){ | |
| 1529 | 1534 | int rid = db_column_int(q, 0); |
| 1530 | 1535 | const char *zId = db_column_text(q, 1); |
| 1531 | 1536 | const char *zDate = db_column_text(q, 2); |
| 1532 | 1537 | const char *zCom = db_column_text(q, 3); |
| 1533 | 1538 | int nChild = db_column_int(q, 4); |
| @@ -1535,10 +1540,19 @@ | ||
| 1535 | 1540 | char *zFree = 0; |
| 1536 | 1541 | int n = 0; |
| 1537 | 1542 | char zPrefix[80]; |
| 1538 | 1543 | char zUuid[UUID_SIZE+1]; |
| 1539 | 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 | + } | |
| 1540 | 1554 | sqlite3_snprintf(sizeof(zUuid), zUuid, "%.10s", zId); |
| 1541 | 1555 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 1542 | 1556 | fossil_print("=== %.10s ===\n", zDate); |
| 1543 | 1557 | memcpy(zPrevDate, zDate, 10); |
| 1544 | 1558 | nLine++; /* record another line */ |
| @@ -1596,10 +1610,11 @@ | ||
| 1596 | 1610 | } |
| 1597 | 1611 | nLine++; /* record another line */ |
| 1598 | 1612 | } |
| 1599 | 1613 | db_reset(&fchngQuery); |
| 1600 | 1614 | } |
| 1615 | + nEntry++; /* record another complete entry */ | |
| 1601 | 1616 | } |
| 1602 | 1617 | if( fchngQueryInit ) db_finalize(&fchngQuery); |
| 1603 | 1618 | } |
| 1604 | 1619 | |
| 1605 | 1620 | /* |
| @@ -1666,11 +1681,12 @@ | ||
| 1666 | 1681 | ** The DATETIME should be in the ISO8601 format. For |
| 1667 | 1682 | ** examples: "2007-08-18 07:21:21". You can also say "current" |
| 1668 | 1683 | ** for the current version or "now" for the current time. |
| 1669 | 1684 | ** |
| 1670 | 1685 | ** 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. | |
| 1672 | 1688 | ** -t|--type TYPE Output items from the given types only, such as: |
| 1673 | 1689 | ** ci = file commits only |
| 1674 | 1690 | ** e = events only |
| 1675 | 1691 | ** t = tickets only |
| 1676 | 1692 | ** w = wiki commits only |
| @@ -1704,11 +1720,11 @@ | ||
| 1704 | 1720 | zLimit = find_option("count",0,1); |
| 1705 | 1721 | } |
| 1706 | 1722 | if( zLimit ){ |
| 1707 | 1723 | n = atoi(zLimit); |
| 1708 | 1724 | }else{ |
| 1709 | - n = 20; | |
| 1725 | + n = -20; | |
| 1710 | 1726 | } |
| 1711 | 1727 | if( zWidth ){ |
| 1712 | 1728 | width = atoi(zWidth); |
| 1713 | 1729 | if( (width!=0) && (width<=20) ){ |
| 1714 | 1730 | fossil_fatal("--width|-W value must be >20 or 0"); |
| @@ -1729,11 +1745,11 @@ | ||
| 1729 | 1745 | }else if( strncmp(g.argv[2],"ancestors",k)==0 && k>1 ){ |
| 1730 | 1746 | mode = 4; |
| 1731 | 1747 | }else if( strncmp(g.argv[2],"parents",k)==0 ){ |
| 1732 | 1748 | mode = 4; |
| 1733 | 1749 | }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?"); | |
| 1735 | 1751 | } |
| 1736 | 1752 | if( '-' != *g.argv[3] ){ |
| 1737 | 1753 | zOrigin = g.argv[3]; |
| 1738 | 1754 | }else{ |
| 1739 | 1755 | zOrigin = "now"; |
| 1740 | 1756 |
| --- 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 @@ | ||
| 1494 | 1494 | |
| 1495 | 1495 | /* |
| 1496 | 1496 | ** The input query q selects various records. Print a human-readable |
| 1497 | 1497 | ** summary of those records. |
| 1498 | 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. | |
| 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. | |
| 1503 | 1506 | ** |
| 1504 | 1507 | ** The query should return these columns: |
| 1505 | 1508 | ** |
| 1506 | 1509 | ** 0. rid |
| 1507 | 1510 | ** 1. uuid |
| @@ -1510,12 +1513,14 @@ | ||
| 1510 | 1513 | ** 4. Number of non-merge children |
| 1511 | 1514 | ** 5. Number of parents |
| 1512 | 1515 | ** 6. mtime |
| 1513 | 1516 | ** 7. branch |
| 1514 | 1517 | */ |
| 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; | |
| 1516 | 1520 | int nLine = 0; |
| 1521 | + int nEntry = 0; | |
| 1517 | 1522 | char zPrevDate[20]; |
| 1518 | 1523 | const char *zCurrentUuid=0; |
| 1519 | 1524 | int fchngQueryInit = 0; /* True if fchngQuery is initialized */ |
| 1520 | 1525 | Stmt fchngQuery; /* Query for file changes on check-ins */ |
| 1521 | 1526 | zPrevDate[0] = 0; |
| @@ -1523,11 +1528,11 @@ | ||
| 1523 | 1528 | if( g.localOpen ){ |
| 1524 | 1529 | int rid = db_lget_int("checkout", 0); |
| 1525 | 1530 | zCurrentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1526 | 1531 | } |
| 1527 | 1532 | |
| 1528 | - while( db_step(q)==SQLITE_ROW && (mxLine<=0 || nLine<=mxLine) ){ | |
| 1533 | + while( db_step(q)==SQLITE_ROW ){ | |
| 1529 | 1534 | int rid = db_column_int(q, 0); |
| 1530 | 1535 | const char *zId = db_column_text(q, 1); |
| 1531 | 1536 | const char *zDate = db_column_text(q, 2); |
| 1532 | 1537 | const char *zCom = db_column_text(q, 3); |
| 1533 | 1538 | int nChild = db_column_int(q, 4); |
| @@ -1535,10 +1540,19 @@ | ||
| 1535 | 1540 | char *zFree = 0; |
| 1536 | 1541 | int n = 0; |
| 1537 | 1542 | char zPrefix[80]; |
| 1538 | 1543 | char zUuid[UUID_SIZE+1]; |
| 1539 | 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 | + } | |
| 1540 | 1554 | sqlite3_snprintf(sizeof(zUuid), zUuid, "%.10s", zId); |
| 1541 | 1555 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 1542 | 1556 | fossil_print("=== %.10s ===\n", zDate); |
| 1543 | 1557 | memcpy(zPrevDate, zDate, 10); |
| 1544 | 1558 | nLine++; /* record another line */ |
| @@ -1596,10 +1610,11 @@ | ||
| 1596 | 1610 | } |
| 1597 | 1611 | nLine++; /* record another line */ |
| 1598 | 1612 | } |
| 1599 | 1613 | db_reset(&fchngQuery); |
| 1600 | 1614 | } |
| 1615 | + nEntry++; /* record another complete entry */ | |
| 1601 | 1616 | } |
| 1602 | 1617 | if( fchngQueryInit ) db_finalize(&fchngQuery); |
| 1603 | 1618 | } |
| 1604 | 1619 | |
| 1605 | 1620 | /* |
| @@ -1666,11 +1681,12 @@ | ||
| 1666 | 1681 | ** The DATETIME should be in the ISO8601 format. For |
| 1667 | 1682 | ** examples: "2007-08-18 07:21:21". You can also say "current" |
| 1668 | 1683 | ** for the current version or "now" for the current time. |
| 1669 | 1684 | ** |
| 1670 | 1685 | ** 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. | |
| 1672 | 1688 | ** -t|--type TYPE Output items from the given types only, such as: |
| 1673 | 1689 | ** ci = file commits only |
| 1674 | 1690 | ** e = events only |
| 1675 | 1691 | ** t = tickets only |
| 1676 | 1692 | ** w = wiki commits only |
| @@ -1704,11 +1720,11 @@ | ||
| 1704 | 1720 | zLimit = find_option("count",0,1); |
| 1705 | 1721 | } |
| 1706 | 1722 | if( zLimit ){ |
| 1707 | 1723 | n = atoi(zLimit); |
| 1708 | 1724 | }else{ |
| 1709 | - n = 20; | |
| 1725 | + n = -20; | |
| 1710 | 1726 | } |
| 1711 | 1727 | if( zWidth ){ |
| 1712 | 1728 | width = atoi(zWidth); |
| 1713 | 1729 | if( (width!=0) && (width<=20) ){ |
| 1714 | 1730 | fossil_fatal("--width|-W value must be >20 or 0"); |
| @@ -1729,11 +1745,11 @@ | ||
| 1729 | 1745 | }else if( strncmp(g.argv[2],"ancestors",k)==0 && k>1 ){ |
| 1730 | 1746 | mode = 4; |
| 1731 | 1747 | }else if( strncmp(g.argv[2],"parents",k)==0 ){ |
| 1732 | 1748 | mode = 4; |
| 1733 | 1749 | }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?"); | |
| 1735 | 1751 | } |
| 1736 | 1752 | if( '-' != *g.argv[3] ){ |
| 1737 | 1753 | zOrigin = g.argv[3]; |
| 1738 | 1754 | }else{ |
| 1739 | 1755 | zOrigin = "now"; |
| 1740 | 1756 |
| --- 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 @@ | ||
| 188 | 188 | "%s " |
| 189 | 189 | " AND event.objid IN leaves" |
| 190 | 190 | " ORDER BY event.mtime DESC", |
| 191 | 191 | timeline_query_for_tty() |
| 192 | 192 | ); |
| 193 | - print_timeline(&q, 100, 79, 0); | |
| 193 | + print_timeline(&q, -100, 79, 0); | |
| 194 | 194 | db_finalize(&q); |
| 195 | 195 | fossil_fatal("Multiple descendants"); |
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | tid = db_int(0, "SELECT rid FROM leaves, event" |
| 199 | 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 |
| --- 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 |
+5
| --- www/changes.wiki | ||
| +++ www/changes.wiki | ||
| @@ -20,10 +20,15 @@ | ||
| 20 | 20 | "[/help?cmd=clean | fossil clean]" command. |
| 21 | 21 | * Ten-fold performance improvement in large "fossil blame" or |
| 22 | 22 | "fossil annotate" commands. |
| 23 | 23 | * Add option -W|--width to the "[/help?cmd=timeline | fossil timeline]" |
| 24 | 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. | |
| 25 | 30 | |
| 26 | 31 | <h2>Changes For Version 1.27 (2013-09-11)</h2> |
| 27 | 32 | * Enhance the [/help?cmd=changes | fossil changes], |
| 28 | 33 | [/help?cmd=clean | fossil clean], [/help?cmd=extras | fossil extras], |
| 29 | 34 | [/help?cmd=ls | fossil ls] and [/help?cmd=status | fossil status] commands |
| 30 | 35 |
| --- 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 |
+5
| --- www/changes.wiki | ||
| +++ www/changes.wiki | ||
| @@ -20,10 +20,15 @@ | ||
| 20 | 20 | "[/help?cmd=clean | fossil clean]" command. |
| 21 | 21 | * Ten-fold performance improvement in large "fossil blame" or |
| 22 | 22 | "fossil annotate" commands. |
| 23 | 23 | * Add option -W|--width to the "[/help?cmd=timeline | fossil timeline]" |
| 24 | 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. | |
| 25 | 30 | |
| 26 | 31 | <h2>Changes For Version 1.27 (2013-09-11)</h2> |
| 27 | 32 | * Enhance the [/help?cmd=changes | fossil changes], |
| 28 | 33 | [/help?cmd=clean | fossil clean], [/help?cmd=extras | fossil extras], |
| 29 | 34 | [/help?cmd=ls | fossil ls] and [/help?cmd=status | fossil status] commands |
| 30 | 35 |
| --- 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 |