Fossil SCM
Add the -r option to the 'timeline' command to display items in chronological order.
Commit
7ac9d8bf35238a16578417d84df61ad8929f6742c352a9b032b3f3c9a8cf3918
Parent
4bfbe5f5b47b230…
1 file changed
+18
-13
+18
-13
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -598,11 +598,11 @@ | ||
| 598 | 598 | drawDetailEllipsis = 0; |
| 599 | 599 | }else{ |
| 600 | 600 | cgi_printf("%W",blob_str(&comment)); |
| 601 | 601 | } |
| 602 | 602 | } |
| 603 | - | |
| 603 | + | |
| 604 | 604 | if( zType[0]=='c' && strcmp(zUuid, MANIFEST_UUID)==0 ){ |
| 605 | 605 | /* This will only ever happen when Fossil is drawing a timeline for |
| 606 | 606 | ** its own self-host repository. If the timeline shows the specific |
| 607 | 607 | ** check-in corresponding to the current executable, then tag that |
| 608 | 608 | ** check-in with "This is me!". */ |
| @@ -1363,11 +1363,11 @@ | ||
| 1363 | 1363 | ** the input is a valid date space and false if not. |
| 1364 | 1364 | */ |
| 1365 | 1365 | static int timeline_is_datespan(const char *zDay){ |
| 1366 | 1366 | size_t n = strlen(zDay); |
| 1367 | 1367 | int i, d, m; |
| 1368 | - | |
| 1368 | + | |
| 1369 | 1369 | if( n<17 || n>18 ) return 0; |
| 1370 | 1370 | if( n==18 ){ |
| 1371 | 1371 | if( zDay[17]!='Z' && zDay[17]!='z' ) return 0; |
| 1372 | 1372 | n--; |
| 1373 | 1373 | } |
| @@ -1395,11 +1395,11 @@ | ||
| 1395 | 1395 | ** or ancestor set of check-in iFrom that match the tag, then |
| 1396 | 1396 | ** return 0. |
| 1397 | 1397 | */ |
| 1398 | 1398 | static int timeline_endpoint( |
| 1399 | 1399 | int iFrom, /* Starting point */ |
| 1400 | - const char *zEnd, /* Tag we are searching for */ | |
| 1400 | + const char *zEnd, /* Tag we are searching for */ | |
| 1401 | 1401 | int bForward /* 1: forwards in time (descendants) 0: backwards */ |
| 1402 | 1402 | ){ |
| 1403 | 1403 | int tagId; |
| 1404 | 1404 | int endId = 0; |
| 1405 | 1405 | Stmt q; |
| @@ -2285,11 +2285,11 @@ | ||
| 2285 | 2285 | if( zError==0 ){ |
| 2286 | 2286 | zError = "Cannot use the ft= query parameter when both p= and d= " |
| 2287 | 2287 | "are used and have distinct values."; |
| 2288 | 2288 | } |
| 2289 | 2289 | zFwdTo = 0; |
| 2290 | - } | |
| 2290 | + } | |
| 2291 | 2291 | if( zFwdTo ){ |
| 2292 | 2292 | double rStartDate = mtime_of_rid(d_rid, 0.0); |
| 2293 | 2293 | ridFwdTo = first_checkin_with_tag_after_date(zFwdTo, rStartDate); |
| 2294 | 2294 | if( ridFwdTo==0 ){ |
| 2295 | 2295 | ridFwdTo = name_to_typed_rid(zBackTo,"ci"); |
| @@ -2344,11 +2344,11 @@ | ||
| 2344 | 2344 | if( zError==0 ){ |
| 2345 | 2345 | zError = "Cannot use the bt= query parameter when both p= and d= " |
| 2346 | 2346 | "are used and have distinct values."; |
| 2347 | 2347 | } |
| 2348 | 2348 | zBackTo = 0; |
| 2349 | - } | |
| 2349 | + } | |
| 2350 | 2350 | if( zBackTo ){ |
| 2351 | 2351 | double rDateLimit = mtime_of_rid(p_rid, 0.0); |
| 2352 | 2352 | ridBackTo = last_checkin_with_tag_before_date(zBackTo, rDateLimit); |
| 2353 | 2353 | if( ridBackTo==0 ){ |
| 2354 | 2354 | ridBackTo = name_to_typed_rid(zBackTo,"ci"); |
| @@ -2370,11 +2370,11 @@ | ||
| 2370 | 2370 | }else{ |
| 2371 | 2371 | removeFileGlobFromOk(zChng); |
| 2372 | 2372 | np = db_int(0, "SELECT count(*)-1 FROM ok"); |
| 2373 | 2373 | if( np>0 || nd==0 ){ |
| 2374 | 2374 | if( nd>0 ) blob_appendf(&desc, " and "); |
| 2375 | - blob_appendf(&desc, "%d ancestor%s", | |
| 2375 | + blob_appendf(&desc, "%d ancestor%s", | |
| 2376 | 2376 | np>=0 ? np : 0, (1==np)?"":"s"); |
| 2377 | 2377 | db_multi_exec("%s", blob_sql_text(&sql)); |
| 2378 | 2378 | } |
| 2379 | 2379 | if( useDividers && !selectedRid ) selectedRid = p_rid; |
| 2380 | 2380 | } |
| @@ -2653,11 +2653,11 @@ | ||
| 2653 | 2653 | blob_append_sql(&cond, |
| 2654 | 2654 | " AND event.mtime>=julianday(%Q,%Q)" |
| 2655 | 2655 | " AND event.mtime<julianday(%Q,%Q,'+1 day')\n", |
| 2656 | 2656 | zStart, zTZMod, zEnd, zTZMod); |
| 2657 | 2657 | nEntry = -1; |
| 2658 | - | |
| 2658 | + | |
| 2659 | 2659 | if( fossil_ui_localtime() && bZulu ){ |
| 2660 | 2660 | zDay = mprintf("%d days between %zZ and %zZ", nDay, zStart, zEnd); |
| 2661 | 2661 | }else{ |
| 2662 | 2662 | zDay = mprintf("%d days between %z and %z", nDay, zStart, zEnd); |
| 2663 | 2663 | } |
| @@ -3622,10 +3622,11 @@ | ||
| 3622 | 3622 | ** N is negative, output the first -N lines. If N is |
| 3623 | 3623 | ** zero, no limit. Default is -20 meaning 20 lines. |
| 3624 | 3624 | ** --offset P Skip P changes |
| 3625 | 3625 | ** -p|--path PATH Output items affecting PATH only. |
| 3626 | 3626 | ** PATH can be a file or a sub directory. |
| 3627 | +** -r|--reverse Show items in chronological order. | |
| 3627 | 3628 | ** -R REPO_FILE Specifies the repository db to use. Default is |
| 3628 | 3629 | ** the current check-out's repository. |
| 3629 | 3630 | ** --sql Show the SQL used to generate the timeline |
| 3630 | 3631 | ** -t|--type TYPE Output items from the given types only, such as: |
| 3631 | 3632 | ** ci = file commits only |
| @@ -3652,11 +3653,12 @@ | ||
| 3652 | 3653 | char *zDate; |
| 3653 | 3654 | Blob sql; |
| 3654 | 3655 | int objid = 0; |
| 3655 | 3656 | Blob uuid; |
| 3656 | 3657 | int mode = TIMELINE_MODE_NONE; |
| 3657 | - int verboseFlag = 0 ; | |
| 3658 | + int verboseFlag = 0; | |
| 3659 | + int reverseFlag = 0; | |
| 3658 | 3660 | int iOffset; |
| 3659 | 3661 | const char *zFilePattern = 0; |
| 3660 | 3662 | const char *zFormat = 0; |
| 3661 | 3663 | const char *zBr = 0; |
| 3662 | 3664 | Blob treeName; |
| @@ -3709,10 +3711,11 @@ | ||
| 3709 | 3711 | }else{ |
| 3710 | 3712 | width = -1; |
| 3711 | 3713 | } |
| 3712 | 3714 | zOffset = find_option("offset",0,1); |
| 3713 | 3715 | iOffset = zOffset ? atoi(zOffset) : 0; |
| 3716 | + reverseFlag = find_option("reverse","r",0)!=0; | |
| 3714 | 3717 | |
| 3715 | 3718 | /* We should be done with options.. */ |
| 3716 | 3719 | verify_all_options(); |
| 3717 | 3720 | |
| 3718 | 3721 | if( g.argc>=4 ){ |
| @@ -3729,11 +3732,11 @@ | ||
| 3729 | 3732 | mode = TIMELINE_MODE_PARENTS; |
| 3730 | 3733 | }else if( strncmp(g.argv[2],"parents",k)==0 ){ |
| 3731 | 3734 | mode = TIMELINE_MODE_PARENTS; |
| 3732 | 3735 | }else if(!zType && !zLimit){ |
| 3733 | 3736 | usage("?WHEN? ?CHECKIN|DATETIME? ?-n|--limit #? ?-t|--type TYPE? " |
| 3734 | - "?-W|--width WIDTH? ?-p|--path PATH?"); | |
| 3737 | + "?-W|--width WIDTH? ?-p|--path PATH? ?-r|--reverse?"); | |
| 3735 | 3738 | } |
| 3736 | 3739 | if( '-' != *g.argv[3] ){ |
| 3737 | 3740 | zOrigin = g.argv[3]; |
| 3738 | 3741 | }else{ |
| 3739 | 3742 | zOrigin = "now"; |
| @@ -3852,23 +3855,25 @@ | ||
| 3852 | 3855 | " WHERE tx.value='%q'\n" |
| 3853 | 3856 | ")\n" /* No merge closures */ |
| 3854 | 3857 | " AND (tagxref.value IS NULL OR tagxref.value='%q')", |
| 3855 | 3858 | zBr, zBr, zBr, TAG_BRANCH, zBr, zBr); |
| 3856 | 3859 | } |
| 3857 | - | |
| 3860 | + | |
| 3858 | 3861 | if( mode==TIMELINE_MODE_AFTER ){ |
| 3859 | 3862 | int lim = n; |
| 3860 | 3863 | if( n == 0 ){ |
| 3861 | 3864 | lim = -1; /* 0 means no limit */ |
| 3862 | 3865 | }else if( n < 0 ){ |
| 3863 | 3866 | lim = -n; |
| 3864 | 3867 | } |
| 3865 | 3868 | /* Complete the above outer select. */ |
| 3866 | - blob_append_sql(&sql, | |
| 3867 | - "\nORDER BY event.mtime LIMIT %d) t ORDER BY t.mDateTime DESC", lim); | |
| 3869 | + blob_append_sql(&sql, | |
| 3870 | + "\nORDER BY event.mtime LIMIT %d) t ORDER BY t.mDateTime %s", | |
| 3871 | + lim, reverseFlag ? "" : "DESC"); | |
| 3868 | 3872 | }else{ |
| 3869 | - blob_append_sql(&sql, "\nORDER BY event.mtime DESC"); | |
| 3873 | + blob_append_sql(&sql, | |
| 3874 | + "\nORDER BY event.mtime %s", reverseFlag ? "" : "DESC"); | |
| 3870 | 3875 | } |
| 3871 | 3876 | if( iOffset>0 ){ |
| 3872 | 3877 | /* Don't handle LIMIT here, otherwise print_timeline() |
| 3873 | 3878 | * will not determine the end-marker correctly! */ |
| 3874 | 3879 | blob_append_sql(&sql, "\n LIMIT -1 OFFSET %d", iOffset); |
| 3875 | 3880 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -598,11 +598,11 @@ | |
| 598 | drawDetailEllipsis = 0; |
| 599 | }else{ |
| 600 | cgi_printf("%W",blob_str(&comment)); |
| 601 | } |
| 602 | } |
| 603 | |
| 604 | if( zType[0]=='c' && strcmp(zUuid, MANIFEST_UUID)==0 ){ |
| 605 | /* This will only ever happen when Fossil is drawing a timeline for |
| 606 | ** its own self-host repository. If the timeline shows the specific |
| 607 | ** check-in corresponding to the current executable, then tag that |
| 608 | ** check-in with "This is me!". */ |
| @@ -1363,11 +1363,11 @@ | |
| 1363 | ** the input is a valid date space and false if not. |
| 1364 | */ |
| 1365 | static int timeline_is_datespan(const char *zDay){ |
| 1366 | size_t n = strlen(zDay); |
| 1367 | int i, d, m; |
| 1368 | |
| 1369 | if( n<17 || n>18 ) return 0; |
| 1370 | if( n==18 ){ |
| 1371 | if( zDay[17]!='Z' && zDay[17]!='z' ) return 0; |
| 1372 | n--; |
| 1373 | } |
| @@ -1395,11 +1395,11 @@ | |
| 1395 | ** or ancestor set of check-in iFrom that match the tag, then |
| 1396 | ** return 0. |
| 1397 | */ |
| 1398 | static int timeline_endpoint( |
| 1399 | int iFrom, /* Starting point */ |
| 1400 | const char *zEnd, /* Tag we are searching for */ |
| 1401 | int bForward /* 1: forwards in time (descendants) 0: backwards */ |
| 1402 | ){ |
| 1403 | int tagId; |
| 1404 | int endId = 0; |
| 1405 | Stmt q; |
| @@ -2285,11 +2285,11 @@ | |
| 2285 | if( zError==0 ){ |
| 2286 | zError = "Cannot use the ft= query parameter when both p= and d= " |
| 2287 | "are used and have distinct values."; |
| 2288 | } |
| 2289 | zFwdTo = 0; |
| 2290 | } |
| 2291 | if( zFwdTo ){ |
| 2292 | double rStartDate = mtime_of_rid(d_rid, 0.0); |
| 2293 | ridFwdTo = first_checkin_with_tag_after_date(zFwdTo, rStartDate); |
| 2294 | if( ridFwdTo==0 ){ |
| 2295 | ridFwdTo = name_to_typed_rid(zBackTo,"ci"); |
| @@ -2344,11 +2344,11 @@ | |
| 2344 | if( zError==0 ){ |
| 2345 | zError = "Cannot use the bt= query parameter when both p= and d= " |
| 2346 | "are used and have distinct values."; |
| 2347 | } |
| 2348 | zBackTo = 0; |
| 2349 | } |
| 2350 | if( zBackTo ){ |
| 2351 | double rDateLimit = mtime_of_rid(p_rid, 0.0); |
| 2352 | ridBackTo = last_checkin_with_tag_before_date(zBackTo, rDateLimit); |
| 2353 | if( ridBackTo==0 ){ |
| 2354 | ridBackTo = name_to_typed_rid(zBackTo,"ci"); |
| @@ -2370,11 +2370,11 @@ | |
| 2370 | }else{ |
| 2371 | removeFileGlobFromOk(zChng); |
| 2372 | np = db_int(0, "SELECT count(*)-1 FROM ok"); |
| 2373 | if( np>0 || nd==0 ){ |
| 2374 | if( nd>0 ) blob_appendf(&desc, " and "); |
| 2375 | blob_appendf(&desc, "%d ancestor%s", |
| 2376 | np>=0 ? np : 0, (1==np)?"":"s"); |
| 2377 | db_multi_exec("%s", blob_sql_text(&sql)); |
| 2378 | } |
| 2379 | if( useDividers && !selectedRid ) selectedRid = p_rid; |
| 2380 | } |
| @@ -2653,11 +2653,11 @@ | |
| 2653 | blob_append_sql(&cond, |
| 2654 | " AND event.mtime>=julianday(%Q,%Q)" |
| 2655 | " AND event.mtime<julianday(%Q,%Q,'+1 day')\n", |
| 2656 | zStart, zTZMod, zEnd, zTZMod); |
| 2657 | nEntry = -1; |
| 2658 | |
| 2659 | if( fossil_ui_localtime() && bZulu ){ |
| 2660 | zDay = mprintf("%d days between %zZ and %zZ", nDay, zStart, zEnd); |
| 2661 | }else{ |
| 2662 | zDay = mprintf("%d days between %z and %z", nDay, zStart, zEnd); |
| 2663 | } |
| @@ -3622,10 +3622,11 @@ | |
| 3622 | ** N is negative, output the first -N lines. If N is |
| 3623 | ** zero, no limit. Default is -20 meaning 20 lines. |
| 3624 | ** --offset P Skip P changes |
| 3625 | ** -p|--path PATH Output items affecting PATH only. |
| 3626 | ** PATH can be a file or a sub directory. |
| 3627 | ** -R REPO_FILE Specifies the repository db to use. Default is |
| 3628 | ** the current check-out's repository. |
| 3629 | ** --sql Show the SQL used to generate the timeline |
| 3630 | ** -t|--type TYPE Output items from the given types only, such as: |
| 3631 | ** ci = file commits only |
| @@ -3652,11 +3653,12 @@ | |
| 3652 | char *zDate; |
| 3653 | Blob sql; |
| 3654 | int objid = 0; |
| 3655 | Blob uuid; |
| 3656 | int mode = TIMELINE_MODE_NONE; |
| 3657 | int verboseFlag = 0 ; |
| 3658 | int iOffset; |
| 3659 | const char *zFilePattern = 0; |
| 3660 | const char *zFormat = 0; |
| 3661 | const char *zBr = 0; |
| 3662 | Blob treeName; |
| @@ -3709,10 +3711,11 @@ | |
| 3709 | }else{ |
| 3710 | width = -1; |
| 3711 | } |
| 3712 | zOffset = find_option("offset",0,1); |
| 3713 | iOffset = zOffset ? atoi(zOffset) : 0; |
| 3714 | |
| 3715 | /* We should be done with options.. */ |
| 3716 | verify_all_options(); |
| 3717 | |
| 3718 | if( g.argc>=4 ){ |
| @@ -3729,11 +3732,11 @@ | |
| 3729 | mode = TIMELINE_MODE_PARENTS; |
| 3730 | }else if( strncmp(g.argv[2],"parents",k)==0 ){ |
| 3731 | mode = TIMELINE_MODE_PARENTS; |
| 3732 | }else if(!zType && !zLimit){ |
| 3733 | usage("?WHEN? ?CHECKIN|DATETIME? ?-n|--limit #? ?-t|--type TYPE? " |
| 3734 | "?-W|--width WIDTH? ?-p|--path PATH?"); |
| 3735 | } |
| 3736 | if( '-' != *g.argv[3] ){ |
| 3737 | zOrigin = g.argv[3]; |
| 3738 | }else{ |
| 3739 | zOrigin = "now"; |
| @@ -3852,23 +3855,25 @@ | |
| 3852 | " WHERE tx.value='%q'\n" |
| 3853 | ")\n" /* No merge closures */ |
| 3854 | " AND (tagxref.value IS NULL OR tagxref.value='%q')", |
| 3855 | zBr, zBr, zBr, TAG_BRANCH, zBr, zBr); |
| 3856 | } |
| 3857 | |
| 3858 | if( mode==TIMELINE_MODE_AFTER ){ |
| 3859 | int lim = n; |
| 3860 | if( n == 0 ){ |
| 3861 | lim = -1; /* 0 means no limit */ |
| 3862 | }else if( n < 0 ){ |
| 3863 | lim = -n; |
| 3864 | } |
| 3865 | /* Complete the above outer select. */ |
| 3866 | blob_append_sql(&sql, |
| 3867 | "\nORDER BY event.mtime LIMIT %d) t ORDER BY t.mDateTime DESC", lim); |
| 3868 | }else{ |
| 3869 | blob_append_sql(&sql, "\nORDER BY event.mtime DESC"); |
| 3870 | } |
| 3871 | if( iOffset>0 ){ |
| 3872 | /* Don't handle LIMIT here, otherwise print_timeline() |
| 3873 | * will not determine the end-marker correctly! */ |
| 3874 | blob_append_sql(&sql, "\n LIMIT -1 OFFSET %d", iOffset); |
| 3875 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -598,11 +598,11 @@ | |
| 598 | drawDetailEllipsis = 0; |
| 599 | }else{ |
| 600 | cgi_printf("%W",blob_str(&comment)); |
| 601 | } |
| 602 | } |
| 603 | |
| 604 | if( zType[0]=='c' && strcmp(zUuid, MANIFEST_UUID)==0 ){ |
| 605 | /* This will only ever happen when Fossil is drawing a timeline for |
| 606 | ** its own self-host repository. If the timeline shows the specific |
| 607 | ** check-in corresponding to the current executable, then tag that |
| 608 | ** check-in with "This is me!". */ |
| @@ -1363,11 +1363,11 @@ | |
| 1363 | ** the input is a valid date space and false if not. |
| 1364 | */ |
| 1365 | static int timeline_is_datespan(const char *zDay){ |
| 1366 | size_t n = strlen(zDay); |
| 1367 | int i, d, m; |
| 1368 | |
| 1369 | if( n<17 || n>18 ) return 0; |
| 1370 | if( n==18 ){ |
| 1371 | if( zDay[17]!='Z' && zDay[17]!='z' ) return 0; |
| 1372 | n--; |
| 1373 | } |
| @@ -1395,11 +1395,11 @@ | |
| 1395 | ** or ancestor set of check-in iFrom that match the tag, then |
| 1396 | ** return 0. |
| 1397 | */ |
| 1398 | static int timeline_endpoint( |
| 1399 | int iFrom, /* Starting point */ |
| 1400 | const char *zEnd, /* Tag we are searching for */ |
| 1401 | int bForward /* 1: forwards in time (descendants) 0: backwards */ |
| 1402 | ){ |
| 1403 | int tagId; |
| 1404 | int endId = 0; |
| 1405 | Stmt q; |
| @@ -2285,11 +2285,11 @@ | |
| 2285 | if( zError==0 ){ |
| 2286 | zError = "Cannot use the ft= query parameter when both p= and d= " |
| 2287 | "are used and have distinct values."; |
| 2288 | } |
| 2289 | zFwdTo = 0; |
| 2290 | } |
| 2291 | if( zFwdTo ){ |
| 2292 | double rStartDate = mtime_of_rid(d_rid, 0.0); |
| 2293 | ridFwdTo = first_checkin_with_tag_after_date(zFwdTo, rStartDate); |
| 2294 | if( ridFwdTo==0 ){ |
| 2295 | ridFwdTo = name_to_typed_rid(zBackTo,"ci"); |
| @@ -2344,11 +2344,11 @@ | |
| 2344 | if( zError==0 ){ |
| 2345 | zError = "Cannot use the bt= query parameter when both p= and d= " |
| 2346 | "are used and have distinct values."; |
| 2347 | } |
| 2348 | zBackTo = 0; |
| 2349 | } |
| 2350 | if( zBackTo ){ |
| 2351 | double rDateLimit = mtime_of_rid(p_rid, 0.0); |
| 2352 | ridBackTo = last_checkin_with_tag_before_date(zBackTo, rDateLimit); |
| 2353 | if( ridBackTo==0 ){ |
| 2354 | ridBackTo = name_to_typed_rid(zBackTo,"ci"); |
| @@ -2370,11 +2370,11 @@ | |
| 2370 | }else{ |
| 2371 | removeFileGlobFromOk(zChng); |
| 2372 | np = db_int(0, "SELECT count(*)-1 FROM ok"); |
| 2373 | if( np>0 || nd==0 ){ |
| 2374 | if( nd>0 ) blob_appendf(&desc, " and "); |
| 2375 | blob_appendf(&desc, "%d ancestor%s", |
| 2376 | np>=0 ? np : 0, (1==np)?"":"s"); |
| 2377 | db_multi_exec("%s", blob_sql_text(&sql)); |
| 2378 | } |
| 2379 | if( useDividers && !selectedRid ) selectedRid = p_rid; |
| 2380 | } |
| @@ -2653,11 +2653,11 @@ | |
| 2653 | blob_append_sql(&cond, |
| 2654 | " AND event.mtime>=julianday(%Q,%Q)" |
| 2655 | " AND event.mtime<julianday(%Q,%Q,'+1 day')\n", |
| 2656 | zStart, zTZMod, zEnd, zTZMod); |
| 2657 | nEntry = -1; |
| 2658 | |
| 2659 | if( fossil_ui_localtime() && bZulu ){ |
| 2660 | zDay = mprintf("%d days between %zZ and %zZ", nDay, zStart, zEnd); |
| 2661 | }else{ |
| 2662 | zDay = mprintf("%d days between %z and %z", nDay, zStart, zEnd); |
| 2663 | } |
| @@ -3622,10 +3622,11 @@ | |
| 3622 | ** N is negative, output the first -N lines. If N is |
| 3623 | ** zero, no limit. Default is -20 meaning 20 lines. |
| 3624 | ** --offset P Skip P changes |
| 3625 | ** -p|--path PATH Output items affecting PATH only. |
| 3626 | ** PATH can be a file or a sub directory. |
| 3627 | ** -r|--reverse Show items in chronological order. |
| 3628 | ** -R REPO_FILE Specifies the repository db to use. Default is |
| 3629 | ** the current check-out's repository. |
| 3630 | ** --sql Show the SQL used to generate the timeline |
| 3631 | ** -t|--type TYPE Output items from the given types only, such as: |
| 3632 | ** ci = file commits only |
| @@ -3652,11 +3653,12 @@ | |
| 3653 | char *zDate; |
| 3654 | Blob sql; |
| 3655 | int objid = 0; |
| 3656 | Blob uuid; |
| 3657 | int mode = TIMELINE_MODE_NONE; |
| 3658 | int verboseFlag = 0; |
| 3659 | int reverseFlag = 0; |
| 3660 | int iOffset; |
| 3661 | const char *zFilePattern = 0; |
| 3662 | const char *zFormat = 0; |
| 3663 | const char *zBr = 0; |
| 3664 | Blob treeName; |
| @@ -3709,10 +3711,11 @@ | |
| 3711 | }else{ |
| 3712 | width = -1; |
| 3713 | } |
| 3714 | zOffset = find_option("offset",0,1); |
| 3715 | iOffset = zOffset ? atoi(zOffset) : 0; |
| 3716 | reverseFlag = find_option("reverse","r",0)!=0; |
| 3717 | |
| 3718 | /* We should be done with options.. */ |
| 3719 | verify_all_options(); |
| 3720 | |
| 3721 | if( g.argc>=4 ){ |
| @@ -3729,11 +3732,11 @@ | |
| 3732 | mode = TIMELINE_MODE_PARENTS; |
| 3733 | }else if( strncmp(g.argv[2],"parents",k)==0 ){ |
| 3734 | mode = TIMELINE_MODE_PARENTS; |
| 3735 | }else if(!zType && !zLimit){ |
| 3736 | usage("?WHEN? ?CHECKIN|DATETIME? ?-n|--limit #? ?-t|--type TYPE? " |
| 3737 | "?-W|--width WIDTH? ?-p|--path PATH? ?-r|--reverse?"); |
| 3738 | } |
| 3739 | if( '-' != *g.argv[3] ){ |
| 3740 | zOrigin = g.argv[3]; |
| 3741 | }else{ |
| 3742 | zOrigin = "now"; |
| @@ -3852,23 +3855,25 @@ | |
| 3855 | " WHERE tx.value='%q'\n" |
| 3856 | ")\n" /* No merge closures */ |
| 3857 | " AND (tagxref.value IS NULL OR tagxref.value='%q')", |
| 3858 | zBr, zBr, zBr, TAG_BRANCH, zBr, zBr); |
| 3859 | } |
| 3860 | |
| 3861 | if( mode==TIMELINE_MODE_AFTER ){ |
| 3862 | int lim = n; |
| 3863 | if( n == 0 ){ |
| 3864 | lim = -1; /* 0 means no limit */ |
| 3865 | }else if( n < 0 ){ |
| 3866 | lim = -n; |
| 3867 | } |
| 3868 | /* Complete the above outer select. */ |
| 3869 | blob_append_sql(&sql, |
| 3870 | "\nORDER BY event.mtime LIMIT %d) t ORDER BY t.mDateTime %s", |
| 3871 | lim, reverseFlag ? "" : "DESC"); |
| 3872 | }else{ |
| 3873 | blob_append_sql(&sql, |
| 3874 | "\nORDER BY event.mtime %s", reverseFlag ? "" : "DESC"); |
| 3875 | } |
| 3876 | if( iOffset>0 ){ |
| 3877 | /* Don't handle LIMIT here, otherwise print_timeline() |
| 3878 | * will not determine the end-marker correctly! */ |
| 3879 | blob_append_sql(&sql, "\n LIMIT -1 OFFSET %d", iOffset); |
| 3880 |