Fossil SCM
Now use a switch to specify the file/directory to the timeline command. - Use -p|--path PATH since "-f" is already used as a deprecated options. - Restore command line arguments parsing of the timeline command as before the cmdline-timeline-enhancement branch so the previous behavior and argument priority stay compatible as before. (We were not able to specify a checkin prefix or tagname without specifying the ?WHEN? argument anymore.)
Commit
1e870e1e06c202a855afcd364826b35dbdb6d8ef
Parent
cf9eac3929ff5e8…
1 file changed
+30
-28
+30
-28
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -1698,11 +1698,11 @@ | ||
| 1698 | 1698 | } |
| 1699 | 1699 | |
| 1700 | 1700 | /* |
| 1701 | 1701 | ** COMMAND: timeline |
| 1702 | 1702 | ** |
| 1703 | -** Usage: %fossil timeline ?WHEN? ?BASELINE|DATETIME? ?OPTIONS? | |
| 1703 | +** Usage: %fossil timeline ?WHEN? ?CHECKIN|DATETIME? ?OPTIONS? | |
| 1704 | 1704 | ** |
| 1705 | 1705 | ** Print a summary of activity going backwards in date and time |
| 1706 | 1706 | ** specified or from the current date and time if no arguments |
| 1707 | 1707 | ** are given. The WHEN argument can be any unique abbreviation |
| 1708 | 1708 | ** of one of these keywords: |
| @@ -1718,10 +1718,12 @@ | ||
| 1718 | 1718 | ** for the current version or "now" for the current time. |
| 1719 | 1719 | ** |
| 1720 | 1720 | ** Options: |
| 1721 | 1721 | ** -n|--limit N Output the first N entries (default 20 lines). |
| 1722 | 1722 | ** N=0 means no limit. |
| 1723 | +** -p|--path PATH Output items affecting PATH only. | |
| 1724 | +** PATH can be a file or a sub directory. | |
| 1723 | 1725 | ** --offset P skip P changes |
| 1724 | 1726 | ** -t|--type TYPE Output items from the given types only, such as: |
| 1725 | 1727 | ** ci = file commits only |
| 1726 | 1728 | ** e = events only |
| 1727 | 1729 | ** t = tickets only |
| @@ -1759,10 +1761,12 @@ | ||
| 1759 | 1761 | } |
| 1760 | 1762 | db_find_and_open_repository(0, 0); |
| 1761 | 1763 | zLimit = find_option("limit","n",1); |
| 1762 | 1764 | zWidth = find_option("width","W",1); |
| 1763 | 1765 | zType = find_option("type","t",1); |
| 1766 | + zFilePattern = find_option("path","p",1); | |
| 1767 | + | |
| 1764 | 1768 | if( !zLimit ){ |
| 1765 | 1769 | zLimit = find_option("count",0,1); |
| 1766 | 1770 | } |
| 1767 | 1771 | if( zLimit ){ |
| 1768 | 1772 | n = atoi(zLimit); |
| @@ -1781,39 +1785,37 @@ | ||
| 1781 | 1785 | iOffset = zOffset ? atoi(zOffset) : 0; |
| 1782 | 1786 | |
| 1783 | 1787 | /* We should be done with options.. */ |
| 1784 | 1788 | verify_all_options(); |
| 1785 | 1789 | |
| 1786 | - zOrigin = "now"; | |
| 1787 | - zFilePattern = 0; | |
| 1788 | - for(i=2; i<g.argc; i++){ | |
| 1789 | - char *zArg = g.argv[i]; | |
| 1790 | - k = strlen(zArg); | |
| 1791 | - if( mode==0 ){ | |
| 1792 | - if( strncmp(zArg,"before",k)==0 ){ | |
| 1793 | - mode = 1; | |
| 1794 | - }else if( strncmp(zArg,"after",k)==0 && k>1 ){ | |
| 1795 | - mode = 2; | |
| 1796 | - }else if( strncmp(zArg,"descendants",k)==0 ){ | |
| 1797 | - mode = 3; | |
| 1798 | - }else if( strncmp(zArg,"children",k)==0 ){ | |
| 1799 | - mode = 3; | |
| 1800 | - }else if( strncmp(zArg,"ancestors",k)==0 && k>1 ){ | |
| 1801 | - mode = 4; | |
| 1802 | - }else if( strncmp(zArg,"parents",k)==0 ){ | |
| 1803 | - mode = 4; | |
| 1804 | - } | |
| 1805 | - if( mode ){ | |
| 1806 | - if( i<g.argc-1 ) zOrigin = g.argv[++i]; | |
| 1807 | - continue; | |
| 1808 | - } | |
| 1809 | - } | |
| 1810 | - if( zFilePattern==0 ){ | |
| 1811 | - zFilePattern = zArg; | |
| 1790 | + if( g.argc>=4 ){ | |
| 1791 | + k = strlen(g.argv[2]); | |
| 1792 | + if( strncmp(g.argv[2],"before",k)==0 ){ | |
| 1793 | + mode = 1; | |
| 1794 | + }else if( strncmp(g.argv[2],"after",k)==0 && k>1 ){ | |
| 1795 | + mode = 2; | |
| 1796 | + }else if( strncmp(g.argv[2],"descendants",k)==0 ){ | |
| 1797 | + mode = 3; | |
| 1798 | + }else if( strncmp(g.argv[2],"children",k)==0 ){ | |
| 1799 | + mode = 3; | |
| 1800 | + }else if( strncmp(g.argv[2],"ancestors",k)==0 && k>1 ){ | |
| 1801 | + mode = 4; | |
| 1802 | + }else if( strncmp(g.argv[2],"parents",k)==0 ){ | |
| 1803 | + mode = 4; | |
| 1804 | + }else if(!zType && !zLimit){ | |
| 1805 | + usage("?WHEN? ?CHECKIN|DATETIME? ?-n|--limit #? ?-t|--type TYPE? " | |
| 1806 | + "?-W|--width WIDTH? ?-p|--path PATH"); | |
| 1807 | + } | |
| 1808 | + if( '-' != *g.argv[3] ){ | |
| 1809 | + zOrigin = g.argv[3]; | |
| 1812 | 1810 | }else{ |
| 1813 | - usage("?WHEN? ?CHECKIN|DATETIME? ?FILE? ?OPTIONS?"); | |
| 1811 | + zOrigin = "now"; | |
| 1814 | 1812 | } |
| 1813 | + }else if( g.argc==3 ){ | |
| 1814 | + zOrigin = g.argv[2]; | |
| 1815 | + }else{ | |
| 1816 | + zOrigin = "now"; | |
| 1815 | 1817 | } |
| 1816 | 1818 | k = strlen(zOrigin); |
| 1817 | 1819 | blob_zero(&uuid); |
| 1818 | 1820 | blob_append(&uuid, zOrigin, -1); |
| 1819 | 1821 | if( fossil_strcmp(zOrigin, "now")==0 ){ |
| 1820 | 1822 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1698,11 +1698,11 @@ | |
| 1698 | } |
| 1699 | |
| 1700 | /* |
| 1701 | ** COMMAND: timeline |
| 1702 | ** |
| 1703 | ** Usage: %fossil timeline ?WHEN? ?BASELINE|DATETIME? ?OPTIONS? |
| 1704 | ** |
| 1705 | ** Print a summary of activity going backwards in date and time |
| 1706 | ** specified or from the current date and time if no arguments |
| 1707 | ** are given. The WHEN argument can be any unique abbreviation |
| 1708 | ** of one of these keywords: |
| @@ -1718,10 +1718,12 @@ | |
| 1718 | ** for the current version or "now" for the current time. |
| 1719 | ** |
| 1720 | ** Options: |
| 1721 | ** -n|--limit N Output the first N entries (default 20 lines). |
| 1722 | ** N=0 means no limit. |
| 1723 | ** --offset P skip P changes |
| 1724 | ** -t|--type TYPE Output items from the given types only, such as: |
| 1725 | ** ci = file commits only |
| 1726 | ** e = events only |
| 1727 | ** t = tickets only |
| @@ -1759,10 +1761,12 @@ | |
| 1759 | } |
| 1760 | db_find_and_open_repository(0, 0); |
| 1761 | zLimit = find_option("limit","n",1); |
| 1762 | zWidth = find_option("width","W",1); |
| 1763 | zType = find_option("type","t",1); |
| 1764 | if( !zLimit ){ |
| 1765 | zLimit = find_option("count",0,1); |
| 1766 | } |
| 1767 | if( zLimit ){ |
| 1768 | n = atoi(zLimit); |
| @@ -1781,39 +1785,37 @@ | |
| 1781 | iOffset = zOffset ? atoi(zOffset) : 0; |
| 1782 | |
| 1783 | /* We should be done with options.. */ |
| 1784 | verify_all_options(); |
| 1785 | |
| 1786 | zOrigin = "now"; |
| 1787 | zFilePattern = 0; |
| 1788 | for(i=2; i<g.argc; i++){ |
| 1789 | char *zArg = g.argv[i]; |
| 1790 | k = strlen(zArg); |
| 1791 | if( mode==0 ){ |
| 1792 | if( strncmp(zArg,"before",k)==0 ){ |
| 1793 | mode = 1; |
| 1794 | }else if( strncmp(zArg,"after",k)==0 && k>1 ){ |
| 1795 | mode = 2; |
| 1796 | }else if( strncmp(zArg,"descendants",k)==0 ){ |
| 1797 | mode = 3; |
| 1798 | }else if( strncmp(zArg,"children",k)==0 ){ |
| 1799 | mode = 3; |
| 1800 | }else if( strncmp(zArg,"ancestors",k)==0 && k>1 ){ |
| 1801 | mode = 4; |
| 1802 | }else if( strncmp(zArg,"parents",k)==0 ){ |
| 1803 | mode = 4; |
| 1804 | } |
| 1805 | if( mode ){ |
| 1806 | if( i<g.argc-1 ) zOrigin = g.argv[++i]; |
| 1807 | continue; |
| 1808 | } |
| 1809 | } |
| 1810 | if( zFilePattern==0 ){ |
| 1811 | zFilePattern = zArg; |
| 1812 | }else{ |
| 1813 | usage("?WHEN? ?CHECKIN|DATETIME? ?FILE? ?OPTIONS?"); |
| 1814 | } |
| 1815 | } |
| 1816 | k = strlen(zOrigin); |
| 1817 | blob_zero(&uuid); |
| 1818 | blob_append(&uuid, zOrigin, -1); |
| 1819 | if( fossil_strcmp(zOrigin, "now")==0 ){ |
| 1820 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1698,11 +1698,11 @@ | |
| 1698 | } |
| 1699 | |
| 1700 | /* |
| 1701 | ** COMMAND: timeline |
| 1702 | ** |
| 1703 | ** Usage: %fossil timeline ?WHEN? ?CHECKIN|DATETIME? ?OPTIONS? |
| 1704 | ** |
| 1705 | ** Print a summary of activity going backwards in date and time |
| 1706 | ** specified or from the current date and time if no arguments |
| 1707 | ** are given. The WHEN argument can be any unique abbreviation |
| 1708 | ** of one of these keywords: |
| @@ -1718,10 +1718,12 @@ | |
| 1718 | ** for the current version or "now" for the current time. |
| 1719 | ** |
| 1720 | ** Options: |
| 1721 | ** -n|--limit N Output the first N entries (default 20 lines). |
| 1722 | ** N=0 means no limit. |
| 1723 | ** -p|--path PATH Output items affecting PATH only. |
| 1724 | ** PATH can be a file or a sub directory. |
| 1725 | ** --offset P skip P changes |
| 1726 | ** -t|--type TYPE Output items from the given types only, such as: |
| 1727 | ** ci = file commits only |
| 1728 | ** e = events only |
| 1729 | ** t = tickets only |
| @@ -1759,10 +1761,12 @@ | |
| 1761 | } |
| 1762 | db_find_and_open_repository(0, 0); |
| 1763 | zLimit = find_option("limit","n",1); |
| 1764 | zWidth = find_option("width","W",1); |
| 1765 | zType = find_option("type","t",1); |
| 1766 | zFilePattern = find_option("path","p",1); |
| 1767 | |
| 1768 | if( !zLimit ){ |
| 1769 | zLimit = find_option("count",0,1); |
| 1770 | } |
| 1771 | if( zLimit ){ |
| 1772 | n = atoi(zLimit); |
| @@ -1781,39 +1785,37 @@ | |
| 1785 | iOffset = zOffset ? atoi(zOffset) : 0; |
| 1786 | |
| 1787 | /* We should be done with options.. */ |
| 1788 | verify_all_options(); |
| 1789 | |
| 1790 | if( g.argc>=4 ){ |
| 1791 | k = strlen(g.argv[2]); |
| 1792 | if( strncmp(g.argv[2],"before",k)==0 ){ |
| 1793 | mode = 1; |
| 1794 | }else if( strncmp(g.argv[2],"after",k)==0 && k>1 ){ |
| 1795 | mode = 2; |
| 1796 | }else if( strncmp(g.argv[2],"descendants",k)==0 ){ |
| 1797 | mode = 3; |
| 1798 | }else if( strncmp(g.argv[2],"children",k)==0 ){ |
| 1799 | mode = 3; |
| 1800 | }else if( strncmp(g.argv[2],"ancestors",k)==0 && k>1 ){ |
| 1801 | mode = 4; |
| 1802 | }else if( strncmp(g.argv[2],"parents",k)==0 ){ |
| 1803 | mode = 4; |
| 1804 | }else if(!zType && !zLimit){ |
| 1805 | usage("?WHEN? ?CHECKIN|DATETIME? ?-n|--limit #? ?-t|--type TYPE? " |
| 1806 | "?-W|--width WIDTH? ?-p|--path PATH"); |
| 1807 | } |
| 1808 | if( '-' != *g.argv[3] ){ |
| 1809 | zOrigin = g.argv[3]; |
| 1810 | }else{ |
| 1811 | zOrigin = "now"; |
| 1812 | } |
| 1813 | }else if( g.argc==3 ){ |
| 1814 | zOrigin = g.argv[2]; |
| 1815 | }else{ |
| 1816 | zOrigin = "now"; |
| 1817 | } |
| 1818 | k = strlen(zOrigin); |
| 1819 | blob_zero(&uuid); |
| 1820 | blob_append(&uuid, zOrigin, -1); |
| 1821 | if( fossil_strcmp(zOrigin, "now")==0 ){ |
| 1822 |