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]

drh 2011-03-26 12:53 trunk
Commit 2b3378169443a20446b360e93a3d834de43231fa
1 file changed +12 -3
+12 -3
--- src/branch.c
+++ src/branch.c
@@ -39,13 +39,15 @@
3939
Blob branch; /* manifest for the new branch */
4040
Manifest *pParent; /* Parsed parent manifest */
4141
Blob mcksum; /* Self-checksum on the manifest */
4242
const char *zDateOvrd; /* Override date string */
4343
const char *zUserOvrd; /* Override user name */
44
+ int isPrivate = 0; /* True if the branch should be private */
4445
4546
noSign = find_option("nosign","",0)!=0;
4647
zColor = find_option("bgcolor","c",1);
48
+ isPrivate = find_option("private",0,0)!=0;
4749
zDateOvrd = find_option("date-override",0,1);
4850
zUserOvrd = find_option("user-override",0,1);
4951
verify_all_options();
5052
if( g.argc<5 ){
5153
usage("new BRANCH-NAME CHECK-IN ?-bgcolor COLOR?");
@@ -106,15 +108,21 @@
106108
}
107109
manifest_destroy(pParent);
108110
109111
/* Add the symbolic branch name and the "branch" tag to identify
110112
** this as a new branch */
113
+ if( content_is_private(rootid) ) isPrivate = 1;
114
+ if( isPrivate && zColor==0 ) zColor = "#fec084";
111115
if( zColor!=0 ){
112116
blob_appendf(&branch, "T *bgcolor * %F\n", zColor);
113117
}
114118
blob_appendf(&branch, "T *branch * %F\n", zBranch);
115119
blob_appendf(&branch, "T *sym-%F *\n", zBranch);
120
+ if( isPrivate ){
121
+ blob_appendf(&branch, "T +private *\n");
122
+ noSign = 1;
123
+ }
116124
117125
/* Cancel all other symbolic tags */
118126
db_prepare(&q,
119127
"SELECT tagname FROM tagxref, tag"
120128
" WHERE tagxref.rid=%d AND tagxref.tagid=tag.tagid"
@@ -177,16 +185,17 @@
177185
** Usage: %fossil branch SUBCOMMAND ... ?-R|--repository FILE?
178186
**
179187
** Run various subcommands to manage branches of the open repository or
180188
** of the repository identified by the -R or --repository option.
181189
**
182
-** %fossil branch new BRANCH-NAME BASIS ?-bgcolor COLOR?
190
+** %fossil branch new BRANCH-NAME BASIS ?--bgcolor COLOR? ?--private?
183191
**
184192
** 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.
186195
**
187
-** %fossil branch list *or*
196
+** %fossil branch list
188197
** %fossil branch ls
189198
**
190199
** List all branches
191200
**
192201
*/
193202
--- 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

Keyboard Shortcuts

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