Fossil SCM

Update the 'commit --private' command to only apply default branch name ("private") and color ("orange") if not specified otherwise on the command-line, and if the parent is not already private, to simplify the management of private branches with distinct names.

florian 2019-09-04 09:09 private-branches
Commit 836a85cbaead8fecb4345436e98d91726bd33e4206d9b7de40f8b13e2f406932
1 file changed +16 -10
+16 -10
--- src/checkin.c
+++ src/checkin.c
@@ -2048,10 +2048,12 @@
20482048
const char *zComment; /* Check-in comment */
20492049
Stmt q; /* Various queries */
20502050
char *zUuid; /* UUID of the new check-in */
20512051
int useHash = 0; /* True to verify file status using hashing */
20522052
int noSign = 0; /* True to omit signing the manifest using GPG */
2053
+ int privateFlag = 0; /* True if the --private option is present */
2054
+ int privateParent = 0; /* True if the parent check-in is private */
20532055
int isAMerge = 0; /* True if checking in a merge */
20542056
int noWarningFlag = 0; /* True if skipping all warnings */
20552057
int noPrompt = 0; /* True if skipping all prompts */
20562058
int forceFlag = 0; /* Undocumented: Disables all checks */
20572059
int forceDelta = 0; /* Force a delta-manifest */
@@ -2084,10 +2086,11 @@
20842086
memset(&sCiInfo, 0, sizeof(sCiInfo));
20852087
url_proxy_options();
20862088
/* --sha1sum is an undocumented alias for --hash for backwards compatiblity */
20872089
useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
20882090
noSign = find_option("nosign",0,0)!=0;
2091
+ privateFlag = find_option("private",0,0)!=0;
20892092
forceDelta = find_option("delta",0,0)!=0;
20902093
forceBaseline = find_option("baseline",0,0)!=0;
20912094
if( forceDelta && forceBaseline ){
20922095
fossil_fatal("cannot use --delta and --baseline together");
20932096
}
@@ -2116,17 +2119,10 @@
21162119
sizeof(char*)*(nTag+2));
21172120
sCiInfo.azTag[nTag++] = zTag;
21182121
sCiInfo.azTag[nTag] = 0;
21192122
}
21202123
zComFile = find_option("message-file", "M", 1);
2121
- if( find_option("private",0,0) ){
2122
- g.markPrivate = 1;
2123
- if( sCiInfo.zBranch==0 ) sCiInfo.zBranch = "private";
2124
- if( sCiInfo.zBrClr==0 && sCiInfo.zColor==0 ){
2125
- sCiInfo.zBrClr = "#fec084"; /* Orange */
2126
- }
2127
- }
21282124
sCiInfo.zDateOvrd = find_option("date-override",0,1);
21292125
sCiInfo.zUserOvrd = find_option("user-override",0,1);
21302126
db_must_be_within_tree();
21312127
noSign = db_get_boolean("omitsign", 0)|noSign;
21322128
if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
@@ -2136,15 +2132,25 @@
21362132
21372133
/* Get the ID of the parent manifest artifact */
21382134
vid = db_lget_int("checkout", 0);
21392135
if( vid==0 ){
21402136
useCksum = 1;
2141
- if( sCiInfo.zBranch==0 ) {
2137
+ if( privateFlag==0 && sCiInfo.zBranch==0 ) {
21422138
sCiInfo.zBranch=db_get("main-branch", "trunk");
21432139
}
2144
- }else if( content_is_private(vid) ){
2145
- g.markPrivate = 1;
2140
+ }else{
2141
+ privateParent = content_is_private(vid);
2142
+ }
2143
+
2144
+ /* Track the "private" status */
2145
+ g.markPrivate = privateFlag || privateParent;
2146
+ if( privateFlag && !privateParent ){
2147
+ /* Apply default branch name ("private") and color ("orange") if not
2148
+ ** specified otherwise on the command-line, and if the parent is not
2149
+ ** already private. */
2150
+ if( sCiInfo.zBranch==0 ) sCiInfo.zBranch = "private";
2151
+ if( sCiInfo.zBrClr==0 && sCiInfo.zColor==0 ) sCiInfo.zBrClr = "#fec084";
21462152
}
21472153
21482154
/* Do not allow the creation of a new branch using an existing open
21492155
** branch name unless the --force flag is used */
21502156
if( sCiInfo.zBranch!=0
21512157
--- src/checkin.c
+++ src/checkin.c
@@ -2048,10 +2048,12 @@
2048 const char *zComment; /* Check-in comment */
2049 Stmt q; /* Various queries */
2050 char *zUuid; /* UUID of the new check-in */
2051 int useHash = 0; /* True to verify file status using hashing */
2052 int noSign = 0; /* True to omit signing the manifest using GPG */
 
 
2053 int isAMerge = 0; /* True if checking in a merge */
2054 int noWarningFlag = 0; /* True if skipping all warnings */
2055 int noPrompt = 0; /* True if skipping all prompts */
2056 int forceFlag = 0; /* Undocumented: Disables all checks */
2057 int forceDelta = 0; /* Force a delta-manifest */
@@ -2084,10 +2086,11 @@
2084 memset(&sCiInfo, 0, sizeof(sCiInfo));
2085 url_proxy_options();
2086 /* --sha1sum is an undocumented alias for --hash for backwards compatiblity */
2087 useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
2088 noSign = find_option("nosign",0,0)!=0;
 
2089 forceDelta = find_option("delta",0,0)!=0;
2090 forceBaseline = find_option("baseline",0,0)!=0;
2091 if( forceDelta && forceBaseline ){
2092 fossil_fatal("cannot use --delta and --baseline together");
2093 }
@@ -2116,17 +2119,10 @@
2116 sizeof(char*)*(nTag+2));
2117 sCiInfo.azTag[nTag++] = zTag;
2118 sCiInfo.azTag[nTag] = 0;
2119 }
2120 zComFile = find_option("message-file", "M", 1);
2121 if( find_option("private",0,0) ){
2122 g.markPrivate = 1;
2123 if( sCiInfo.zBranch==0 ) sCiInfo.zBranch = "private";
2124 if( sCiInfo.zBrClr==0 && sCiInfo.zColor==0 ){
2125 sCiInfo.zBrClr = "#fec084"; /* Orange */
2126 }
2127 }
2128 sCiInfo.zDateOvrd = find_option("date-override",0,1);
2129 sCiInfo.zUserOvrd = find_option("user-override",0,1);
2130 db_must_be_within_tree();
2131 noSign = db_get_boolean("omitsign", 0)|noSign;
2132 if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
@@ -2136,15 +2132,25 @@
2136
2137 /* Get the ID of the parent manifest artifact */
2138 vid = db_lget_int("checkout", 0);
2139 if( vid==0 ){
2140 useCksum = 1;
2141 if( sCiInfo.zBranch==0 ) {
2142 sCiInfo.zBranch=db_get("main-branch", "trunk");
2143 }
2144 }else if( content_is_private(vid) ){
2145 g.markPrivate = 1;
 
 
 
 
 
 
 
 
 
 
2146 }
2147
2148 /* Do not allow the creation of a new branch using an existing open
2149 ** branch name unless the --force flag is used */
2150 if( sCiInfo.zBranch!=0
2151
--- src/checkin.c
+++ src/checkin.c
@@ -2048,10 +2048,12 @@
2048 const char *zComment; /* Check-in comment */
2049 Stmt q; /* Various queries */
2050 char *zUuid; /* UUID of the new check-in */
2051 int useHash = 0; /* True to verify file status using hashing */
2052 int noSign = 0; /* True to omit signing the manifest using GPG */
2053 int privateFlag = 0; /* True if the --private option is present */
2054 int privateParent = 0; /* True if the parent check-in is private */
2055 int isAMerge = 0; /* True if checking in a merge */
2056 int noWarningFlag = 0; /* True if skipping all warnings */
2057 int noPrompt = 0; /* True if skipping all prompts */
2058 int forceFlag = 0; /* Undocumented: Disables all checks */
2059 int forceDelta = 0; /* Force a delta-manifest */
@@ -2084,10 +2086,11 @@
2086 memset(&sCiInfo, 0, sizeof(sCiInfo));
2087 url_proxy_options();
2088 /* --sha1sum is an undocumented alias for --hash for backwards compatiblity */
2089 useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
2090 noSign = find_option("nosign",0,0)!=0;
2091 privateFlag = find_option("private",0,0)!=0;
2092 forceDelta = find_option("delta",0,0)!=0;
2093 forceBaseline = find_option("baseline",0,0)!=0;
2094 if( forceDelta && forceBaseline ){
2095 fossil_fatal("cannot use --delta and --baseline together");
2096 }
@@ -2116,17 +2119,10 @@
2119 sizeof(char*)*(nTag+2));
2120 sCiInfo.azTag[nTag++] = zTag;
2121 sCiInfo.azTag[nTag] = 0;
2122 }
2123 zComFile = find_option("message-file", "M", 1);
 
 
 
 
 
 
 
2124 sCiInfo.zDateOvrd = find_option("date-override",0,1);
2125 sCiInfo.zUserOvrd = find_option("user-override",0,1);
2126 db_must_be_within_tree();
2127 noSign = db_get_boolean("omitsign", 0)|noSign;
2128 if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
@@ -2136,15 +2132,25 @@
2132
2133 /* Get the ID of the parent manifest artifact */
2134 vid = db_lget_int("checkout", 0);
2135 if( vid==0 ){
2136 useCksum = 1;
2137 if( privateFlag==0 && sCiInfo.zBranch==0 ) {
2138 sCiInfo.zBranch=db_get("main-branch", "trunk");
2139 }
2140 }else{
2141 privateParent = content_is_private(vid);
2142 }
2143
2144 /* Track the "private" status */
2145 g.markPrivate = privateFlag || privateParent;
2146 if( privateFlag && !privateParent ){
2147 /* Apply default branch name ("private") and color ("orange") if not
2148 ** specified otherwise on the command-line, and if the parent is not
2149 ** already private. */
2150 if( sCiInfo.zBranch==0 ) sCiInfo.zBranch = "private";
2151 if( sCiInfo.zBrClr==0 && sCiInfo.zColor==0 ) sCiInfo.zBrClr = "#fec084";
2152 }
2153
2154 /* Do not allow the creation of a new branch using an existing open
2155 ** branch name unless the --force flag is used */
2156 if( sCiInfo.zBranch!=0
2157

Keyboard Shortcuts

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