Fossil SCM

Add the global --comment-format command-line option and the "comment-format" setting for controlling the display of the command-line timeline.

drh 2019-01-27 19:16 trunk merge
Commit 2476b8121e5dde5e0777368faf326a3a088305738c9aafa685bce54766a08c21
+1 -1
--- src/bisect.c
+++ src/bisect.c
@@ -477,11 +477,11 @@
477477
for(i=0; i<count(aBisectOption); i++){
478478
char *z = mprintf("bisect-%s", aBisectOption[i].zName);
479479
fossil_print(" %-15s %-6s ", aBisectOption[i].zName,
480480
db_lget(z, (char*)aBisectOption[i].zDefault));
481481
fossil_free(z);
482
- comment_print(aBisectOption[i].zDesc, 0, 27, -1, g.comFmtFlags);
482
+ comment_print(aBisectOption[i].zDesc, 0, 27, -1, get_comment_format());
483483
}
484484
}else if( g.argc==4 || g.argc==5 ){
485485
unsigned int i;
486486
n = strlen(g.argv[3]);
487487
for(i=0; i<count(aBisectOption); i++){
488488
--- src/bisect.c
+++ src/bisect.c
@@ -477,11 +477,11 @@
477 for(i=0; i<count(aBisectOption); i++){
478 char *z = mprintf("bisect-%s", aBisectOption[i].zName);
479 fossil_print(" %-15s %-6s ", aBisectOption[i].zName,
480 db_lget(z, (char*)aBisectOption[i].zDefault));
481 fossil_free(z);
482 comment_print(aBisectOption[i].zDesc, 0, 27, -1, g.comFmtFlags);
483 }
484 }else if( g.argc==4 || g.argc==5 ){
485 unsigned int i;
486 n = strlen(g.argv[3]);
487 for(i=0; i<count(aBisectOption); i++){
488
--- src/bisect.c
+++ src/bisect.c
@@ -477,11 +477,11 @@
477 for(i=0; i<count(aBisectOption); i++){
478 char *z = mprintf("bisect-%s", aBisectOption[i].zName);
479 fossil_print(" %-15s %-6s ", aBisectOption[i].zName,
480 db_lget(z, (char*)aBisectOption[i].zDefault));
481 fossil_free(z);
482 comment_print(aBisectOption[i].zDesc, 0, 27, -1, get_comment_format());
483 }
484 }else if( g.argc==4 || g.argc==5 ){
485 unsigned int i;
486 n = strlen(g.argv[3]);
487 for(i=0; i<count(aBisectOption); i++){
488
+30 -1
--- src/comformat.c
+++ src/comformat.c
@@ -27,17 +27,18 @@
2727
# include <termios.h>
2828
# include <sys/ioctl.h>
2929
#endif
3030
3131
#if INTERFACE
32
-#define COMMENT_PRINT_NONE ((u32)0x00000000) /* No flags. */
32
+#define COMMENT_PRINT_NONE ((u32)0x00000000) /* No flags = non-legacy. */
3333
#define COMMENT_PRINT_LEGACY ((u32)0x00000001) /* Use legacy algorithm. */
3434
#define COMMENT_PRINT_TRIM_CRLF ((u32)0x00000002) /* Trim leading CR/LF. */
3535
#define COMMENT_PRINT_TRIM_SPACE ((u32)0x00000004) /* Trim leading/trailing. */
3636
#define COMMENT_PRINT_WORD_BREAK ((u32)0x00000008) /* Break lines on words. */
3737
#define COMMENT_PRINT_ORIG_BREAK ((u32)0x00000010) /* Break before original. */
3838
#define COMMENT_PRINT_DEFAULT (COMMENT_PRINT_LEGACY) /* Defaults. */
39
+#define COMMENT_PRINT_UNSET (-1) /* Not initialized. */
3940
#endif
4041
4142
/*
4243
** This is the previous value used by most external callers when they
4344
** needed to specify a default maximum line length to be used with the
@@ -514,10 +515,38 @@
514515
&lineCnt, &zLine);
515516
if( !zLine || !zLine[0] ) break;
516517
}
517518
return lineCnt;
518519
}
520
+
521
+/*
522
+** Return the "COMMENT_PRINT_*" flags specified by the following sources,
523
+** evaluated in the following cascading order:
524
+**
525
+** 1. The global --comfmtflags (alias --comment-format) command-line option.
526
+** 2. The local (per-repository) "comment-format" setting.
527
+** 3. The global (all-repositories) "comment-format" setting.
528
+** 4. The default value COMMENT_PRINT_DEFAULT.
529
+*/
530
+int get_comment_format(){
531
+ int comFmtFlags;
532
+ /* The global command-line option is present, or the value has been cached. */
533
+ if( g.comFmtFlags!=COMMENT_PRINT_UNSET ){
534
+ comFmtFlags = g.comFmtFlags;
535
+ return comFmtFlags;
536
+ }
537
+ /* Load the local (per-repository) or global (all-repositories) value, and use
538
+ ** g.comFmtFlags as a cache. */
539
+ comFmtFlags = db_get_int("comment-format", COMMENT_PRINT_UNSET);
540
+ if( comFmtFlags!=COMMENT_PRINT_UNSET ){
541
+ g.comFmtFlags = comFmtFlags;
542
+ return comFmtFlags;
543
+ }
544
+ /* Fallback to the default value. */
545
+ comFmtFlags = COMMENT_PRINT_DEFAULT;
546
+ return comFmtFlags;
547
+}
519548
520549
/*
521550
**
522551
** COMMAND: test-comment-format
523552
**
524553
--- src/comformat.c
+++ src/comformat.c
@@ -27,17 +27,18 @@
27 # include <termios.h>
28 # include <sys/ioctl.h>
29 #endif
30
31 #if INTERFACE
32 #define COMMENT_PRINT_NONE ((u32)0x00000000) /* No flags. */
33 #define COMMENT_PRINT_LEGACY ((u32)0x00000001) /* Use legacy algorithm. */
34 #define COMMENT_PRINT_TRIM_CRLF ((u32)0x00000002) /* Trim leading CR/LF. */
35 #define COMMENT_PRINT_TRIM_SPACE ((u32)0x00000004) /* Trim leading/trailing. */
36 #define COMMENT_PRINT_WORD_BREAK ((u32)0x00000008) /* Break lines on words. */
37 #define COMMENT_PRINT_ORIG_BREAK ((u32)0x00000010) /* Break before original. */
38 #define COMMENT_PRINT_DEFAULT (COMMENT_PRINT_LEGACY) /* Defaults. */
 
39 #endif
40
41 /*
42 ** This is the previous value used by most external callers when they
43 ** needed to specify a default maximum line length to be used with the
@@ -514,10 +515,38 @@
514 &lineCnt, &zLine);
515 if( !zLine || !zLine[0] ) break;
516 }
517 return lineCnt;
518 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
519
520 /*
521 **
522 ** COMMAND: test-comment-format
523 **
524
--- src/comformat.c
+++ src/comformat.c
@@ -27,17 +27,18 @@
27 # include <termios.h>
28 # include <sys/ioctl.h>
29 #endif
30
31 #if INTERFACE
32 #define COMMENT_PRINT_NONE ((u32)0x00000000) /* No flags = non-legacy. */
33 #define COMMENT_PRINT_LEGACY ((u32)0x00000001) /* Use legacy algorithm. */
34 #define COMMENT_PRINT_TRIM_CRLF ((u32)0x00000002) /* Trim leading CR/LF. */
35 #define COMMENT_PRINT_TRIM_SPACE ((u32)0x00000004) /* Trim leading/trailing. */
36 #define COMMENT_PRINT_WORD_BREAK ((u32)0x00000008) /* Break lines on words. */
37 #define COMMENT_PRINT_ORIG_BREAK ((u32)0x00000010) /* Break before original. */
38 #define COMMENT_PRINT_DEFAULT (COMMENT_PRINT_LEGACY) /* Defaults. */
39 #define COMMENT_PRINT_UNSET (-1) /* Not initialized. */
40 #endif
41
42 /*
43 ** This is the previous value used by most external callers when they
44 ** needed to specify a default maximum line length to be used with the
@@ -514,10 +515,38 @@
515 &lineCnt, &zLine);
516 if( !zLine || !zLine[0] ) break;
517 }
518 return lineCnt;
519 }
520
521 /*
522 ** Return the "COMMENT_PRINT_*" flags specified by the following sources,
523 ** evaluated in the following cascading order:
524 **
525 ** 1. The global --comfmtflags (alias --comment-format) command-line option.
526 ** 2. The local (per-repository) "comment-format" setting.
527 ** 3. The global (all-repositories) "comment-format" setting.
528 ** 4. The default value COMMENT_PRINT_DEFAULT.
529 */
530 int get_comment_format(){
531 int comFmtFlags;
532 /* The global command-line option is present, or the value has been cached. */
533 if( g.comFmtFlags!=COMMENT_PRINT_UNSET ){
534 comFmtFlags = g.comFmtFlags;
535 return comFmtFlags;
536 }
537 /* Load the local (per-repository) or global (all-repositories) value, and use
538 ** g.comFmtFlags as a cache. */
539 comFmtFlags = db_get_int("comment-format", COMMENT_PRINT_UNSET);
540 if( comFmtFlags!=COMMENT_PRINT_UNSET ){
541 g.comFmtFlags = comFmtFlags;
542 return comFmtFlags;
543 }
544 /* Fallback to the default value. */
545 comFmtFlags = COMMENT_PRINT_DEFAULT;
546 return comFmtFlags;
547 }
548
549 /*
550 **
551 ** COMMAND: test-comment-format
552 **
553
--- src/configure.c
+++ src/configure.c
@@ -136,10 +136,11 @@
136136
{ "allow-symlinks", CONFIGSET_PROJ },
137137
{ "dotfiles", CONFIGSET_PROJ },
138138
{ "parent-project-code", CONFIGSET_PROJ },
139139
{ "parent-project-name", CONFIGSET_PROJ },
140140
{ "hash-policy", CONFIGSET_PROJ },
141
+ { "comment-format", CONFIGSET_PROJ },
141142
142143
#ifdef FOSSIL_ENABLE_LEGACY_MV_RM
143144
{ "mv-rm-files", CONFIGSET_PROJ },
144145
#endif
145146
146147
--- src/configure.c
+++ src/configure.c
@@ -136,10 +136,11 @@
136 { "allow-symlinks", CONFIGSET_PROJ },
137 { "dotfiles", CONFIGSET_PROJ },
138 { "parent-project-code", CONFIGSET_PROJ },
139 { "parent-project-name", CONFIGSET_PROJ },
140 { "hash-policy", CONFIGSET_PROJ },
 
141
142 #ifdef FOSSIL_ENABLE_LEGACY_MV_RM
143 { "mv-rm-files", CONFIGSET_PROJ },
144 #endif
145
146
--- src/configure.c
+++ src/configure.c
@@ -136,10 +136,11 @@
136 { "allow-symlinks", CONFIGSET_PROJ },
137 { "dotfiles", CONFIGSET_PROJ },
138 { "parent-project-code", CONFIGSET_PROJ },
139 { "parent-project-name", CONFIGSET_PROJ },
140 { "hash-policy", CONFIGSET_PROJ },
141 { "comment-format", CONFIGSET_PROJ },
142
143 #ifdef FOSSIL_ENABLE_LEGACY_MV_RM
144 { "mv-rm-files", CONFIGSET_PROJ },
145 #endif
146
147
+23
--- src/db.c
+++ src/db.c
@@ -3169,10 +3169,33 @@
31693169
/*
31703170
** SETTING: clearsign boolean default=off
31713171
** When enabled, fossil will attempt to sign all commits
31723172
** with gpg. When disabled, commits will be unsigned.
31733173
*/
3174
+/*
3175
+** SETTING: comment-format width=16 default=1
3176
+** Set the default options for printing timeline comments to the console.
3177
+**
3178
+** The global --comfmtflags command-line option (or alias --comment-format)
3179
+** overrides this setting.
3180
+**
3181
+** Possible values are:
3182
+** 1 Activate the legacy comment printing format (default).
3183
+**
3184
+** Or a bitwise combination of the following flags:
3185
+** 0 Activate the newer (non-legacy) comment printing format.
3186
+** 2 Trim leading and trailing CR and LF characters.
3187
+** 4 Trim leading and trailing white space characters.
3188
+** 8 Attempt to break lines on word boundaries.
3189
+** 16 Break lines before the original comment embedded in other text.
3190
+**
3191
+** Note: To preserve line breaks, activate the newer (non-legacy) comment
3192
+** printing format (i.e. set to "0", or a combination not including "1").
3193
+**
3194
+** Note: The options for timeline comments displayed on the web UI can be
3195
+** configured through the /setup_timeline web page.
3196
+*/
31743197
/*
31753198
** SETTING: crlf-glob width=40 versionable block-text
31763199
** The value is a comma or newline-separated list of GLOB patterns for
31773200
** text files in which it is ok to have CR, CR+LF or mixed
31783201
** line endings. Set to "*" to disable CR+LF checking.
31793202
--- src/db.c
+++ src/db.c
@@ -3169,10 +3169,33 @@
3169 /*
3170 ** SETTING: clearsign boolean default=off
3171 ** When enabled, fossil will attempt to sign all commits
3172 ** with gpg. When disabled, commits will be unsigned.
3173 */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3174 /*
3175 ** SETTING: crlf-glob width=40 versionable block-text
3176 ** The value is a comma or newline-separated list of GLOB patterns for
3177 ** text files in which it is ok to have CR, CR+LF or mixed
3178 ** line endings. Set to "*" to disable CR+LF checking.
3179
--- src/db.c
+++ src/db.c
@@ -3169,10 +3169,33 @@
3169 /*
3170 ** SETTING: clearsign boolean default=off
3171 ** When enabled, fossil will attempt to sign all commits
3172 ** with gpg. When disabled, commits will be unsigned.
3173 */
3174 /*
3175 ** SETTING: comment-format width=16 default=1
3176 ** Set the default options for printing timeline comments to the console.
3177 **
3178 ** The global --comfmtflags command-line option (or alias --comment-format)
3179 ** overrides this setting.
3180 **
3181 ** Possible values are:
3182 ** 1 Activate the legacy comment printing format (default).
3183 **
3184 ** Or a bitwise combination of the following flags:
3185 ** 0 Activate the newer (non-legacy) comment printing format.
3186 ** 2 Trim leading and trailing CR and LF characters.
3187 ** 4 Trim leading and trailing white space characters.
3188 ** 8 Attempt to break lines on word boundaries.
3189 ** 16 Break lines before the original comment embedded in other text.
3190 **
3191 ** Note: To preserve line breaks, activate the newer (non-legacy) comment
3192 ** printing format (i.e. set to "0", or a combination not including "1").
3193 **
3194 ** Note: The options for timeline comments displayed on the web UI can be
3195 ** configured through the /setup_timeline web page.
3196 */
3197 /*
3198 ** SETTING: crlf-glob width=40 versionable block-text
3199 ** The value is a comma or newline-separated list of GLOB patterns for
3200 ** text files in which it is ok to have CR, CR+LF or mixed
3201 ** line endings. Set to "*" to disable CR+LF checking.
3202
--- src/descendants.c
+++ src/descendants.c
@@ -433,11 +433,11 @@
433433
}
434434
n++;
435435
sqlite3_snprintf(sizeof(zLineNo), zLineNo, "(%d)", n);
436436
fossil_print("%6s ", zLineNo);
437437
z = mprintf("%s [%S] %s", zDate, zId, zCom);
438
- comment_print(z, zCom, 7, width, g.comFmtFlags);
438
+ comment_print(z, zCom, 7, width, get_comment_format());
439439
fossil_free(z);
440440
}
441441
fossil_free(zLastBr);
442442
db_finalize(&q);
443443
}
444444
--- src/descendants.c
+++ src/descendants.c
@@ -433,11 +433,11 @@
433 }
434 n++;
435 sqlite3_snprintf(sizeof(zLineNo), zLineNo, "(%d)", n);
436 fossil_print("%6s ", zLineNo);
437 z = mprintf("%s [%S] %s", zDate, zId, zCom);
438 comment_print(z, zCom, 7, width, g.comFmtFlags);
439 fossil_free(z);
440 }
441 fossil_free(zLastBr);
442 db_finalize(&q);
443 }
444
--- src/descendants.c
+++ src/descendants.c
@@ -433,11 +433,11 @@
433 }
434 n++;
435 sqlite3_snprintf(sizeof(zLineNo), zLineNo, "(%d)", n);
436 fossil_print("%6s ", zLineNo);
437 z = mprintf("%s [%S] %s", zDate, zId, zCom);
438 comment_print(z, zCom, 7, width, get_comment_format());
439 fossil_free(z);
440 }
441 fossil_free(zLastBr);
442 db_finalize(&q);
443 }
444
--- src/dispatch.c
+++ src/dispatch.c
@@ -501,10 +501,11 @@
501501
@ Command-line options common to all commands:
502502
@
503503
@ --args FILENAME Read additional arguments and options from FILENAME
504504
@ --cgitrace Active CGI tracing
505505
@ --comfmtflags VALUE Set comment formatting flags to VALUE
506
+@ --comment-format VALUE Alias for --comfmtflags
506507
@ --errorlog FILENAME Log errors to FILENAME
507508
@ --help Show help on the command rather than running it
508509
@ --httptrace Trace outbound HTTP requests
509510
@ --localtime Display times using the local timezone
510511
@ --no-th-hook Do not run TH1 hooks
511512
--- src/dispatch.c
+++ src/dispatch.c
@@ -501,10 +501,11 @@
501 @ Command-line options common to all commands:
502 @
503 @ --args FILENAME Read additional arguments and options from FILENAME
504 @ --cgitrace Active CGI tracing
505 @ --comfmtflags VALUE Set comment formatting flags to VALUE
 
506 @ --errorlog FILENAME Log errors to FILENAME
507 @ --help Show help on the command rather than running it
508 @ --httptrace Trace outbound HTTP requests
509 @ --localtime Display times using the local timezone
510 @ --no-th-hook Do not run TH1 hooks
511
--- src/dispatch.c
+++ src/dispatch.c
@@ -501,10 +501,11 @@
501 @ Command-line options common to all commands:
502 @
503 @ --args FILENAME Read additional arguments and options from FILENAME
504 @ --cgitrace Active CGI tracing
505 @ --comfmtflags VALUE Set comment formatting flags to VALUE
506 @ --comment-format VALUE Alias for --comfmtflags
507 @ --errorlog FILENAME Log errors to FILENAME
508 @ --help Show help on the command rather than running it
509 @ --httptrace Trace outbound HTTP requests
510 @ --localtime Display times using the local timezone
511 @ --no-th-hook Do not run TH1 hooks
512
+2 -2
--- src/finfo.c
+++ src/finfo.c
@@ -215,20 +215,20 @@
215215
if( iBrief ){
216216
fossil_print("%s ", zDate);
217217
zOut = mprintf(
218218
"[%S] %s (user: %s, artifact: [%S], branch: %s)",
219219
zCiUuid, zCom, zUser, zFileUuid, zBr);
220
- comment_print(zOut, zCom, 11, iWidth, g.comFmtFlags);
220
+ comment_print(zOut, zCom, 11, iWidth, get_comment_format());
221221
fossil_free(zOut);
222222
}else{
223223
blob_reset(&line);
224224
blob_appendf(&line, "%S ", zCiUuid);
225225
blob_appendf(&line, "%.10s ", zDate);
226226
blob_appendf(&line, "%8.8s ", zUser);
227227
blob_appendf(&line, "%8.8s ", zBr);
228228
blob_appendf(&line,"%-39.39s", zCom );
229
- comment_print(blob_str(&line), zCom, 0, iWidth, g.comFmtFlags);
229
+ comment_print(blob_str(&line), zCom, 0, iWidth, get_comment_format());
230230
}
231231
}
232232
db_finalize(&q);
233233
blob_reset(&fname);
234234
}
235235
--- src/finfo.c
+++ src/finfo.c
@@ -215,20 +215,20 @@
215 if( iBrief ){
216 fossil_print("%s ", zDate);
217 zOut = mprintf(
218 "[%S] %s (user: %s, artifact: [%S], branch: %s)",
219 zCiUuid, zCom, zUser, zFileUuid, zBr);
220 comment_print(zOut, zCom, 11, iWidth, g.comFmtFlags);
221 fossil_free(zOut);
222 }else{
223 blob_reset(&line);
224 blob_appendf(&line, "%S ", zCiUuid);
225 blob_appendf(&line, "%.10s ", zDate);
226 blob_appendf(&line, "%8.8s ", zUser);
227 blob_appendf(&line, "%8.8s ", zBr);
228 blob_appendf(&line,"%-39.39s", zCom );
229 comment_print(blob_str(&line), zCom, 0, iWidth, g.comFmtFlags);
230 }
231 }
232 db_finalize(&q);
233 blob_reset(&fname);
234 }
235
--- src/finfo.c
+++ src/finfo.c
@@ -215,20 +215,20 @@
215 if( iBrief ){
216 fossil_print("%s ", zDate);
217 zOut = mprintf(
218 "[%S] %s (user: %s, artifact: [%S], branch: %s)",
219 zCiUuid, zCom, zUser, zFileUuid, zBr);
220 comment_print(zOut, zCom, 11, iWidth, get_comment_format());
221 fossil_free(zOut);
222 }else{
223 blob_reset(&line);
224 blob_appendf(&line, "%S ", zCiUuid);
225 blob_appendf(&line, "%.10s ", zDate);
226 blob_appendf(&line, "%8.8s ", zUser);
227 blob_appendf(&line, "%8.8s ", zBr);
228 blob_appendf(&line,"%-39.39s", zCom );
229 comment_print(blob_str(&line), zCom, 0, iWidth, get_comment_format());
230 }
231 }
232 db_finalize(&q);
233 blob_reset(&fname);
234 }
235
+1 -1
--- src/info.c
+++ src/info.c
@@ -117,11 +117,11 @@
117117
fossil_print("tags: %s\n", zTags);
118118
}
119119
free(zTags);
120120
if( zComment ){
121121
fossil_print("comment: ");
122
- comment_print(zComment, 0, 14, -1, g.comFmtFlags);
122
+ comment_print(zComment, 0, 14, -1, get_comment_format());
123123
free(zComment);
124124
}
125125
}
126126
127127
/*
128128
--- src/info.c
+++ src/info.c
@@ -117,11 +117,11 @@
117 fossil_print("tags: %s\n", zTags);
118 }
119 free(zTags);
120 if( zComment ){
121 fossil_print("comment: ");
122 comment_print(zComment, 0, 14, -1, g.comFmtFlags);
123 free(zComment);
124 }
125 }
126
127 /*
128
--- src/info.c
+++ src/info.c
@@ -117,11 +117,11 @@
117 fossil_print("tags: %s\n", zTags);
118 }
119 free(zTags);
120 if( zComment ){
121 fossil_print("comment: ");
122 comment_print(zComment, 0, 14, -1, get_comment_format());
123 free(zComment);
124 }
125 }
126
127 /*
128
+6 -2
--- src/main.c
+++ src/main.c
@@ -203,11 +203,12 @@
203203
** SSL client identity */
204204
int useLocalauth; /* No login required if from 127.0.0.1 */
205205
int noPswd; /* Logged in without password (on 127.0.0.1) */
206206
int userUid; /* Integer user id */
207207
int isHuman; /* True if access by a human, not a spider or bot */
208
- int comFmtFlags; /* Zero or more "COMMENT_PRINT_*" bit flags */
208
+ int comFmtFlags; /* Zero or more "COMMENT_PRINT_*" bit flags, should be
209
+ ** accessed through get_comment_format(). */
209210
210211
/* Information used to populate the RCVFROM table */
211212
int rcvid; /* The rcvid. 0 if not yet defined. */
212213
char *zIpAddr; /* The remote IP address */
213214
char *zNonce; /* The nonce used for login */
@@ -575,14 +576,17 @@
575576
** this function executes, all global variables (i.e. in the "g" struct)
576577
** containing option-settable bitwise flag fields must be initialized.
577578
*/
578579
static void fossil_init_flags_from_options(void){
579580
const char *zValue = find_option("comfmtflags", 0, 1);
581
+ if( zValue==0 ){
582
+ zValue = find_option("comment-format", 0, 1);
583
+ }
580584
if( zValue ){
581585
g.comFmtFlags = atoi(zValue);
582586
}else{
583
- g.comFmtFlags = COMMENT_PRINT_DEFAULT;
587
+ g.comFmtFlags = COMMENT_PRINT_UNSET; /* Command-line option not found. */
584588
}
585589
}
586590
587591
/*
588592
** Check to see if the Fossil binary contains an appended repository
589593
--- src/main.c
+++ src/main.c
@@ -203,11 +203,12 @@
203 ** SSL client identity */
204 int useLocalauth; /* No login required if from 127.0.0.1 */
205 int noPswd; /* Logged in without password (on 127.0.0.1) */
206 int userUid; /* Integer user id */
207 int isHuman; /* True if access by a human, not a spider or bot */
208 int comFmtFlags; /* Zero or more "COMMENT_PRINT_*" bit flags */
 
209
210 /* Information used to populate the RCVFROM table */
211 int rcvid; /* The rcvid. 0 if not yet defined. */
212 char *zIpAddr; /* The remote IP address */
213 char *zNonce; /* The nonce used for login */
@@ -575,14 +576,17 @@
575 ** this function executes, all global variables (i.e. in the "g" struct)
576 ** containing option-settable bitwise flag fields must be initialized.
577 */
578 static void fossil_init_flags_from_options(void){
579 const char *zValue = find_option("comfmtflags", 0, 1);
 
 
 
580 if( zValue ){
581 g.comFmtFlags = atoi(zValue);
582 }else{
583 g.comFmtFlags = COMMENT_PRINT_DEFAULT;
584 }
585 }
586
587 /*
588 ** Check to see if the Fossil binary contains an appended repository
589
--- src/main.c
+++ src/main.c
@@ -203,11 +203,12 @@
203 ** SSL client identity */
204 int useLocalauth; /* No login required if from 127.0.0.1 */
205 int noPswd; /* Logged in without password (on 127.0.0.1) */
206 int userUid; /* Integer user id */
207 int isHuman; /* True if access by a human, not a spider or bot */
208 int comFmtFlags; /* Zero or more "COMMENT_PRINT_*" bit flags, should be
209 ** accessed through get_comment_format(). */
210
211 /* Information used to populate the RCVFROM table */
212 int rcvid; /* The rcvid. 0 if not yet defined. */
213 char *zIpAddr; /* The remote IP address */
214 char *zNonce; /* The nonce used for login */
@@ -575,14 +576,17 @@
576 ** this function executes, all global variables (i.e. in the "g" struct)
577 ** containing option-settable bitwise flag fields must be initialized.
578 */
579 static void fossil_init_flags_from_options(void){
580 const char *zValue = find_option("comfmtflags", 0, 1);
581 if( zValue==0 ){
582 zValue = find_option("comment-format", 0, 1);
583 }
584 if( zValue ){
585 g.comFmtFlags = atoi(zValue);
586 }else{
587 g.comFmtFlags = COMMENT_PRINT_UNSET; /* Command-line option not found. */
588 }
589 }
590
591 /*
592 ** Check to see if the Fossil binary contains an appended repository
593
+2 -2
--- src/merge.c
+++ src/merge.c
@@ -47,11 +47,11 @@
4747
indent-1, zLabel,
4848
db_column_text(&q, 3),
4949
db_column_text(&q, 1),
5050
db_column_text(&q, 0),
5151
indent, "");
52
- comment_print(zCom, db_column_text(&q,2), indent, -1, g.comFmtFlags);
52
+ comment_print(zCom, db_column_text(&q,2), indent, -1, get_comment_format());
5353
fossil_free(zCom);
5454
}
5555
db_finalize(&q);
5656
}
5757
@@ -321,11 +321,11 @@
321321
);
322322
if( db_step(&q)==SQLITE_ROW ){
323323
char *zCom = mprintf("Merging fork [%S] at %s by %s: \"%s\"",
324324
db_column_text(&q, 0), db_column_text(&q, 1),
325325
db_column_text(&q, 3), db_column_text(&q, 2));
326
- comment_print(zCom, db_column_text(&q,2), 0, -1, g.comFmtFlags);
326
+ comment_print(zCom, db_column_text(&q,2), 0, -1, get_comment_format());
327327
fossil_free(zCom);
328328
}
329329
db_finalize(&q);
330330
}else{
331331
usage("?OPTIONS? ?VERSION?");
332332
--- src/merge.c
+++ src/merge.c
@@ -47,11 +47,11 @@
47 indent-1, zLabel,
48 db_column_text(&q, 3),
49 db_column_text(&q, 1),
50 db_column_text(&q, 0),
51 indent, "");
52 comment_print(zCom, db_column_text(&q,2), indent, -1, g.comFmtFlags);
53 fossil_free(zCom);
54 }
55 db_finalize(&q);
56 }
57
@@ -321,11 +321,11 @@
321 );
322 if( db_step(&q)==SQLITE_ROW ){
323 char *zCom = mprintf("Merging fork [%S] at %s by %s: \"%s\"",
324 db_column_text(&q, 0), db_column_text(&q, 1),
325 db_column_text(&q, 3), db_column_text(&q, 2));
326 comment_print(zCom, db_column_text(&q,2), 0, -1, g.comFmtFlags);
327 fossil_free(zCom);
328 }
329 db_finalize(&q);
330 }else{
331 usage("?OPTIONS? ?VERSION?");
332
--- src/merge.c
+++ src/merge.c
@@ -47,11 +47,11 @@
47 indent-1, zLabel,
48 db_column_text(&q, 3),
49 db_column_text(&q, 1),
50 db_column_text(&q, 0),
51 indent, "");
52 comment_print(zCom, db_column_text(&q,2), indent, -1, get_comment_format());
53 fossil_free(zCom);
54 }
55 db_finalize(&q);
56 }
57
@@ -321,11 +321,11 @@
321 );
322 if( db_step(&q)==SQLITE_ROW ){
323 char *zCom = mprintf("Merging fork [%S] at %s by %s: \"%s\"",
324 db_column_text(&q, 0), db_column_text(&q, 1),
325 db_column_text(&q, 3), db_column_text(&q, 2));
326 comment_print(zCom, db_column_text(&q,2), 0, -1, get_comment_format());
327 fossil_free(zCom);
328 }
329 db_finalize(&q);
330 }else{
331 usage("?OPTIONS? ?VERSION?");
332
+3 -3
--- src/name.c
+++ src/name.c
@@ -612,11 +612,11 @@
612612
default: zType = "Unknown"; break;
613613
}
614614
fossil_print("type: %s by %s on %s\n", zType, db_column_text(&q,2),
615615
db_column_text(&q, 1));
616616
fossil_print("comment: ");
617
- comment_print(db_column_text(&q,3), 0, 12, -1, g.comFmtFlags);
617
+ comment_print(db_column_text(&q,3), 0, 12, -1, get_comment_format());
618618
}
619619
db_finalize(&q);
620620
621621
/* Check to see if this object is used as a file in a check-in */
622622
db_prepare(&q,
@@ -634,11 +634,11 @@
634634
fossil_print(" part of [%S] by %s on %s\n",
635635
db_column_text(&q, 1),
636636
db_column_text(&q, 3),
637637
db_column_text(&q, 2));
638638
fossil_print(" ");
639
- comment_print(db_column_text(&q,4), 0, 12, -1, g.comFmtFlags);
639
+ comment_print(db_column_text(&q,4), 0, 12, -1, get_comment_format());
640640
}
641641
db_finalize(&q);
642642
643643
/* Check to see if this object is used as an attachment */
644644
db_prepare(&q,
@@ -669,11 +669,11 @@
669669
db_column_text(&q,7));
670670
}
671671
fossil_print(" by user %s on %s\n",
672672
db_column_text(&q,2), db_column_text(&q,3));
673673
fossil_print(" ");
674
- comment_print(db_column_text(&q,1), 0, 12, -1, g.comFmtFlags);
674
+ comment_print(db_column_text(&q,1), 0, 12, -1, get_comment_format());
675675
}
676676
db_finalize(&q);
677677
}
678678
679679
/*
680680
--- src/name.c
+++ src/name.c
@@ -612,11 +612,11 @@
612 default: zType = "Unknown"; break;
613 }
614 fossil_print("type: %s by %s on %s\n", zType, db_column_text(&q,2),
615 db_column_text(&q, 1));
616 fossil_print("comment: ");
617 comment_print(db_column_text(&q,3), 0, 12, -1, g.comFmtFlags);
618 }
619 db_finalize(&q);
620
621 /* Check to see if this object is used as a file in a check-in */
622 db_prepare(&q,
@@ -634,11 +634,11 @@
634 fossil_print(" part of [%S] by %s on %s\n",
635 db_column_text(&q, 1),
636 db_column_text(&q, 3),
637 db_column_text(&q, 2));
638 fossil_print(" ");
639 comment_print(db_column_text(&q,4), 0, 12, -1, g.comFmtFlags);
640 }
641 db_finalize(&q);
642
643 /* Check to see if this object is used as an attachment */
644 db_prepare(&q,
@@ -669,11 +669,11 @@
669 db_column_text(&q,7));
670 }
671 fossil_print(" by user %s on %s\n",
672 db_column_text(&q,2), db_column_text(&q,3));
673 fossil_print(" ");
674 comment_print(db_column_text(&q,1), 0, 12, -1, g.comFmtFlags);
675 }
676 db_finalize(&q);
677 }
678
679 /*
680
--- src/name.c
+++ src/name.c
@@ -612,11 +612,11 @@
612 default: zType = "Unknown"; break;
613 }
614 fossil_print("type: %s by %s on %s\n", zType, db_column_text(&q,2),
615 db_column_text(&q, 1));
616 fossil_print("comment: ");
617 comment_print(db_column_text(&q,3), 0, 12, -1, get_comment_format());
618 }
619 db_finalize(&q);
620
621 /* Check to see if this object is used as a file in a check-in */
622 db_prepare(&q,
@@ -634,11 +634,11 @@
634 fossil_print(" part of [%S] by %s on %s\n",
635 db_column_text(&q, 1),
636 db_column_text(&q, 3),
637 db_column_text(&q, 2));
638 fossil_print(" ");
639 comment_print(db_column_text(&q,4), 0, 12, -1, get_comment_format());
640 }
641 db_finalize(&q);
642
643 /* Check to see if this object is used as an attachment */
644 db_prepare(&q,
@@ -669,11 +669,11 @@
669 db_column_text(&q,7));
670 }
671 fossil_print(" by user %s on %s\n",
672 db_column_text(&q,2), db_column_text(&q,3));
673 fossil_print(" ");
674 comment_print(db_column_text(&q,1), 0, 12, -1, get_comment_format());
675 }
676 db_finalize(&q);
677 }
678
679 /*
680
+1 -1
--- src/stash.c
+++ src/stash.c
@@ -652,11 +652,11 @@
652652
db_column_text(&q, 3)
653653
);
654654
zCom = db_column_text(&q, 2);
655655
if( zCom && zCom[0] ){
656656
fossil_print(" ");
657
- comment_print(zCom, 0, 7, width, g.comFmtFlags);
657
+ comment_print(zCom, 0, 7, width, get_comment_format());
658658
}
659659
if( verboseFlag ){
660660
db_bind_int(&q2, "$id", stashid);
661661
while( db_step(&q2)==SQLITE_ROW ){
662662
int isAdded = db_column_int(&q2, 0);
663663
--- src/stash.c
+++ src/stash.c
@@ -652,11 +652,11 @@
652 db_column_text(&q, 3)
653 );
654 zCom = db_column_text(&q, 2);
655 if( zCom && zCom[0] ){
656 fossil_print(" ");
657 comment_print(zCom, 0, 7, width, g.comFmtFlags);
658 }
659 if( verboseFlag ){
660 db_bind_int(&q2, "$id", stashid);
661 while( db_step(&q2)==SQLITE_ROW ){
662 int isAdded = db_column_int(&q2, 0);
663
--- src/stash.c
+++ src/stash.c
@@ -652,11 +652,11 @@
652 db_column_text(&q, 3)
653 );
654 zCom = db_column_text(&q, 2);
655 if( zCom && zCom[0] ){
656 fossil_print(" ");
657 comment_print(zCom, 0, 7, width, get_comment_format());
658 }
659 if( verboseFlag ){
660 db_bind_int(&q2, "$id", stashid);
661 while( db_step(&q2)==SQLITE_ROW ){
662 int isAdded = db_column_int(&q2, 0);
663
+1 -1
--- src/timeline.c
+++ src/timeline.c
@@ -2407,11 +2407,11 @@
24072407
sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*UNPUBLISHED* ");
24082408
n += strlen(zPrefix+n);
24092409
}
24102410
zFree = mprintf("[%S] %s%s", zId, zPrefix, zCom);
24112411
/* record another X lines */
2412
- nLine += comment_print(zFree, zCom, 9, width, g.comFmtFlags);
2412
+ nLine += comment_print(zFree, zCom, 9, width, get_comment_format());
24132413
fossil_free(zFree);
24142414
24152415
if(verboseFlag){
24162416
if( !fchngQueryInit ){
24172417
db_prepare(&fchngQuery,
24182418
--- src/timeline.c
+++ src/timeline.c
@@ -2407,11 +2407,11 @@
2407 sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*UNPUBLISHED* ");
2408 n += strlen(zPrefix+n);
2409 }
2410 zFree = mprintf("[%S] %s%s", zId, zPrefix, zCom);
2411 /* record another X lines */
2412 nLine += comment_print(zFree, zCom, 9, width, g.comFmtFlags);
2413 fossil_free(zFree);
2414
2415 if(verboseFlag){
2416 if( !fchngQueryInit ){
2417 db_prepare(&fchngQuery,
2418
--- src/timeline.c
+++ src/timeline.c
@@ -2407,11 +2407,11 @@
2407 sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*UNPUBLISHED* ");
2408 n += strlen(zPrefix+n);
2409 }
2410 zFree = mprintf("[%S] %s%s", zId, zPrefix, zCom);
2411 /* record another X lines */
2412 nLine += comment_print(zFree, zCom, 9, width, get_comment_format());
2413 fossil_free(zFree);
2414
2415 if(verboseFlag){
2416 if( !fchngQueryInit ){
2417 db_prepare(&fchngQuery,
2418
+1 -1
--- src/tkt.c
+++ src/tkt.c
@@ -1297,11 +1297,11 @@
12971297
fossil_print(" Change ");
12981298
}
12991299
fossil_print("%h: ",z);
13001300
if( blob_size(&val)>50 || contains_newline(&val)) {
13011301
fossil_print("\n ");
1302
- comment_print(blob_str(&val),0,4,-1,g.comFmtFlags);
1302
+ comment_print(blob_str(&val),0,4,-1,get_comment_format());
13031303
}else{
13041304
fossil_print("%s\n",blob_str(&val));
13051305
}
13061306
blob_reset(&val);
13071307
}
13081308
--- src/tkt.c
+++ src/tkt.c
@@ -1297,11 +1297,11 @@
1297 fossil_print(" Change ");
1298 }
1299 fossil_print("%h: ",z);
1300 if( blob_size(&val)>50 || contains_newline(&val)) {
1301 fossil_print("\n ");
1302 comment_print(blob_str(&val),0,4,-1,g.comFmtFlags);
1303 }else{
1304 fossil_print("%s\n",blob_str(&val));
1305 }
1306 blob_reset(&val);
1307 }
1308
--- src/tkt.c
+++ src/tkt.c
@@ -1297,11 +1297,11 @@
1297 fossil_print(" Change ");
1298 }
1299 fossil_print("%h: ",z);
1300 if( blob_size(&val)>50 || contains_newline(&val)) {
1301 fossil_print("\n ");
1302 comment_print(blob_str(&val),0,4,-1,get_comment_format());
1303 }else{
1304 fossil_print("%s\n",blob_str(&val));
1305 }
1306 blob_reset(&val);
1307 }
1308
+2 -1
--- www/env-opts.md
+++ www/env-opts.md
@@ -31,11 +31,12 @@
3131
3232
`--chdir DIRECTORY`: Change to the named directory before processing
3333
any commands.
3434
3535
36
-`--comfmtflags NUMBER`: Specify flags that control how check-in comments
36
+`--comfmtflags NUMBER`
37
+`--comment-format NUMBER`: Specify flags that control how check-in comments
3738
and certain other text outputs are formatted for display. The flags are
3839
individual bits in `NUMBER`, which must be specified in base 10:
3940
4041
* _0_ &mdash; Uses the revised algorithm with no special handling.
4142
4243
--- www/env-opts.md
+++ www/env-opts.md
@@ -31,11 +31,12 @@
31
32 `--chdir DIRECTORY`: Change to the named directory before processing
33 any commands.
34
35
36 `--comfmtflags NUMBER`: Specify flags that control how check-in comments
 
37 and certain other text outputs are formatted for display. The flags are
38 individual bits in `NUMBER`, which must be specified in base 10:
39
40 * _0_ &mdash; Uses the revised algorithm with no special handling.
41
42
--- www/env-opts.md
+++ www/env-opts.md
@@ -31,11 +31,12 @@
31
32 `--chdir DIRECTORY`: Change to the named directory before processing
33 any commands.
34
35
36 `--comfmtflags NUMBER`
37 `--comment-format NUMBER`: Specify flags that control how check-in comments
38 and certain other text outputs are formatted for display. The flags are
39 individual bits in `NUMBER`, which must be specified in base 10:
40
41 * _0_ &mdash; Uses the revised algorithm with no special handling.
42
43

Keyboard Shortcuts

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