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.)

mgagnon 2014-10-20 21:37 trunk
Commit 1e870e1e06c202a855afcd364826b35dbdb6d8ef
1 file changed +30 -28
+30 -28
--- src/timeline.c
+++ src/timeline.c
@@ -1698,11 +1698,11 @@
16981698
}
16991699
17001700
/*
17011701
** COMMAND: timeline
17021702
**
1703
-** Usage: %fossil timeline ?WHEN? ?BASELINE|DATETIME? ?OPTIONS?
1703
+** Usage: %fossil timeline ?WHEN? ?CHECKIN|DATETIME? ?OPTIONS?
17041704
**
17051705
** Print a summary of activity going backwards in date and time
17061706
** specified or from the current date and time if no arguments
17071707
** are given. The WHEN argument can be any unique abbreviation
17081708
** of one of these keywords:
@@ -1718,10 +1718,12 @@
17181718
** for the current version or "now" for the current time.
17191719
**
17201720
** Options:
17211721
** -n|--limit N Output the first N entries (default 20 lines).
17221722
** N=0 means no limit.
1723
+** -p|--path PATH Output items affecting PATH only.
1724
+** PATH can be a file or a sub directory.
17231725
** --offset P skip P changes
17241726
** -t|--type TYPE Output items from the given types only, such as:
17251727
** ci = file commits only
17261728
** e = events only
17271729
** t = tickets only
@@ -1759,10 +1761,12 @@
17591761
}
17601762
db_find_and_open_repository(0, 0);
17611763
zLimit = find_option("limit","n",1);
17621764
zWidth = find_option("width","W",1);
17631765
zType = find_option("type","t",1);
1766
+ zFilePattern = find_option("path","p",1);
1767
+
17641768
if( !zLimit ){
17651769
zLimit = find_option("count",0,1);
17661770
}
17671771
if( zLimit ){
17681772
n = atoi(zLimit);
@@ -1781,39 +1785,37 @@
17811785
iOffset = zOffset ? atoi(zOffset) : 0;
17821786
17831787
/* We should be done with options.. */
17841788
verify_all_options();
17851789
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];
18121810
}else{
1813
- usage("?WHEN? ?CHECKIN|DATETIME? ?FILE? ?OPTIONS?");
1811
+ zOrigin = "now";
18141812
}
1813
+ }else if( g.argc==3 ){
1814
+ zOrigin = g.argv[2];
1815
+ }else{
1816
+ zOrigin = "now";
18151817
}
18161818
k = strlen(zOrigin);
18171819
blob_zero(&uuid);
18181820
blob_append(&uuid, zOrigin, -1);
18191821
if( fossil_strcmp(zOrigin, "now")==0 ){
18201822
--- 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

Keyboard Shortcuts

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