Fossil SCM

Make sure the --width option is honored by all calls into print_timeline().

mistachkin 2014-06-20 20:54 trunk
Commit e3df30f45c920682febe0e8ac886f434e5840898
--- src/descendants.c
+++ src/descendants.c
@@ -291,18 +291,31 @@
291291
** Find all leaf descendants of the baseline specified or if the argument
292292
** is omitted, of the baseline currently checked out.
293293
**
294294
** Options:
295295
** -R|--repository FILE Extract info from repository FILE
296
+** -W|--width <num> Width of lines (default is to auto-detect).
297
+** Must be >20 or 0 (= no limit, resulting in a
298
+** single line per entry).
296299
**
297300
** See also: finfo, info, leaves
298301
*/
299302
void descendants_cmd(void){
300303
Stmt q;
301
- int base;
304
+ int base, width;
305
+ const char *zWidth;
302306
303307
db_find_and_open_repository(0,0);
308
+ zWidth = find_option("width","W",1);
309
+ if( zWidth ){
310
+ width = atoi(zWidth);
311
+ if( (width!=0) && (width<=20) ){
312
+ fossil_fatal("-W|--width value must be >20 or 0");
313
+ }
314
+ }else{
315
+ width = -1;
316
+ }
304317
if( g.argc==2 ){
305318
base = db_lget_int("checkout", 0);
306319
}else{
307320
base = name_to_typed_rid(g.argv[2], "ci");
308321
}
@@ -312,11 +325,11 @@
312325
"%s"
313326
" AND event.objid IN (SELECT rid FROM leaves)"
314327
" ORDER BY event.mtime DESC",
315328
timeline_query_for_tty()
316329
);
317
- print_timeline(&q, -20, 79, 0);
330
+ print_timeline(&q, -20, width, 0);
318331
db_finalize(&q);
319332
}
320333
321334
/*
322335
** COMMAND: leaves*
@@ -333,12 +346,13 @@
333346
** Options:
334347
** -a|--all show ALL leaves
335348
** -c|--closed show only closed leaves
336349
** --bybranch order output by branch name
337350
** --recompute recompute the "leaf" table in the repository DB
338
-** -W|--width <num> With of lines (default 79). Must be >39 or 0
339
-** (= no limit, resulting in a single line per entry).
351
+** -W|--width <num> Width of lines (default is to auto-detect). Must be
352
+** >39 or 0 (= no limit, resulting in a single line per
353
+** entry).
340354
**
341355
** See also: descendants, finfo, info, branch
342356
*/
343357
void leaves_cmd(void){
344358
Stmt q;
345359
--- src/descendants.c
+++ src/descendants.c
@@ -291,18 +291,31 @@
291 ** Find all leaf descendants of the baseline specified or if the argument
292 ** is omitted, of the baseline currently checked out.
293 **
294 ** Options:
295 ** -R|--repository FILE Extract info from repository FILE
 
 
 
296 **
297 ** See also: finfo, info, leaves
298 */
299 void descendants_cmd(void){
300 Stmt q;
301 int base;
 
302
303 db_find_and_open_repository(0,0);
 
 
 
 
 
 
 
 
 
304 if( g.argc==2 ){
305 base = db_lget_int("checkout", 0);
306 }else{
307 base = name_to_typed_rid(g.argv[2], "ci");
308 }
@@ -312,11 +325,11 @@
312 "%s"
313 " AND event.objid IN (SELECT rid FROM leaves)"
314 " ORDER BY event.mtime DESC",
315 timeline_query_for_tty()
316 );
317 print_timeline(&q, -20, 79, 0);
318 db_finalize(&q);
319 }
320
321 /*
322 ** COMMAND: leaves*
@@ -333,12 +346,13 @@
333 ** Options:
334 ** -a|--all show ALL leaves
335 ** -c|--closed show only closed leaves
336 ** --bybranch order output by branch name
337 ** --recompute recompute the "leaf" table in the repository DB
338 ** -W|--width <num> With of lines (default 79). Must be >39 or 0
339 ** (= no limit, resulting in a single line per entry).
 
340 **
341 ** See also: descendants, finfo, info, branch
342 */
343 void leaves_cmd(void){
344 Stmt q;
345
--- src/descendants.c
+++ src/descendants.c
@@ -291,18 +291,31 @@
291 ** Find all leaf descendants of the baseline specified or if the argument
292 ** is omitted, of the baseline currently checked out.
293 **
294 ** Options:
295 ** -R|--repository FILE Extract info from repository FILE
296 ** -W|--width <num> Width of lines (default is to auto-detect).
297 ** Must be >20 or 0 (= no limit, resulting in a
298 ** single line per entry).
299 **
300 ** See also: finfo, info, leaves
301 */
302 void descendants_cmd(void){
303 Stmt q;
304 int base, width;
305 const char *zWidth;
306
307 db_find_and_open_repository(0,0);
308 zWidth = find_option("width","W",1);
309 if( zWidth ){
310 width = atoi(zWidth);
311 if( (width!=0) && (width<=20) ){
312 fossil_fatal("-W|--width value must be >20 or 0");
313 }
314 }else{
315 width = -1;
316 }
317 if( g.argc==2 ){
318 base = db_lget_int("checkout", 0);
319 }else{
320 base = name_to_typed_rid(g.argv[2], "ci");
321 }
@@ -312,11 +325,11 @@
325 "%s"
326 " AND event.objid IN (SELECT rid FROM leaves)"
327 " ORDER BY event.mtime DESC",
328 timeline_query_for_tty()
329 );
330 print_timeline(&q, -20, width, 0);
331 db_finalize(&q);
332 }
333
334 /*
335 ** COMMAND: leaves*
@@ -333,12 +346,13 @@
346 ** Options:
347 ** -a|--all show ALL leaves
348 ** -c|--closed show only closed leaves
349 ** --bybranch order output by branch name
350 ** --recompute recompute the "leaf" table in the repository DB
351 ** -W|--width <num> Width of lines (default is to auto-detect). Must be
352 ** >39 or 0 (= no limit, resulting in a single line per
353 ** entry).
354 **
355 ** See also: descendants, finfo, info, branch
356 */
357 void leaves_cmd(void){
358 Stmt q;
359
+3 -2
--- src/finfo.c
+++ src/finfo.c
@@ -49,12 +49,13 @@
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
55
-** (= no limit, resulting in a single line per entry).
54
+** -W|--width <num> Width of lines (default is to auto-detect). Must be
55
+** >22 or 0 (= no limit, resulting in a single line per
56
+** entry).
5657
**
5758
** See also: artifact, cat, descendants, info, leaves
5859
*/
5960
void finfo_cmd(void){
6061
capture_case_sensitive_option();
6162
--- src/finfo.c
+++ src/finfo.c
@@ -49,12 +49,13 @@
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();
61
--- src/finfo.c
+++ src/finfo.c
@@ -49,12 +49,13 @@
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> Width of lines (default is to auto-detect). Must be
55 ** >22 or 0 (= no limit, resulting in a single line per
56 ** entry).
57 **
58 ** See also: artifact, cat, descendants, info, leaves
59 */
60 void finfo_cmd(void){
61 capture_case_sensitive_option();
62
+3 -2
--- src/timeline.c
+++ src/timeline.c
@@ -1737,12 +1737,13 @@
17371737
** t = tickets only
17381738
** w = wiki commits only
17391739
** -v|--verbose Output the list of files changed by each commit
17401740
** and the type of each change (edited, deleted,
17411741
** etc.) after the checkin comment.
1742
-** -W|--width <num> With of lines (default 79). Must be >20 or 0
1743
-** (= no limit, resulting in a single line per entry).
1742
+** -W|--width <num> Width of lines (default is to auto-detect). Must be
1743
+** >20 or 0 (= no limit, resulting in a single line per
1744
+** entry).
17441745
** -R REPO_FILE Specifies the repository db to use. Default is
17451746
** the current checkout's repository.
17461747
*/
17471748
void timeline_cmd(void){
17481749
Stmt q;
17491750
--- src/timeline.c
+++ src/timeline.c
@@ -1737,12 +1737,13 @@
1737 ** t = tickets only
1738 ** w = wiki commits only
1739 ** -v|--verbose Output the list of files changed by each commit
1740 ** and the type of each change (edited, deleted,
1741 ** etc.) after the checkin comment.
1742 ** -W|--width <num> With of lines (default 79). Must be >20 or 0
1743 ** (= no limit, resulting in a single line per entry).
 
1744 ** -R REPO_FILE Specifies the repository db to use. Default is
1745 ** the current checkout's repository.
1746 */
1747 void timeline_cmd(void){
1748 Stmt q;
1749
--- src/timeline.c
+++ src/timeline.c
@@ -1737,12 +1737,13 @@
1737 ** t = tickets only
1738 ** w = wiki commits only
1739 ** -v|--verbose Output the list of files changed by each commit
1740 ** and the type of each change (edited, deleted,
1741 ** etc.) after the checkin comment.
1742 ** -W|--width <num> Width of lines (default is to auto-detect). Must be
1743 ** >20 or 0 (= no limit, resulting in a single line per
1744 ** entry).
1745 ** -R REPO_FILE Specifies the repository db to use. Default is
1746 ** the current checkout's repository.
1747 */
1748 void timeline_cmd(void){
1749 Stmt q;
1750
+14 -1
--- src/update.c
+++ src/update.c
@@ -91,10 +91,12 @@
9191
** --debug print debug information on stdout
9292
** --latest acceptable in place of VERSION, update to latest version
9393
** --force-missing force update if missing content after sync
9494
** -n|--dry-run If given, display instead of run actions
9595
** -v|--verbose print status information about all files
96
+** -W|--width <num> Width of lines (default is to auto-detect). Must be >20
97
+** or 0 (= no limit, resulting in a single line per entry).
9698
**
9799
** See also: revert
98100
*/
99101
void update_cmd(void){
100102
int vid; /* Current version */
@@ -110,15 +112,26 @@
110112
int *aChng; /* Array of file renames */
111113
int i; /* Loop counter */
112114
int nConflict = 0; /* Number of merge conflicts */
113115
int nOverwrite = 0; /* Number of unmanaged files overwritten */
114116
int nUpdate = 0; /* Number of changes of any kind */
117
+ int width; /* Width of printed comment lines */
115118
Stmt mtimeXfer; /* Statement to transfer mtimes */
119
+ const char *zWidth; /* Width option string value */
116120
117121
if( !internalUpdate ){
118122
undo_capture_command_line();
119123
url_proxy_options();
124
+ }
125
+ zWidth = find_option("width","W",1);
126
+ if( zWidth ){
127
+ width = atoi(zWidth);
128
+ if( (width!=0) && (width<=20) ){
129
+ fossil_fatal("-W|--width value must be >20 or 0");
130
+ }
131
+ }else{
132
+ width = -1;
120133
}
121134
latestFlag = find_option("latest",0, 0)!=0;
122135
dryRunFlag = find_option("dry-run","n",0)!=0;
123136
if( !dryRunFlag ){
124137
dryRunFlag = find_option("nochange",0,0)!=0; /* deprecated */
@@ -191,11 +204,11 @@
191204
"%s "
192205
" AND event.objid IN leaves"
193206
" ORDER BY event.mtime DESC",
194207
timeline_query_for_tty()
195208
);
196
- print_timeline(&q, -100, 79, 0);
209
+ print_timeline(&q, -100, width, 0);
197210
db_finalize(&q);
198211
fossil_fatal("Multiple descendants");
199212
}
200213
}
201214
tid = db_int(0, "SELECT rid FROM leaves, event"
202215
--- src/update.c
+++ src/update.c
@@ -91,10 +91,12 @@
91 ** --debug print debug information on stdout
92 ** --latest acceptable in place of VERSION, update to latest version
93 ** --force-missing force update if missing content after sync
94 ** -n|--dry-run If given, display instead of run actions
95 ** -v|--verbose print status information about all files
 
 
96 **
97 ** See also: revert
98 */
99 void update_cmd(void){
100 int vid; /* Current version */
@@ -110,15 +112,26 @@
110 int *aChng; /* Array of file renames */
111 int i; /* Loop counter */
112 int nConflict = 0; /* Number of merge conflicts */
113 int nOverwrite = 0; /* Number of unmanaged files overwritten */
114 int nUpdate = 0; /* Number of changes of any kind */
 
115 Stmt mtimeXfer; /* Statement to transfer mtimes */
 
116
117 if( !internalUpdate ){
118 undo_capture_command_line();
119 url_proxy_options();
 
 
 
 
 
 
 
 
 
120 }
121 latestFlag = find_option("latest",0, 0)!=0;
122 dryRunFlag = find_option("dry-run","n",0)!=0;
123 if( !dryRunFlag ){
124 dryRunFlag = find_option("nochange",0,0)!=0; /* deprecated */
@@ -191,11 +204,11 @@
191 "%s "
192 " AND event.objid IN leaves"
193 " ORDER BY event.mtime DESC",
194 timeline_query_for_tty()
195 );
196 print_timeline(&q, -100, 79, 0);
197 db_finalize(&q);
198 fossil_fatal("Multiple descendants");
199 }
200 }
201 tid = db_int(0, "SELECT rid FROM leaves, event"
202
--- src/update.c
+++ src/update.c
@@ -91,10 +91,12 @@
91 ** --debug print debug information on stdout
92 ** --latest acceptable in place of VERSION, update to latest version
93 ** --force-missing force update if missing content after sync
94 ** -n|--dry-run If given, display instead of run actions
95 ** -v|--verbose print status information about all files
96 ** -W|--width <num> Width of lines (default is to auto-detect). Must be >20
97 ** or 0 (= no limit, resulting in a single line per entry).
98 **
99 ** See also: revert
100 */
101 void update_cmd(void){
102 int vid; /* Current version */
@@ -110,15 +112,26 @@
112 int *aChng; /* Array of file renames */
113 int i; /* Loop counter */
114 int nConflict = 0; /* Number of merge conflicts */
115 int nOverwrite = 0; /* Number of unmanaged files overwritten */
116 int nUpdate = 0; /* Number of changes of any kind */
117 int width; /* Width of printed comment lines */
118 Stmt mtimeXfer; /* Statement to transfer mtimes */
119 const char *zWidth; /* Width option string value */
120
121 if( !internalUpdate ){
122 undo_capture_command_line();
123 url_proxy_options();
124 }
125 zWidth = find_option("width","W",1);
126 if( zWidth ){
127 width = atoi(zWidth);
128 if( (width!=0) && (width<=20) ){
129 fossil_fatal("-W|--width value must be >20 or 0");
130 }
131 }else{
132 width = -1;
133 }
134 latestFlag = find_option("latest",0, 0)!=0;
135 dryRunFlag = find_option("dry-run","n",0)!=0;
136 if( !dryRunFlag ){
137 dryRunFlag = find_option("nochange",0,0)!=0; /* deprecated */
@@ -191,11 +204,11 @@
204 "%s "
205 " AND event.objid IN leaves"
206 " ORDER BY event.mtime DESC",
207 timeline_query_for_tty()
208 );
209 print_timeline(&q, -100, width, 0);
210 db_finalize(&q);
211 fossil_fatal("Multiple descendants");
212 }
213 }
214 tid = db_int(0, "SELECT rid FROM leaves, event"
215

Keyboard Shortcuts

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