Fossil SCM
Add the --private option to the "fossil branch new" command. Give a default orange color to private branches created by "fossil branch new". If the new branch created by "fossil branch new" is off of a private branch, make the new branch private too. Ticket [e24ec32b1da5f8f5e4abe]
Commit
2b3378169443a20446b360e93a3d834de43231fa
Parent
ae84e6c7d1b14fe…
1 file changed
+12
-3
+12
-3
| --- src/branch.c | ||
| +++ src/branch.c | ||
| @@ -39,13 +39,15 @@ | ||
| 39 | 39 | Blob branch; /* manifest for the new branch */ |
| 40 | 40 | Manifest *pParent; /* Parsed parent manifest */ |
| 41 | 41 | Blob mcksum; /* Self-checksum on the manifest */ |
| 42 | 42 | const char *zDateOvrd; /* Override date string */ |
| 43 | 43 | const char *zUserOvrd; /* Override user name */ |
| 44 | + int isPrivate = 0; /* True if the branch should be private */ | |
| 44 | 45 | |
| 45 | 46 | noSign = find_option("nosign","",0)!=0; |
| 46 | 47 | zColor = find_option("bgcolor","c",1); |
| 48 | + isPrivate = find_option("private",0,0)!=0; | |
| 47 | 49 | zDateOvrd = find_option("date-override",0,1); |
| 48 | 50 | zUserOvrd = find_option("user-override",0,1); |
| 49 | 51 | verify_all_options(); |
| 50 | 52 | if( g.argc<5 ){ |
| 51 | 53 | usage("new BRANCH-NAME CHECK-IN ?-bgcolor COLOR?"); |
| @@ -106,15 +108,21 @@ | ||
| 106 | 108 | } |
| 107 | 109 | manifest_destroy(pParent); |
| 108 | 110 | |
| 109 | 111 | /* Add the symbolic branch name and the "branch" tag to identify |
| 110 | 112 | ** this as a new branch */ |
| 113 | + if( content_is_private(rootid) ) isPrivate = 1; | |
| 114 | + if( isPrivate && zColor==0 ) zColor = "#fec084"; | |
| 111 | 115 | if( zColor!=0 ){ |
| 112 | 116 | blob_appendf(&branch, "T *bgcolor * %F\n", zColor); |
| 113 | 117 | } |
| 114 | 118 | blob_appendf(&branch, "T *branch * %F\n", zBranch); |
| 115 | 119 | blob_appendf(&branch, "T *sym-%F *\n", zBranch); |
| 120 | + if( isPrivate ){ | |
| 121 | + blob_appendf(&branch, "T +private *\n"); | |
| 122 | + noSign = 1; | |
| 123 | + } | |
| 116 | 124 | |
| 117 | 125 | /* Cancel all other symbolic tags */ |
| 118 | 126 | db_prepare(&q, |
| 119 | 127 | "SELECT tagname FROM tagxref, tag" |
| 120 | 128 | " WHERE tagxref.rid=%d AND tagxref.tagid=tag.tagid" |
| @@ -177,16 +185,17 @@ | ||
| 177 | 185 | ** Usage: %fossil branch SUBCOMMAND ... ?-R|--repository FILE? |
| 178 | 186 | ** |
| 179 | 187 | ** Run various subcommands to manage branches of the open repository or |
| 180 | 188 | ** of the repository identified by the -R or --repository option. |
| 181 | 189 | ** |
| 182 | -** %fossil branch new BRANCH-NAME BASIS ?-bgcolor COLOR? | |
| 190 | +** %fossil branch new BRANCH-NAME BASIS ?--bgcolor COLOR? ?--private? | |
| 183 | 191 | ** |
| 184 | 192 | ** Create a new branch BRANCH-NAME off of check-in BASIS. |
| 185 | -** You can optionally give the branch a default color. | |
| 193 | +** You can optionally give the branch a default color. The | |
| 194 | +** --private option makes the branch private. | |
| 186 | 195 | ** |
| 187 | -** %fossil branch list *or* | |
| 196 | +** %fossil branch list | |
| 188 | 197 | ** %fossil branch ls |
| 189 | 198 | ** |
| 190 | 199 | ** List all branches |
| 191 | 200 | ** |
| 192 | 201 | */ |
| 193 | 202 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -39,13 +39,15 @@ | |
| 39 | Blob branch; /* manifest for the new branch */ |
| 40 | Manifest *pParent; /* Parsed parent manifest */ |
| 41 | Blob mcksum; /* Self-checksum on the manifest */ |
| 42 | const char *zDateOvrd; /* Override date string */ |
| 43 | const char *zUserOvrd; /* Override user name */ |
| 44 | |
| 45 | noSign = find_option("nosign","",0)!=0; |
| 46 | zColor = find_option("bgcolor","c",1); |
| 47 | zDateOvrd = find_option("date-override",0,1); |
| 48 | zUserOvrd = find_option("user-override",0,1); |
| 49 | verify_all_options(); |
| 50 | if( g.argc<5 ){ |
| 51 | usage("new BRANCH-NAME CHECK-IN ?-bgcolor COLOR?"); |
| @@ -106,15 +108,21 @@ | |
| 106 | } |
| 107 | manifest_destroy(pParent); |
| 108 | |
| 109 | /* Add the symbolic branch name and the "branch" tag to identify |
| 110 | ** this as a new branch */ |
| 111 | if( zColor!=0 ){ |
| 112 | blob_appendf(&branch, "T *bgcolor * %F\n", zColor); |
| 113 | } |
| 114 | blob_appendf(&branch, "T *branch * %F\n", zBranch); |
| 115 | blob_appendf(&branch, "T *sym-%F *\n", zBranch); |
| 116 | |
| 117 | /* Cancel all other symbolic tags */ |
| 118 | db_prepare(&q, |
| 119 | "SELECT tagname FROM tagxref, tag" |
| 120 | " WHERE tagxref.rid=%d AND tagxref.tagid=tag.tagid" |
| @@ -177,16 +185,17 @@ | |
| 177 | ** Usage: %fossil branch SUBCOMMAND ... ?-R|--repository FILE? |
| 178 | ** |
| 179 | ** Run various subcommands to manage branches of the open repository or |
| 180 | ** of the repository identified by the -R or --repository option. |
| 181 | ** |
| 182 | ** %fossil branch new BRANCH-NAME BASIS ?-bgcolor COLOR? |
| 183 | ** |
| 184 | ** Create a new branch BRANCH-NAME off of check-in BASIS. |
| 185 | ** You can optionally give the branch a default color. |
| 186 | ** |
| 187 | ** %fossil branch list *or* |
| 188 | ** %fossil branch ls |
| 189 | ** |
| 190 | ** List all branches |
| 191 | ** |
| 192 | */ |
| 193 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -39,13 +39,15 @@ | |
| 39 | Blob branch; /* manifest for the new branch */ |
| 40 | Manifest *pParent; /* Parsed parent manifest */ |
| 41 | Blob mcksum; /* Self-checksum on the manifest */ |
| 42 | const char *zDateOvrd; /* Override date string */ |
| 43 | const char *zUserOvrd; /* Override user name */ |
| 44 | int isPrivate = 0; /* True if the branch should be private */ |
| 45 | |
| 46 | noSign = find_option("nosign","",0)!=0; |
| 47 | zColor = find_option("bgcolor","c",1); |
| 48 | isPrivate = find_option("private",0,0)!=0; |
| 49 | zDateOvrd = find_option("date-override",0,1); |
| 50 | zUserOvrd = find_option("user-override",0,1); |
| 51 | verify_all_options(); |
| 52 | if( g.argc<5 ){ |
| 53 | usage("new BRANCH-NAME CHECK-IN ?-bgcolor COLOR?"); |
| @@ -106,15 +108,21 @@ | |
| 108 | } |
| 109 | manifest_destroy(pParent); |
| 110 | |
| 111 | /* Add the symbolic branch name and the "branch" tag to identify |
| 112 | ** this as a new branch */ |
| 113 | if( content_is_private(rootid) ) isPrivate = 1; |
| 114 | if( isPrivate && zColor==0 ) zColor = "#fec084"; |
| 115 | if( zColor!=0 ){ |
| 116 | blob_appendf(&branch, "T *bgcolor * %F\n", zColor); |
| 117 | } |
| 118 | blob_appendf(&branch, "T *branch * %F\n", zBranch); |
| 119 | blob_appendf(&branch, "T *sym-%F *\n", zBranch); |
| 120 | if( isPrivate ){ |
| 121 | blob_appendf(&branch, "T +private *\n"); |
| 122 | noSign = 1; |
| 123 | } |
| 124 | |
| 125 | /* Cancel all other symbolic tags */ |
| 126 | db_prepare(&q, |
| 127 | "SELECT tagname FROM tagxref, tag" |
| 128 | " WHERE tagxref.rid=%d AND tagxref.tagid=tag.tagid" |
| @@ -177,16 +185,17 @@ | |
| 185 | ** Usage: %fossil branch SUBCOMMAND ... ?-R|--repository FILE? |
| 186 | ** |
| 187 | ** Run various subcommands to manage branches of the open repository or |
| 188 | ** of the repository identified by the -R or --repository option. |
| 189 | ** |
| 190 | ** %fossil branch new BRANCH-NAME BASIS ?--bgcolor COLOR? ?--private? |
| 191 | ** |
| 192 | ** Create a new branch BRANCH-NAME off of check-in BASIS. |
| 193 | ** You can optionally give the branch a default color. The |
| 194 | ** --private option makes the branch private. |
| 195 | ** |
| 196 | ** %fossil branch list |
| 197 | ** %fossil branch ls |
| 198 | ** |
| 199 | ** List all branches |
| 200 | ** |
| 201 | */ |
| 202 |