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.
Commit
836a85cbaead8fecb4345436e98d91726bd33e4206d9b7de40f8b13e2f406932
Parent
8268c5dafba8acd…
1 file changed
+16
-10
+16
-10
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -2048,10 +2048,12 @@ | ||
| 2048 | 2048 | const char *zComment; /* Check-in comment */ |
| 2049 | 2049 | Stmt q; /* Various queries */ |
| 2050 | 2050 | char *zUuid; /* UUID of the new check-in */ |
| 2051 | 2051 | int useHash = 0; /* True to verify file status using hashing */ |
| 2052 | 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 */ | |
| 2053 | 2055 | int isAMerge = 0; /* True if checking in a merge */ |
| 2054 | 2056 | int noWarningFlag = 0; /* True if skipping all warnings */ |
| 2055 | 2057 | int noPrompt = 0; /* True if skipping all prompts */ |
| 2056 | 2058 | int forceFlag = 0; /* Undocumented: Disables all checks */ |
| 2057 | 2059 | int forceDelta = 0; /* Force a delta-manifest */ |
| @@ -2084,10 +2086,11 @@ | ||
| 2084 | 2086 | memset(&sCiInfo, 0, sizeof(sCiInfo)); |
| 2085 | 2087 | url_proxy_options(); |
| 2086 | 2088 | /* --sha1sum is an undocumented alias for --hash for backwards compatiblity */ |
| 2087 | 2089 | useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0; |
| 2088 | 2090 | noSign = find_option("nosign",0,0)!=0; |
| 2091 | + privateFlag = find_option("private",0,0)!=0; | |
| 2089 | 2092 | forceDelta = find_option("delta",0,0)!=0; |
| 2090 | 2093 | forceBaseline = find_option("baseline",0,0)!=0; |
| 2091 | 2094 | if( forceDelta && forceBaseline ){ |
| 2092 | 2095 | fossil_fatal("cannot use --delta and --baseline together"); |
| 2093 | 2096 | } |
| @@ -2116,17 +2119,10 @@ | ||
| 2116 | 2119 | sizeof(char*)*(nTag+2)); |
| 2117 | 2120 | sCiInfo.azTag[nTag++] = zTag; |
| 2118 | 2121 | sCiInfo.azTag[nTag] = 0; |
| 2119 | 2122 | } |
| 2120 | 2123 | 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 | 2124 | sCiInfo.zDateOvrd = find_option("date-override",0,1); |
| 2129 | 2125 | sCiInfo.zUserOvrd = find_option("user-override",0,1); |
| 2130 | 2126 | db_must_be_within_tree(); |
| 2131 | 2127 | noSign = db_get_boolean("omitsign", 0)|noSign; |
| 2132 | 2128 | if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; } |
| @@ -2136,15 +2132,25 @@ | ||
| 2136 | 2132 | |
| 2137 | 2133 | /* Get the ID of the parent manifest artifact */ |
| 2138 | 2134 | vid = db_lget_int("checkout", 0); |
| 2139 | 2135 | if( vid==0 ){ |
| 2140 | 2136 | useCksum = 1; |
| 2141 | - if( sCiInfo.zBranch==0 ) { | |
| 2137 | + if( privateFlag==0 && sCiInfo.zBranch==0 ) { | |
| 2142 | 2138 | sCiInfo.zBranch=db_get("main-branch", "trunk"); |
| 2143 | 2139 | } |
| 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"; | |
| 2146 | 2152 | } |
| 2147 | 2153 | |
| 2148 | 2154 | /* Do not allow the creation of a new branch using an existing open |
| 2149 | 2155 | ** branch name unless the --force flag is used */ |
| 2150 | 2156 | if( sCiInfo.zBranch!=0 |
| 2151 | 2157 |
| --- 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 |