Fossil SCM

Add option -W|--width to "[/help?cmd=stash|fossil stash ls]" and "[/help?cmd=leaves|fossil leaves]" commands.

jan.nijtmans 2014-04-23 14:14 trunk
Commit fa6ece72b6e55feeaee7ec31d4f4fd798d8b8389
--- src/descendants.c
+++ src/descendants.c
@@ -329,14 +329,16 @@
329329
**
330330
** The --recompute flag causes the content of the "leaf" table in the
331331
** repository database to be recomputed.
332332
**
333333
** 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
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).
338340
**
339341
** See also: descendants, finfo, info, branch
340342
*/
341343
void leaves_cmd(void){
342344
Stmt q;
@@ -343,14 +345,23 @@
343345
Blob sql;
344346
int showAll = find_option("all", "a", 0)!=0;
345347
int showClosed = find_option("closed", "c", 0)!=0;
346348
int recomputeFlag = find_option("recompute",0,0)!=0;
347349
int byBranch = find_option("bybranch",0,0)!=0;
350
+ const char *zWidth = find_option("width","W",1);
348351
char *zLastBr = 0;
349
- int n;
352
+ int n, width;
350353
char zLineNo[10];
351354
355
+ if( zWidth ){
356
+ width = atoi(zWidth);
357
+ if( (width!=0) && (width<=39) ){
358
+ fossil_fatal("-W|--width value must be >39 or 0");
359
+ }
360
+ }else{
361
+ width = 79;
362
+ }
352363
db_find_and_open_repository(0,0);
353364
if( recomputeFlag ) leaf_rebuild();
354365
blob_zero(&sql);
355366
blob_append(&sql, timeline_query_for_tty(), -1);
356367
blob_appendf(&sql, " AND blob.rid IN leaf");
@@ -382,11 +393,11 @@
382393
}
383394
n++;
384395
sqlite3_snprintf(sizeof(zLineNo), zLineNo, "(%d)", n);
385396
fossil_print("%6s ", zLineNo);
386397
z = mprintf("%s [%.10s] %s", zDate, zId, zCom);
387
- comment_print(z, 7, 79);
398
+ comment_print(z, 7, width);
388399
fossil_free(z);
389400
}
390401
fossil_free(zLastBr);
391402
db_finalize(&q);
392403
}
393404
--- src/descendants.c
+++ src/descendants.c
@@ -329,14 +329,16 @@
329 **
330 ** The --recompute flag causes the content of the "leaf" table in the
331 ** repository database to be recomputed.
332 **
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 **
339 ** See also: descendants, finfo, info, branch
340 */
341 void leaves_cmd(void){
342 Stmt q;
@@ -343,14 +345,23 @@
343 Blob sql;
344 int showAll = find_option("all", "a", 0)!=0;
345 int showClosed = find_option("closed", "c", 0)!=0;
346 int recomputeFlag = find_option("recompute",0,0)!=0;
347 int byBranch = find_option("bybranch",0,0)!=0;
 
348 char *zLastBr = 0;
349 int n;
350 char zLineNo[10];
351
 
 
 
 
 
 
 
 
352 db_find_and_open_repository(0,0);
353 if( recomputeFlag ) leaf_rebuild();
354 blob_zero(&sql);
355 blob_append(&sql, timeline_query_for_tty(), -1);
356 blob_appendf(&sql, " AND blob.rid IN leaf");
@@ -382,11 +393,11 @@
382 }
383 n++;
384 sqlite3_snprintf(sizeof(zLineNo), zLineNo, "(%d)", n);
385 fossil_print("%6s ", zLineNo);
386 z = mprintf("%s [%.10s] %s", zDate, zId, zCom);
387 comment_print(z, 7, 79);
388 fossil_free(z);
389 }
390 fossil_free(zLastBr);
391 db_finalize(&q);
392 }
393
--- src/descendants.c
+++ src/descendants.c
@@ -329,14 +329,16 @@
329 **
330 ** The --recompute flag causes the content of the "leaf" table in the
331 ** repository database to be recomputed.
332 **
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;
@@ -343,14 +345,23 @@
345 Blob sql;
346 int showAll = find_option("all", "a", 0)!=0;
347 int showClosed = find_option("closed", "c", 0)!=0;
348 int recomputeFlag = find_option("recompute",0,0)!=0;
349 int byBranch = find_option("bybranch",0,0)!=0;
350 const char *zWidth = find_option("width","W",1);
351 char *zLastBr = 0;
352 int n, width;
353 char zLineNo[10];
354
355 if( zWidth ){
356 width = atoi(zWidth);
357 if( (width!=0) && (width<=39) ){
358 fossil_fatal("-W|--width value must be >39 or 0");
359 }
360 }else{
361 width = 79;
362 }
363 db_find_and_open_repository(0,0);
364 if( recomputeFlag ) leaf_rebuild();
365 blob_zero(&sql);
366 blob_append(&sql, timeline_query_for_tty(), -1);
367 blob_appendf(&sql, " AND blob.rid IN leaf");
@@ -382,11 +393,11 @@
393 }
394 n++;
395 sqlite3_snprintf(sizeof(zLineNo), zLineNo, "(%d)", n);
396 fossil_print("%6s ", zLineNo);
397 z = mprintf("%s [%.10s] %s", zDate, zId, zCom);
398 comment_print(z, 7, width);
399 fossil_free(z);
400 }
401 fossil_free(zLastBr);
402 db_finalize(&q);
403 }
404
+1 -1
--- src/finfo.c
+++ src/finfo.c
@@ -151,11 +151,11 @@
151151
iWidth = zWidth ? atoi(zWidth) : 79;
152152
zOffset = find_option("offset",0,1);
153153
iOffset = zOffset ? atoi(zOffset) : 0;
154154
iBrief = (find_option("brief","b",0) == 0);
155155
if( (iWidth!=0) && (iWidth<=22) ){
156
- fossil_fatal("--width|-W value must be >22 or 0");
156
+ fossil_fatal("-W|--width value must be >22 or 0");
157157
}
158158
if( g.argc!=3 ){
159159
usage("?-l|--log? ?-b|--brief? FILENAME");
160160
}
161161
file_tree_name(g.argv[2], &fname, 1);
162162
--- src/finfo.c
+++ src/finfo.c
@@ -151,11 +151,11 @@
151 iWidth = zWidth ? atoi(zWidth) : 79;
152 zOffset = find_option("offset",0,1);
153 iOffset = zOffset ? atoi(zOffset) : 0;
154 iBrief = (find_option("brief","b",0) == 0);
155 if( (iWidth!=0) && (iWidth<=22) ){
156 fossil_fatal("--width|-W value must be >22 or 0");
157 }
158 if( g.argc!=3 ){
159 usage("?-l|--log? ?-b|--brief? FILENAME");
160 }
161 file_tree_name(g.argv[2], &fname, 1);
162
--- src/finfo.c
+++ src/finfo.c
@@ -151,11 +151,11 @@
151 iWidth = zWidth ? atoi(zWidth) : 79;
152 zOffset = find_option("offset",0,1);
153 iOffset = zOffset ? atoi(zOffset) : 0;
154 iBrief = (find_option("brief","b",0) == 0);
155 if( (iWidth!=0) && (iWidth<=22) ){
156 fossil_fatal("-W|--width value must be >22 or 0");
157 }
158 if( g.argc!=3 ){
159 usage("?-l|--log? ?-b|--brief? FILENAME");
160 }
161 file_tree_name(g.argv[2], &fname, 1);
162
+1 -1
--- src/search.c
+++ src/search.c
@@ -199,11 +199,11 @@
199199
lines/entries to list */
200200
int width;
201201
if( zWidth ){
202202
width = atoi(zWidth);
203203
if( (width!=0) && (width<=20) ){
204
- fossil_fatal("--width|-W value must be >20 or 0");
204
+ fossil_fatal("-W|--width value must be >20 or 0");
205205
}
206206
}else{
207207
width = 79;
208208
}
209209
210210
--- src/search.c
+++ src/search.c
@@ -199,11 +199,11 @@
199 lines/entries to list */
200 int width;
201 if( zWidth ){
202 width = atoi(zWidth);
203 if( (width!=0) && (width<=20) ){
204 fossil_fatal("--width|-W value must be >20 or 0");
205 }
206 }else{
207 width = 79;
208 }
209
210
--- src/search.c
+++ src/search.c
@@ -199,11 +199,11 @@
199 lines/entries to list */
200 int width;
201 if( zWidth ){
202 width = atoi(zWidth);
203 if( (width!=0) && (width<=20) ){
204 fossil_fatal("-W|--width value must be >20 or 0");
205 }
206 }else{
207 width = 79;
208 }
209
210
+13 -3
--- src/stash.c
+++ src/stash.c
@@ -463,11 +463,11 @@
463463
**
464464
** SUMMARY:
465465
** fossil stash
466466
** fossil stash save ?-m|--comment COMMENT? ?FILES...?
467467
** fossil stash snapshot ?-m|--comment COMMENT? ?FILES...?
468
-** fossil stash list|ls ?-v|--verbose?
468
+** fossil stash list|ls ?-v|--verbose? ?-W|--width <num>?
469469
** fossil stash show ?STASHID? ?DIFF-OPTIONS?
470470
** fossil stash pop
471471
** fossil stash apply ?STASHID?
472472
** fossil stash goto ?STASHID?
473473
** fossil stash rm|drop ?STASHID? ?-a|--all?
@@ -516,12 +516,22 @@
516516
if( memcmp(zCmd, "snapshot", nCmd)==0 ){
517517
stash_create();
518518
}else
519519
if( memcmp(zCmd, "list", nCmd)==0 || memcmp(zCmd, "ls", nCmd)==0 ){
520520
Stmt q, q2;
521
- int n = 0;
521
+ int n = 0, width;
522522
int verboseFlag = find_option("verbose","v",0)!=0;
523
+ const char *zWidth = find_option("width","W",1);
524
+
525
+ if( zWidth ){
526
+ width = atoi(zWidth);
527
+ if( (width!=0) && (width<=46) ){
528
+ fossil_fatal("-W|--width value must be >46 or 0");
529
+ }
530
+ }else{
531
+ width = 79;
532
+ }
523533
if( !verboseFlag ){
524534
verboseFlag = find_option("detail","l",0)!=0; /* deprecated */
525535
}
526536
verify_all_options();
527537
db_prepare(&q,
@@ -543,11 +553,11 @@
543553
db_column_text(&q, 3)
544554
);
545555
zCom = db_column_text(&q, 2);
546556
if( zCom && zCom[0] ){
547557
fossil_print(" ");
548
- comment_print(zCom, 7, 79);
558
+ comment_print(zCom, 7, width);
549559
}
550560
if( verboseFlag ){
551561
db_bind_int(&q2, "$id", stashid);
552562
while( db_step(&q2)==SQLITE_ROW ){
553563
int isAdded = db_column_int(&q2, 0);
554564
--- src/stash.c
+++ src/stash.c
@@ -463,11 +463,11 @@
463 **
464 ** SUMMARY:
465 ** fossil stash
466 ** fossil stash save ?-m|--comment COMMENT? ?FILES...?
467 ** fossil stash snapshot ?-m|--comment COMMENT? ?FILES...?
468 ** fossil stash list|ls ?-v|--verbose?
469 ** fossil stash show ?STASHID? ?DIFF-OPTIONS?
470 ** fossil stash pop
471 ** fossil stash apply ?STASHID?
472 ** fossil stash goto ?STASHID?
473 ** fossil stash rm|drop ?STASHID? ?-a|--all?
@@ -516,12 +516,22 @@
516 if( memcmp(zCmd, "snapshot", nCmd)==0 ){
517 stash_create();
518 }else
519 if( memcmp(zCmd, "list", nCmd)==0 || memcmp(zCmd, "ls", nCmd)==0 ){
520 Stmt q, q2;
521 int n = 0;
522 int verboseFlag = find_option("verbose","v",0)!=0;
 
 
 
 
 
 
 
 
 
 
523 if( !verboseFlag ){
524 verboseFlag = find_option("detail","l",0)!=0; /* deprecated */
525 }
526 verify_all_options();
527 db_prepare(&q,
@@ -543,11 +553,11 @@
543 db_column_text(&q, 3)
544 );
545 zCom = db_column_text(&q, 2);
546 if( zCom && zCom[0] ){
547 fossil_print(" ");
548 comment_print(zCom, 7, 79);
549 }
550 if( verboseFlag ){
551 db_bind_int(&q2, "$id", stashid);
552 while( db_step(&q2)==SQLITE_ROW ){
553 int isAdded = db_column_int(&q2, 0);
554
--- src/stash.c
+++ src/stash.c
@@ -463,11 +463,11 @@
463 **
464 ** SUMMARY:
465 ** fossil stash
466 ** fossil stash save ?-m|--comment COMMENT? ?FILES...?
467 ** fossil stash snapshot ?-m|--comment COMMENT? ?FILES...?
468 ** fossil stash list|ls ?-v|--verbose? ?-W|--width <num>?
469 ** fossil stash show ?STASHID? ?DIFF-OPTIONS?
470 ** fossil stash pop
471 ** fossil stash apply ?STASHID?
472 ** fossil stash goto ?STASHID?
473 ** fossil stash rm|drop ?STASHID? ?-a|--all?
@@ -516,12 +516,22 @@
516 if( memcmp(zCmd, "snapshot", nCmd)==0 ){
517 stash_create();
518 }else
519 if( memcmp(zCmd, "list", nCmd)==0 || memcmp(zCmd, "ls", nCmd)==0 ){
520 Stmt q, q2;
521 int n = 0, width;
522 int verboseFlag = find_option("verbose","v",0)!=0;
523 const char *zWidth = find_option("width","W",1);
524
525 if( zWidth ){
526 width = atoi(zWidth);
527 if( (width!=0) && (width<=46) ){
528 fossil_fatal("-W|--width value must be >46 or 0");
529 }
530 }else{
531 width = 79;
532 }
533 if( !verboseFlag ){
534 verboseFlag = find_option("detail","l",0)!=0; /* deprecated */
535 }
536 verify_all_options();
537 db_prepare(&q,
@@ -543,11 +553,11 @@
553 db_column_text(&q, 3)
554 );
555 zCom = db_column_text(&q, 2);
556 if( zCom && zCom[0] ){
557 fossil_print(" ");
558 comment_print(zCom, 7, width);
559 }
560 if( verboseFlag ){
561 db_bind_int(&q2, "$id", stashid);
562 while( db_step(&q2)==SQLITE_ROW ){
563 int isAdded = db_column_int(&q2, 0);
564
+1 -1
--- src/timeline.c
+++ src/timeline.c
@@ -1775,11 +1775,11 @@
17751775
n = -20;
17761776
}
17771777
if( zWidth ){
17781778
width = atoi(zWidth);
17791779
if( (width!=0) && (width<=20) ){
1780
- fossil_fatal("--width|-W value must be >20 or 0");
1780
+ fossil_fatal("-W|--width value must be >20 or 0");
17811781
}
17821782
}else{
17831783
width = 79;
17841784
}
17851785
zOffset = find_option("offset",0,1);
17861786
--- src/timeline.c
+++ src/timeline.c
@@ -1775,11 +1775,11 @@
1775 n = -20;
1776 }
1777 if( zWidth ){
1778 width = atoi(zWidth);
1779 if( (width!=0) && (width<=20) ){
1780 fossil_fatal("--width|-W value must be >20 or 0");
1781 }
1782 }else{
1783 width = 79;
1784 }
1785 zOffset = find_option("offset",0,1);
1786
--- src/timeline.c
+++ src/timeline.c
@@ -1775,11 +1775,11 @@
1775 n = -20;
1776 }
1777 if( zWidth ){
1778 width = atoi(zWidth);
1779 if( (width!=0) && (width<=20) ){
1780 fossil_fatal("-W|--width value must be >20 or 0");
1781 }
1782 }else{
1783 width = 79;
1784 }
1785 zOffset = find_option("offset",0,1);
1786
--- www/changes.wiki
+++ www/changes.wiki
@@ -43,10 +43,12 @@
4343
* Enhance the [/help?cmd=test-diff|fossil test-diff] command with -y or --tk
4444
options so that it shows both filenames above their respective columns in
4545
the side-by-side diff output.
4646
* Issue a warning if a [/help?cmd=add|fossil add] command tries to add a file
4747
that matches the ignore-glob.
48
+ * Add option -W|--width to "[/help?cmd=stash|fossil stash ls]"
49
+ and "[/help?cmd=leaves|fossil leaves]" commands.
4850
4951
<h2>Changes For Version 1.28 (2014-01-27)</h2>
5052
* Enhance [/help?cmd=/reports | /reports] to support event type filtering.
5153
* When cloning a repository, the user name passed via the URL (if any)
5254
is now used as the default local admin user's name.
5355
--- www/changes.wiki
+++ www/changes.wiki
@@ -43,10 +43,12 @@
43 * Enhance the [/help?cmd=test-diff|fossil test-diff] command with -y or --tk
44 options so that it shows both filenames above their respective columns in
45 the side-by-side diff output.
46 * Issue a warning if a [/help?cmd=add|fossil add] command tries to add a file
47 that matches the ignore-glob.
 
 
48
49 <h2>Changes For Version 1.28 (2014-01-27)</h2>
50 * Enhance [/help?cmd=/reports | /reports] to support event type filtering.
51 * When cloning a repository, the user name passed via the URL (if any)
52 is now used as the default local admin user's name.
53
--- www/changes.wiki
+++ www/changes.wiki
@@ -43,10 +43,12 @@
43 * Enhance the [/help?cmd=test-diff|fossil test-diff] command with -y or --tk
44 options so that it shows both filenames above their respective columns in
45 the side-by-side diff output.
46 * Issue a warning if a [/help?cmd=add|fossil add] command tries to add a file
47 that matches the ignore-glob.
48 * Add option -W|--width to "[/help?cmd=stash|fossil stash ls]"
49 and "[/help?cmd=leaves|fossil leaves]" commands.
50
51 <h2>Changes For Version 1.28 (2014-01-27)</h2>
52 * Enhance [/help?cmd=/reports | /reports] to support event type filtering.
53 * When cloning a repository, the user name passed via the URL (if any)
54 is now used as the default local admin user's name.
55

Keyboard Shortcuts

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