Fossil SCM

Require that the "branch new" command specify a basis. Do not let it use the current check-out. Otherwise it gets confusing to users.

drh 2009-01-20 22:38 trunk
Commit 4d39bbac10c92e41eb737bb434d64d7959607f2e
+6 -13
--- src/branch.c
+++ src/branch.c
@@ -48,12 +48,12 @@
4848
Blob mcksum; /* Self-checksum on the manifest */
4949
5050
noSign = find_option("nosign","",0)!=0;
5151
zColor = find_option("bgcolor","c",1);
5252
verify_all_options();
53
- if( g.argc<3 ){
54
- usage("branch new BRANCH-NAME ?ROOT-CHECK-IN? ?-bgcolor COLOR?");
53
+ if( g.argc<5 ){
54
+ usage("branch new BRANCH-NAME BASE-CHECK-IN ?-bgcolor COLOR?");
5555
}
5656
db_find_and_open_repository(1);
5757
noSign = db_get_int("omitsign", 0)|noSign;
5858
5959
/* fossil branch new name */
@@ -69,18 +69,11 @@
6969
fossil_fatal("branch \"%s\" already exists", zBranch);
7070
}
7171
7272
user_select();
7373
db_begin_transaction();
74
- if( g.argc<5 ){
75
- if( unsaved_changes() ){
76
- fossil_fatal("there are uncommitted changes. please commit first");
77
- }
78
- rootid = db_lget_int("checkout", 0);
79
- }else{
80
- rootid = name_to_rid(g.argv[4]);
81
- }
74
+ rootid = name_to_rid(g.argv[4]);
8275
if( rootid==0 ){
8376
fossil_fatal("unable to locate check-in off of which to branch");
8477
}
8578
8679
/* Create a manifest for the new branch */
@@ -184,14 +177,14 @@
184177
** Usage: %fossil branch SUBCOMMAND ... ?-R|--repository FILE?
185178
**
186179
** Run various subcommands on the branches of the open repository or
187180
** of the repository identified by the -R or --repository option.
188181
**
189
-** %fossil branch new BRANCH-NAME ?ROOT-CHECK-IN? ?-bgcolor COLOR?
182
+** %fossil branch new BRANCH-NAME BASIS ?-bgcolor COLOR?
190183
**
191
-** Create a new branch BRANCH-NAME. You can optionally give
192
-** a commit message and branch color.
184
+** Create a new branch BRANCH-NAME off of check-in BASIS.
185
+** You can optionally give the branch a default color.
193186
**
194187
** %fossil branch list
195188
**
196189
** List all branches
197190
**
198191
--- src/branch.c
+++ src/branch.c
@@ -48,12 +48,12 @@
48 Blob mcksum; /* Self-checksum on the manifest */
49
50 noSign = find_option("nosign","",0)!=0;
51 zColor = find_option("bgcolor","c",1);
52 verify_all_options();
53 if( g.argc<3 ){
54 usage("branch new BRANCH-NAME ?ROOT-CHECK-IN? ?-bgcolor COLOR?");
55 }
56 db_find_and_open_repository(1);
57 noSign = db_get_int("omitsign", 0)|noSign;
58
59 /* fossil branch new name */
@@ -69,18 +69,11 @@
69 fossil_fatal("branch \"%s\" already exists", zBranch);
70 }
71
72 user_select();
73 db_begin_transaction();
74 if( g.argc<5 ){
75 if( unsaved_changes() ){
76 fossil_fatal("there are uncommitted changes. please commit first");
77 }
78 rootid = db_lget_int("checkout", 0);
79 }else{
80 rootid = name_to_rid(g.argv[4]);
81 }
82 if( rootid==0 ){
83 fossil_fatal("unable to locate check-in off of which to branch");
84 }
85
86 /* Create a manifest for the new branch */
@@ -184,14 +177,14 @@
184 ** Usage: %fossil branch SUBCOMMAND ... ?-R|--repository FILE?
185 **
186 ** Run various subcommands on the branches of the open repository or
187 ** of the repository identified by the -R or --repository option.
188 **
189 ** %fossil branch new BRANCH-NAME ?ROOT-CHECK-IN? ?-bgcolor COLOR?
190 **
191 ** Create a new branch BRANCH-NAME. You can optionally give
192 ** a commit message and branch color.
193 **
194 ** %fossil branch list
195 **
196 ** List all branches
197 **
198
--- src/branch.c
+++ src/branch.c
@@ -48,12 +48,12 @@
48 Blob mcksum; /* Self-checksum on the manifest */
49
50 noSign = find_option("nosign","",0)!=0;
51 zColor = find_option("bgcolor","c",1);
52 verify_all_options();
53 if( g.argc<5 ){
54 usage("branch new BRANCH-NAME BASE-CHECK-IN ?-bgcolor COLOR?");
55 }
56 db_find_and_open_repository(1);
57 noSign = db_get_int("omitsign", 0)|noSign;
58
59 /* fossil branch new name */
@@ -69,18 +69,11 @@
69 fossil_fatal("branch \"%s\" already exists", zBranch);
70 }
71
72 user_select();
73 db_begin_transaction();
74 rootid = name_to_rid(g.argv[4]);
 
 
 
 
 
 
 
75 if( rootid==0 ){
76 fossil_fatal("unable to locate check-in off of which to branch");
77 }
78
79 /* Create a manifest for the new branch */
@@ -184,14 +177,14 @@
177 ** Usage: %fossil branch SUBCOMMAND ... ?-R|--repository FILE?
178 **
179 ** Run various subcommands on the 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
188 **
189 ** List all branches
190 **
191
--- src/manifest.c
+++ src/manifest.c
@@ -922,11 +922,10 @@
922922
" (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d AND tagtype>0),"
923923
" (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d),"
924924
" (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d));",
925925
m.rDate, rid, m.zUser, m.zComment,
926926
TAG_BGCOLOR, rid,
927
- TAG_BRBGCOLOR, rid,
928927
TAG_USER, rid,
929928
TAG_COMMENT, rid
930929
);
931930
}
932931
}
933932
--- src/manifest.c
+++ src/manifest.c
@@ -922,11 +922,10 @@
922 " (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d AND tagtype>0),"
923 " (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d),"
924 " (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d));",
925 m.rDate, rid, m.zUser, m.zComment,
926 TAG_BGCOLOR, rid,
927 TAG_BRBGCOLOR, rid,
928 TAG_USER, rid,
929 TAG_COMMENT, rid
930 );
931 }
932 }
933
--- src/manifest.c
+++ src/manifest.c
@@ -922,11 +922,10 @@
922 " (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d AND tagtype>0),"
923 " (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d),"
924 " (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d));",
925 m.rDate, rid, m.zUser, m.zComment,
926 TAG_BGCOLOR, rid,
 
927 TAG_USER, rid,
928 TAG_COMMENT, rid
929 );
930 }
931 }
932
+8 -9
--- src/schema.c
+++ src/schema.c
@@ -327,21 +327,20 @@
327327
/*
328328
** Predefined tagid values
329329
*/
330330
#if INTERFACE
331331
# define TAG_BGCOLOR 1 /* Set the background color for display */
332
-# define TAG_BRBGCOLOR 2 /* Background color for branches */
333
-# define TAG_COMMENT 3 /* The check-in comment */
334
-# define TAG_USER 4 /* User who made a checking */
335
-# define TAG_HIDDEN 5 /* Do not display or sync */
336
-# define TAG_PRIVATE 6 /* Display but do not sync */
337
-# define TAG_CLUSTER 7 /* A cluster */
338
-# define TAG_NEWBRANCH 8 /* First check-in of a new named branch */
339
-# define TAG_CLOSED 9 /* Do not display this check-in as a leaf */
332
+# define TAG_COMMENT 2 /* The check-in comment */
333
+# define TAG_USER 3 /* User who made a checking */
334
+# define TAG_HIDDEN 4 /* Do not display or sync */
335
+# define TAG_PRIVATE 5 /* Display but do not sync */
336
+# define TAG_CLUSTER 6 /* A cluster */
337
+# define TAG_NEWBRANCH 7 /* First check-in of a new named branch */
338
+# define TAG_CLOSED 8 /* Do not display this check-in as a leaf */
340339
#endif
341340
#if EXPORT_INTERFACE
342
-# define MAX_INT_TAG 9 /* The largest pre-assigned tag id */
341
+# define MAX_INT_TAG 8 /* The largest pre-assigned tag id */
343342
#endif
344343
345344
/*
346345
** The schema for the locate FOSSIL database file found at the root
347346
** of very check-out. This database contains the complete state of
348347
--- src/schema.c
+++ src/schema.c
@@ -327,21 +327,20 @@
327 /*
328 ** Predefined tagid values
329 */
330 #if INTERFACE
331 # define TAG_BGCOLOR 1 /* Set the background color for display */
332 # define TAG_BRBGCOLOR 2 /* Background color for branches */
333 # define TAG_COMMENT 3 /* The check-in comment */
334 # define TAG_USER 4 /* User who made a checking */
335 # define TAG_HIDDEN 5 /* Do not display or sync */
336 # define TAG_PRIVATE 6 /* Display but do not sync */
337 # define TAG_CLUSTER 7 /* A cluster */
338 # define TAG_NEWBRANCH 8 /* First check-in of a new named branch */
339 # define TAG_CLOSED 9 /* Do not display this check-in as a leaf */
340 #endif
341 #if EXPORT_INTERFACE
342 # define MAX_INT_TAG 9 /* The largest pre-assigned tag id */
343 #endif
344
345 /*
346 ** The schema for the locate FOSSIL database file found at the root
347 ** of very check-out. This database contains the complete state of
348
--- src/schema.c
+++ src/schema.c
@@ -327,21 +327,20 @@
327 /*
328 ** Predefined tagid values
329 */
330 #if INTERFACE
331 # define TAG_BGCOLOR 1 /* Set the background color for display */
332 # define TAG_COMMENT 2 /* The check-in comment */
333 # define TAG_USER 3 /* User who made a checking */
334 # define TAG_HIDDEN 4 /* Do not display or sync */
335 # define TAG_PRIVATE 5 /* Display but do not sync */
336 # define TAG_CLUSTER 6 /* A cluster */
337 # define TAG_NEWBRANCH 7 /* First check-in of a new named branch */
338 # define TAG_CLOSED 8 /* Do not display this check-in as a leaf */
 
339 #endif
340 #if EXPORT_INTERFACE
341 # define MAX_INT_TAG 8 /* The largest pre-assigned tag id */
342 #endif
343
344 /*
345 ** The schema for the locate FOSSIL database file found at the root
346 ** of very check-out. This database contains the complete state of
347

Keyboard Shortcuts

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