Fossil SCM

Add option --offset to "fossil timeline"

jan.nijtmans 2013-11-12 08:58 trunk
Commit 32a9b55e17d68f6998babf061c013a44471d991e
+3 -2
--- src/finfo.c
+++ src/finfo.c
@@ -49,11 +49,12 @@
4949
** --offset P skip P changes
5050
** -p|--print select print mode
5151
** -r|--revision R print the given revision (or ckout, if none is given)
5252
** to stdout (only in print mode)
5353
** -s|--status select status mode (print a status indicator for FILE)
54
-** -W|--width <num> With of lines (default 79). Must be >22 or 0.
54
+** -W|--width <num> With of lines (default 79). Must be >22 or 0
55
+** (= no limit, resulting in a single line per entry).
5556
**
5657
** See also: artifact, cat, descendants, info, leaves
5758
*/
5859
void finfo_cmd(void){
5960
capture_case_sensitive_option();
@@ -204,11 +205,11 @@
204205
blob_appendf(&line, "%.10s ", zCiUuid);
205206
blob_appendf(&line, "%.10s ", zDate);
206207
blob_appendf(&line, "%8.8s ", zUser);
207208
blob_appendf(&line, "%8.8s ", zBr);
208209
blob_appendf(&line,"%-39.39s", zCom );
209
- comment_print(blob_str(&line), 0, 79);
210
+ comment_print(blob_str(&line), 0, iWidth);
210211
}
211212
}
212213
db_finalize(&q);
213214
blob_reset(&fname);
214215
}
215216
--- src/finfo.c
+++ src/finfo.c
@@ -49,11 +49,12 @@
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 ** -W|--width <num> With of lines (default 79). Must be >22 or 0.
 
55 **
56 ** See also: artifact, cat, descendants, info, leaves
57 */
58 void finfo_cmd(void){
59 capture_case_sensitive_option();
@@ -204,11 +205,11 @@
204 blob_appendf(&line, "%.10s ", zCiUuid);
205 blob_appendf(&line, "%.10s ", zDate);
206 blob_appendf(&line, "%8.8s ", zUser);
207 blob_appendf(&line, "%8.8s ", zBr);
208 blob_appendf(&line,"%-39.39s", zCom );
209 comment_print(blob_str(&line), 0, 79);
210 }
211 }
212 db_finalize(&q);
213 blob_reset(&fname);
214 }
215
--- src/finfo.c
+++ src/finfo.c
@@ -49,11 +49,12 @@
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 ** -W|--width <num> With of lines (default 79). Must be >22 or 0
55 ** (= no limit, resulting in a single line per entry).
56 **
57 ** See also: artifact, cat, descendants, info, leaves
58 */
59 void finfo_cmd(void){
60 capture_case_sensitive_option();
@@ -204,11 +205,11 @@
205 blob_appendf(&line, "%.10s ", zCiUuid);
206 blob_appendf(&line, "%.10s ", zDate);
207 blob_appendf(&line, "%8.8s ", zUser);
208 blob_appendf(&line, "%8.8s ", zBr);
209 blob_appendf(&line,"%-39.39s", zCom );
210 comment_print(blob_str(&line), 0, iWidth);
211 }
212 }
213 db_finalize(&q);
214 blob_reset(&fname);
215 }
216
+11 -1
--- src/timeline.c
+++ src/timeline.c
@@ -1683,33 +1683,38 @@
16831683
** for the current version or "now" for the current time.
16841684
**
16851685
** Options:
16861686
** -n|--limit N Output the first N entries (default 20 lines).
16871687
** N=0 means no limit.
1688
+** --offset P skip P changes
16881689
** -t|--type TYPE Output items from the given types only, such as:
16891690
** ci = file commits only
16901691
** e = events only
16911692
** t = tickets only
16921693
** w = wiki commits only
16931694
** -v|--verbose Output the list of files changed by each commit
16941695
** and the type of each change (edited, deleted,
16951696
** etc.) after the checkin comment.
1696
-** -W|--width <num> With of lines (default 79). Must be >20 or 0.
1697
+** -W|--width <num> With of lines (default 79). Must be >20 or 0
1698
+** (= no limit, resulting in a single line per entry).
16971699
*/
16981700
void timeline_cmd(void){
16991701
Stmt q;
17001702
int n, k, width;
17011703
const char *zLimit;
17021704
const char *zWidth;
1705
+ const char *zOffset;
17031706
const char *zType;
17041707
char *zOrigin;
17051708
char *zDate;
17061709
Blob sql;
17071710
int objid = 0;
17081711
Blob uuid;
17091712
int mode = 0 ; /* 0:none 1: before 2:after 3:children 4:parents */
17101713
int verboseFlag = 0 ;
1714
+ int iOffset;
1715
+
17111716
verboseFlag = find_option("verbose","v", 0)!=0;
17121717
if( !verboseFlag){
17131718
verboseFlag = find_option("showfiles","f", 0)!=0; /* deprecated */
17141719
}
17151720
db_find_and_open_repository(0, 0);
@@ -1730,10 +1735,12 @@
17301735
fossil_fatal("--width|-W value must be >20 or 0");
17311736
}
17321737
}else{
17331738
width = 79;
17341739
}
1740
+ zOffset = find_option("offset",0,1);
1741
+ iOffset = zOffset ? atoi(zOffset) : 0;
17351742
if( g.argc>=4 ){
17361743
k = strlen(g.argv[2]);
17371744
if( strncmp(g.argv[2],"before",k)==0 ){
17381745
mode = 1;
17391746
}else if( strncmp(g.argv[2],"after",k)==0 && k>1 ){
@@ -1805,10 +1812,13 @@
18051812
}
18061813
if( zType && (zType[0]!='a') ){
18071814
blob_appendf(&sql, " AND event.type=%Q ", zType);
18081815
}
18091816
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
+ }
18101820
db_prepare(&q, blob_str(&sql));
18111821
blob_reset(&sql);
18121822
print_timeline(&q, n, width, verboseFlag);
18131823
db_finalize(&q);
18141824
}
18151825
--- src/timeline.c
+++ src/timeline.c
@@ -1683,33 +1683,38 @@
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
1693 ** -v|--verbose Output the list of files changed by each commit
1694 ** and the type of each change (edited, deleted,
1695 ** etc.) after the checkin comment.
1696 ** -W|--width <num> With of lines (default 79). Must be >20 or 0.
 
1697 */
1698 void timeline_cmd(void){
1699 Stmt q;
1700 int n, k, width;
1701 const char *zLimit;
1702 const char *zWidth;
 
1703 const char *zType;
1704 char *zOrigin;
1705 char *zDate;
1706 Blob sql;
1707 int objid = 0;
1708 Blob uuid;
1709 int mode = 0 ; /* 0:none 1: before 2:after 3:children 4:parents */
1710 int verboseFlag = 0 ;
 
 
1711 verboseFlag = find_option("verbose","v", 0)!=0;
1712 if( !verboseFlag){
1713 verboseFlag = find_option("showfiles","f", 0)!=0; /* deprecated */
1714 }
1715 db_find_and_open_repository(0, 0);
@@ -1730,10 +1735,12 @@
1730 fossil_fatal("--width|-W value must be >20 or 0");
1731 }
1732 }else{
1733 width = 79;
1734 }
 
 
1735 if( g.argc>=4 ){
1736 k = strlen(g.argv[2]);
1737 if( strncmp(g.argv[2],"before",k)==0 ){
1738 mode = 1;
1739 }else if( strncmp(g.argv[2],"after",k)==0 && k>1 ){
@@ -1805,10 +1812,13 @@
1805 }
1806 if( zType && (zType[0]!='a') ){
1807 blob_appendf(&sql, " AND event.type=%Q ", zType);
1808 }
1809 blob_appendf(&sql, " ORDER BY event.mtime DESC");
 
 
 
1810 db_prepare(&q, blob_str(&sql));
1811 blob_reset(&sql);
1812 print_timeline(&q, n, width, verboseFlag);
1813 db_finalize(&q);
1814 }
1815
--- src/timeline.c
+++ src/timeline.c
@@ -1683,33 +1683,38 @@
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 ** --offset P skip P changes
1689 ** -t|--type TYPE Output items from the given types only, such as:
1690 ** ci = file commits only
1691 ** e = events only
1692 ** t = tickets only
1693 ** w = wiki commits only
1694 ** -v|--verbose Output the list of files changed by each commit
1695 ** and the type of each change (edited, deleted,
1696 ** etc.) after the checkin comment.
1697 ** -W|--width <num> With of lines (default 79). Must be >20 or 0
1698 ** (= no limit, resulting in a single line per entry).
1699 */
1700 void timeline_cmd(void){
1701 Stmt q;
1702 int n, k, width;
1703 const char *zLimit;
1704 const char *zWidth;
1705 const char *zOffset;
1706 const char *zType;
1707 char *zOrigin;
1708 char *zDate;
1709 Blob sql;
1710 int objid = 0;
1711 Blob uuid;
1712 int mode = 0 ; /* 0:none 1: before 2:after 3:children 4:parents */
1713 int verboseFlag = 0 ;
1714 int iOffset;
1715
1716 verboseFlag = find_option("verbose","v", 0)!=0;
1717 if( !verboseFlag){
1718 verboseFlag = find_option("showfiles","f", 0)!=0; /* deprecated */
1719 }
1720 db_find_and_open_repository(0, 0);
@@ -1730,10 +1735,12 @@
1735 fossil_fatal("--width|-W value must be >20 or 0");
1736 }
1737 }else{
1738 width = 79;
1739 }
1740 zOffset = find_option("offset",0,1);
1741 iOffset = zOffset ? atoi(zOffset) : 0;
1742 if( g.argc>=4 ){
1743 k = strlen(g.argv[2]);
1744 if( strncmp(g.argv[2],"before",k)==0 ){
1745 mode = 1;
1746 }else if( strncmp(g.argv[2],"after",k)==0 && k>1 ){
@@ -1805,10 +1812,13 @@
1812 }
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 }
1825
--- www/changes.wiki
+++ www/changes.wiki
@@ -18,11 +18,11 @@
1818
supply REQUEST_URI.
1919
* Add options --dirsonly, --emptydirs, and --allckouts to the
2020
"[/help?cmd=clean | fossil clean]" command.
2121
* Ten-fold performance improvement in large "fossil blame" or
2222
"fossil annotate" commands.
23
- * Add option -W|--width to the "[/help?cmd=timeline | fossil timeline]"
23
+ * Add option -W|--width and --offset to "[/help?cmd=timeline | fossil timeline]"
2424
and "[/help?cmd=finfo | fossil finfo]" commands.
2525
* Option -n|--limit of "[/help?cmd=timeline | fossil timeline]" now
2626
specifies the number of entries, just like all other commands which
2727
have the -n|--limit option. The various timeline-related functions
2828
now output "--- ?? limit (??) reached ---" at the end whenever
2929
--- www/changes.wiki
+++ www/changes.wiki
@@ -18,11 +18,11 @@
18 supply REQUEST_URI.
19 * Add options --dirsonly, --emptydirs, and --allckouts to the
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
--- www/changes.wiki
+++ www/changes.wiki
@@ -18,11 +18,11 @@
18 supply REQUEST_URI.
19 * Add options --dirsonly, --emptydirs, and --allckouts to the
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 and --offset to "[/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

Keyboard Shortcuts

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