Fossil SCM

A value of "auto" for --branchcolor (commit) or --bgcolor (branch new) instructs Fossil to choose the color automatically. This makes it possible to have private branches that are not colored orange by default.

drh 2021-07-15 02:21 trunk merge
Commit b910219a4f4e6c5e08592bcb4392f2472223845dbd7ec2cff02e4b97a2472bf8
+8 -1
--- src/branch.c
+++ src/branch.c
@@ -81,13 +81,18 @@
8181
Manifest *pParent; /* Parsed parent manifest */
8282
Blob mcksum; /* Self-checksum on the manifest */
8383
const char *zDateOvrd; /* Override date string */
8484
const char *zUserOvrd; /* Override user name */
8585
int isPrivate = 0; /* True if the branch should be private */
86
+ int bAutoColor = 0; /* Value of "--bgcolor" is "auto" */
8687
8788
noSign = find_option("nosign","",0)!=0;
8889
zColor = find_option("bgcolor","c",1);
90
+ if( fossil_strncmp(zColor, "auto", 4)==0 ) {
91
+ bAutoColor = 1;
92
+ zColor = 0;
93
+ }
8994
isPrivate = find_option("private",0,0)!=0;
9095
zDateOvrd = find_option("date-override",0,1);
9196
zUserOvrd = find_option("user-override",0,1);
9297
verify_all_options();
9398
if( g.argc<5 ){
@@ -151,11 +156,11 @@
151156
manifest_destroy(pParent);
152157
153158
/* Add the symbolic branch name and the "branch" tag to identify
154159
** this as a new branch */
155160
if( content_is_private(rootid) ) isPrivate = 1;
156
- if( isPrivate && zColor==0 ) zColor = "#fec084";
161
+ if( isPrivate && zColor==0 && !bAutoColor) zColor = "#fec084";
157162
if( zColor!=0 ){
158163
blob_appendf(&branch, "T *bgcolor * %F\n", zColor);
159164
}
160165
blob_appendf(&branch, "T *branch * %F\n", zBranch);
161166
blob_appendf(&branch, "T *sym-%F *\n", zBranch);
@@ -374,10 +379,12 @@
374379
**
375380
** Create a new branch BRANCH-NAME off of check-in BASIS.
376381
** Supported options for this subcommand include:
377382
** --private branch is private (i.e., remains local)
378383
** --bgcolor COLOR use COLOR instead of automatic background
384
+** ("auto" lets Fossil choose it automatically,
385
+** even for private branches)
379386
** --nosign do not sign contents on this branch
380387
** --date-override DATE DATE to use instead of 'now'
381388
** --user-override USER USER to use instead of the current default
382389
**
383390
** DATE may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
384391
--- src/branch.c
+++ src/branch.c
@@ -81,13 +81,18 @@
81 Manifest *pParent; /* Parsed parent manifest */
82 Blob mcksum; /* Self-checksum on the manifest */
83 const char *zDateOvrd; /* Override date string */
84 const char *zUserOvrd; /* Override user name */
85 int isPrivate = 0; /* True if the branch should be private */
 
86
87 noSign = find_option("nosign","",0)!=0;
88 zColor = find_option("bgcolor","c",1);
 
 
 
 
89 isPrivate = find_option("private",0,0)!=0;
90 zDateOvrd = find_option("date-override",0,1);
91 zUserOvrd = find_option("user-override",0,1);
92 verify_all_options();
93 if( g.argc<5 ){
@@ -151,11 +156,11 @@
151 manifest_destroy(pParent);
152
153 /* Add the symbolic branch name and the "branch" tag to identify
154 ** this as a new branch */
155 if( content_is_private(rootid) ) isPrivate = 1;
156 if( isPrivate && zColor==0 ) zColor = "#fec084";
157 if( zColor!=0 ){
158 blob_appendf(&branch, "T *bgcolor * %F\n", zColor);
159 }
160 blob_appendf(&branch, "T *branch * %F\n", zBranch);
161 blob_appendf(&branch, "T *sym-%F *\n", zBranch);
@@ -374,10 +379,12 @@
374 **
375 ** Create a new branch BRANCH-NAME off of check-in BASIS.
376 ** Supported options for this subcommand include:
377 ** --private branch is private (i.e., remains local)
378 ** --bgcolor COLOR use COLOR instead of automatic background
 
 
379 ** --nosign do not sign contents on this branch
380 ** --date-override DATE DATE to use instead of 'now'
381 ** --user-override USER USER to use instead of the current default
382 **
383 ** DATE may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
384
--- src/branch.c
+++ src/branch.c
@@ -81,13 +81,18 @@
81 Manifest *pParent; /* Parsed parent manifest */
82 Blob mcksum; /* Self-checksum on the manifest */
83 const char *zDateOvrd; /* Override date string */
84 const char *zUserOvrd; /* Override user name */
85 int isPrivate = 0; /* True if the branch should be private */
86 int bAutoColor = 0; /* Value of "--bgcolor" is "auto" */
87
88 noSign = find_option("nosign","",0)!=0;
89 zColor = find_option("bgcolor","c",1);
90 if( fossil_strncmp(zColor, "auto", 4)==0 ) {
91 bAutoColor = 1;
92 zColor = 0;
93 }
94 isPrivate = find_option("private",0,0)!=0;
95 zDateOvrd = find_option("date-override",0,1);
96 zUserOvrd = find_option("user-override",0,1);
97 verify_all_options();
98 if( g.argc<5 ){
@@ -151,11 +156,11 @@
156 manifest_destroy(pParent);
157
158 /* Add the symbolic branch name and the "branch" tag to identify
159 ** this as a new branch */
160 if( content_is_private(rootid) ) isPrivate = 1;
161 if( isPrivate && zColor==0 && !bAutoColor) zColor = "#fec084";
162 if( zColor!=0 ){
163 blob_appendf(&branch, "T *bgcolor * %F\n", zColor);
164 }
165 blob_appendf(&branch, "T *branch * %F\n", zBranch);
166 blob_appendf(&branch, "T *sym-%F *\n", zBranch);
@@ -374,10 +379,12 @@
379 **
380 ** Create a new branch BRANCH-NAME off of check-in BASIS.
381 ** Supported options for this subcommand include:
382 ** --private branch is private (i.e., remains local)
383 ** --bgcolor COLOR use COLOR instead of automatic background
384 ** ("auto" lets Fossil choose it automatically,
385 ** even for private branches)
386 ** --nosign do not sign contents on this branch
387 ** --date-override DATE DATE to use instead of 'now'
388 ** --user-override USER USER to use instead of the current default
389 **
390 ** DATE may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
391
+10 -1
--- src/checkin.c
+++ src/checkin.c
@@ -2127,10 +2127,12 @@
21272127
** --allow-older allow a commit older than its ancestor
21282128
** --baseline use a baseline manifest in the commit process
21292129
** --bgcolor COLOR apply COLOR to this one check-in only
21302130
** --branch NEW-BRANCH-NAME check in to this new branch
21312131
** --branchcolor COLOR apply given COLOR to the branch
2132
+** ("auto" lets Fossil choose it automatically,
2133
+** even for private branches)
21322134
** --close close the branch being committed
21332135
** --date-override DATETIME DATE to use instead of 'now'
21342136
** --delta use a delta manifest in the commit process
21352137
** --hash verify file status using hashing rather
21362138
** than relying on file mtimes
@@ -2204,10 +2206,11 @@
22042206
int nConflict = 0; /* Number of unresolved merge conflicts */
22052207
int abortCommit = 0; /* Abort the commit due to text format conversions */
22062208
Blob ans; /* Answer to continuation prompts */
22072209
char cReply; /* First character of ans */
22082210
int bRecheck = 0; /* Repeat fork and closed-branch checks*/
2211
+ int bAutoBrClr = 0; /* Value of "--branchcolor" is "auto" */
22092212
22102213
memset(&sCiInfo, 0, sizeof(sCiInfo));
22112214
url_proxy_options();
22122215
/* --sha1sum is an undocumented alias for --hash for backwards compatiblity */
22132216
useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
@@ -2239,10 +2242,14 @@
22392242
noVerify = find_option("no-verify",0,0)!=0;
22402243
bTrace = find_option("trace",0,0)!=0;
22412244
sCiInfo.zBranch = find_option("branch","b",1);
22422245
sCiInfo.zColor = find_option("bgcolor",0,1);
22432246
sCiInfo.zBrClr = find_option("branchcolor",0,1);
2247
+ if ( fossil_strncmp(sCiInfo.zBrClr, "auto", 4)==0 ) {
2248
+ bAutoBrClr = 1;
2249
+ sCiInfo.zBrClr = 0;
2250
+ }
22442251
sCiInfo.closeFlag = find_option("close",0,0)!=0;
22452252
sCiInfo.integrateFlag = find_option("integrate",0,0)!=0;
22462253
sCiInfo.zMimetype = find_option("mimetype",0,1);
22472254
sCiInfo.verboseFlag = find_option("verbose", "v", 0)!=0;
22482255
while( (zTag = find_option("tag",0,1))!=0 ){
@@ -2278,11 +2285,13 @@
22782285
if( privateFlag && !privateParent ){
22792286
/* Apply default branch name ("private") and color ("orange") if not
22802287
** specified otherwise on the command-line, and if the parent is not
22812288
** already private. */
22822289
if( sCiInfo.zBranch==0 ) sCiInfo.zBranch = "private";
2283
- if( sCiInfo.zBrClr==0 && sCiInfo.zColor==0 ) sCiInfo.zBrClr = "#fec084";
2290
+ if( sCiInfo.zBrClr==0 && sCiInfo.zColor==0 && !bAutoBrClr) {
2291
+ sCiInfo.zBrClr = "#fec084";
2292
+ }
22842293
}
22852294
22862295
/* Do not allow the creation of a new branch using an existing open
22872296
** branch name unless the --force flag is used */
22882297
if( sCiInfo.zBranch!=0
22892298
--- src/checkin.c
+++ src/checkin.c
@@ -2127,10 +2127,12 @@
2127 ** --allow-older allow a commit older than its ancestor
2128 ** --baseline use a baseline manifest in the commit process
2129 ** --bgcolor COLOR apply COLOR to this one check-in only
2130 ** --branch NEW-BRANCH-NAME check in to this new branch
2131 ** --branchcolor COLOR apply given COLOR to the branch
 
 
2132 ** --close close the branch being committed
2133 ** --date-override DATETIME DATE to use instead of 'now'
2134 ** --delta use a delta manifest in the commit process
2135 ** --hash verify file status using hashing rather
2136 ** than relying on file mtimes
@@ -2204,10 +2206,11 @@
2204 int nConflict = 0; /* Number of unresolved merge conflicts */
2205 int abortCommit = 0; /* Abort the commit due to text format conversions */
2206 Blob ans; /* Answer to continuation prompts */
2207 char cReply; /* First character of ans */
2208 int bRecheck = 0; /* Repeat fork and closed-branch checks*/
 
2209
2210 memset(&sCiInfo, 0, sizeof(sCiInfo));
2211 url_proxy_options();
2212 /* --sha1sum is an undocumented alias for --hash for backwards compatiblity */
2213 useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
@@ -2239,10 +2242,14 @@
2239 noVerify = find_option("no-verify",0,0)!=0;
2240 bTrace = find_option("trace",0,0)!=0;
2241 sCiInfo.zBranch = find_option("branch","b",1);
2242 sCiInfo.zColor = find_option("bgcolor",0,1);
2243 sCiInfo.zBrClr = find_option("branchcolor",0,1);
 
 
 
 
2244 sCiInfo.closeFlag = find_option("close",0,0)!=0;
2245 sCiInfo.integrateFlag = find_option("integrate",0,0)!=0;
2246 sCiInfo.zMimetype = find_option("mimetype",0,1);
2247 sCiInfo.verboseFlag = find_option("verbose", "v", 0)!=0;
2248 while( (zTag = find_option("tag",0,1))!=0 ){
@@ -2278,11 +2285,13 @@
2278 if( privateFlag && !privateParent ){
2279 /* Apply default branch name ("private") and color ("orange") if not
2280 ** specified otherwise on the command-line, and if the parent is not
2281 ** already private. */
2282 if( sCiInfo.zBranch==0 ) sCiInfo.zBranch = "private";
2283 if( sCiInfo.zBrClr==0 && sCiInfo.zColor==0 ) sCiInfo.zBrClr = "#fec084";
 
 
2284 }
2285
2286 /* Do not allow the creation of a new branch using an existing open
2287 ** branch name unless the --force flag is used */
2288 if( sCiInfo.zBranch!=0
2289
--- src/checkin.c
+++ src/checkin.c
@@ -2127,10 +2127,12 @@
2127 ** --allow-older allow a commit older than its ancestor
2128 ** --baseline use a baseline manifest in the commit process
2129 ** --bgcolor COLOR apply COLOR to this one check-in only
2130 ** --branch NEW-BRANCH-NAME check in to this new branch
2131 ** --branchcolor COLOR apply given COLOR to the branch
2132 ** ("auto" lets Fossil choose it automatically,
2133 ** even for private branches)
2134 ** --close close the branch being committed
2135 ** --date-override DATETIME DATE to use instead of 'now'
2136 ** --delta use a delta manifest in the commit process
2137 ** --hash verify file status using hashing rather
2138 ** than relying on file mtimes
@@ -2204,10 +2206,11 @@
2206 int nConflict = 0; /* Number of unresolved merge conflicts */
2207 int abortCommit = 0; /* Abort the commit due to text format conversions */
2208 Blob ans; /* Answer to continuation prompts */
2209 char cReply; /* First character of ans */
2210 int bRecheck = 0; /* Repeat fork and closed-branch checks*/
2211 int bAutoBrClr = 0; /* Value of "--branchcolor" is "auto" */
2212
2213 memset(&sCiInfo, 0, sizeof(sCiInfo));
2214 url_proxy_options();
2215 /* --sha1sum is an undocumented alias for --hash for backwards compatiblity */
2216 useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
@@ -2239,10 +2242,14 @@
2242 noVerify = find_option("no-verify",0,0)!=0;
2243 bTrace = find_option("trace",0,0)!=0;
2244 sCiInfo.zBranch = find_option("branch","b",1);
2245 sCiInfo.zColor = find_option("bgcolor",0,1);
2246 sCiInfo.zBrClr = find_option("branchcolor",0,1);
2247 if ( fossil_strncmp(sCiInfo.zBrClr, "auto", 4)==0 ) {
2248 bAutoBrClr = 1;
2249 sCiInfo.zBrClr = 0;
2250 }
2251 sCiInfo.closeFlag = find_option("close",0,0)!=0;
2252 sCiInfo.integrateFlag = find_option("integrate",0,0)!=0;
2253 sCiInfo.zMimetype = find_option("mimetype",0,1);
2254 sCiInfo.verboseFlag = find_option("verbose", "v", 0)!=0;
2255 while( (zTag = find_option("tag",0,1))!=0 ){
@@ -2278,11 +2285,13 @@
2285 if( privateFlag && !privateParent ){
2286 /* Apply default branch name ("private") and color ("orange") if not
2287 ** specified otherwise on the command-line, and if the parent is not
2288 ** already private. */
2289 if( sCiInfo.zBranch==0 ) sCiInfo.zBranch = "private";
2290 if( sCiInfo.zBrClr==0 && sCiInfo.zColor==0 && !bAutoBrClr) {
2291 sCiInfo.zBrClr = "#fec084";
2292 }
2293 }
2294
2295 /* Do not allow the creation of a new branch using an existing open
2296 ** branch name unless the --force flag is used */
2297 if( sCiInfo.zBranch!=0
2298
--- src/json_branch.c
+++ src/json_branch.c
@@ -197,11 +197,16 @@
197197
char *zDate; /* Date that branch was created */
198198
char *zComment; /* Check-in comment for the new branch */
199199
Blob branch; /* manifest for the new branch */
200200
Manifest *pParent; /* Parsed parent manifest */
201201
Blob mcksum; /* Self-checksum on the manifest */
202
+ int bAutoColor = 0; /* Value of "--bgcolor" is "auto" */
202203
204
+ if( fossil_strncmp(zColor, "auto", 4)==0 ) {
205
+ bAutoColor = 1;
206
+ zColor = 0;
207
+ }
203208
/* fossil branch new name */
204209
if( zBranch==0 || zBranch[0]==0 ){
205210
zOpt->rcErrMsg = "Branch name may not be null/empty.";
206211
return FSL_JSON_E_INVALID_ARGS;
207212
}
@@ -260,11 +265,11 @@
260265
manifest_destroy(pParent);
261266
262267
/* Add the symbolic branch name and the "branch" tag to identify
263268
** this as a new branch */
264269
if( content_is_private(rootid) ) zOpt->isPrivate = 1;
265
- if( zOpt->isPrivate && zColor==0 ) zColor = "#fec084";
270
+ if( zOpt->isPrivate && zColor==0 && !bColor) zColor = "#fec084";
266271
if( zColor!=0 ){
267272
blob_appendf(&branch, "T *bgcolor * %F\n", zColor);
268273
}
269274
blob_appendf(&branch, "T *branch * %F\n", zBranch);
270275
blob_appendf(&branch, "T *sym-%F *\n", zBranch);
271276
--- src/json_branch.c
+++ src/json_branch.c
@@ -197,11 +197,16 @@
197 char *zDate; /* Date that branch was created */
198 char *zComment; /* Check-in comment for the new branch */
199 Blob branch; /* manifest for the new branch */
200 Manifest *pParent; /* Parsed parent manifest */
201 Blob mcksum; /* Self-checksum on the manifest */
 
202
 
 
 
 
203 /* fossil branch new name */
204 if( zBranch==0 || zBranch[0]==0 ){
205 zOpt->rcErrMsg = "Branch name may not be null/empty.";
206 return FSL_JSON_E_INVALID_ARGS;
207 }
@@ -260,11 +265,11 @@
260 manifest_destroy(pParent);
261
262 /* Add the symbolic branch name and the "branch" tag to identify
263 ** this as a new branch */
264 if( content_is_private(rootid) ) zOpt->isPrivate = 1;
265 if( zOpt->isPrivate && zColor==0 ) zColor = "#fec084";
266 if( zColor!=0 ){
267 blob_appendf(&branch, "T *bgcolor * %F\n", zColor);
268 }
269 blob_appendf(&branch, "T *branch * %F\n", zBranch);
270 blob_appendf(&branch, "T *sym-%F *\n", zBranch);
271
--- src/json_branch.c
+++ src/json_branch.c
@@ -197,11 +197,16 @@
197 char *zDate; /* Date that branch was created */
198 char *zComment; /* Check-in comment for the new branch */
199 Blob branch; /* manifest for the new branch */
200 Manifest *pParent; /* Parsed parent manifest */
201 Blob mcksum; /* Self-checksum on the manifest */
202 int bAutoColor = 0; /* Value of "--bgcolor" is "auto" */
203
204 if( fossil_strncmp(zColor, "auto", 4)==0 ) {
205 bAutoColor = 1;
206 zColor = 0;
207 }
208 /* fossil branch new name */
209 if( zBranch==0 || zBranch[0]==0 ){
210 zOpt->rcErrMsg = "Branch name may not be null/empty.";
211 return FSL_JSON_E_INVALID_ARGS;
212 }
@@ -260,11 +265,11 @@
265 manifest_destroy(pParent);
266
267 /* Add the symbolic branch name and the "branch" tag to identify
268 ** this as a new branch */
269 if( content_is_private(rootid) ) zOpt->isPrivate = 1;
270 if( zOpt->isPrivate && zColor==0 && !bColor) zColor = "#fec084";
271 if( zColor!=0 ){
272 blob_appendf(&branch, "T *bgcolor * %F\n", zColor);
273 }
274 blob_appendf(&branch, "T *branch * %F\n", zBranch);
275 blob_appendf(&branch, "T *sym-%F *\n", zBranch);
276

Keyboard Shortcuts

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