Fossil

Check-in [4d39bbac10]
Login

Check-in [4d39bbac10]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Require that the "branch new" command specify a basis. Do not let it use the current check-out. Otherwise it gets confusing to users.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4d39bbac10c92e41eb737bb434d64d7959607f2e
User & Date: drh 2009-01-20 22:38:56.000
References
2009-01-20
22:54 New ticket [309c57b3d2] database error on hyperlinked tagname in tag menu. ... (artifact: 28d8be8670 user: anonymous)
Context
2009-01-20
22:53
Add a gray color option on the color changer. Help the "info" webpage to figure out that an artifact is a check-ins when the check-in changes no files relative to its parent (when the check-in only creates a new branch.) ... (check-in: 3b3116e490 user: drh tags: trunk)
22:38
Require that the "branch new" command specify a basis. Do not let it use the current check-out. Otherwise it gets confusing to users. ... (check-in: 4d39bbac10 user: drh tags: trunk)
22:21
Add web-based branch color changer. Add the "branch list" command. Simplifications to color propagation logic. ... (check-in: b7f32a71ab user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/branch.c.
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
  Blob parent;           /* root check-in manifest */
  Manifest mParent;      /* Parsed parent manifest */
  Blob mcksum;           /* Self-checksum on the manifest */
 
  noSign = find_option("nosign","",0)!=0;
  zColor = find_option("bgcolor","c",1);
  verify_all_options();
  if( g.argc<3 ){
    usage("branch new BRANCH-NAME ?ROOT-CHECK-IN? ?-bgcolor COLOR?");
  }
  db_find_and_open_repository(1);  
  noSign = db_get_int("omitsign", 0)|noSign;
  
  /* fossil branch new name */
  zBranch = g.argv[3];
  if( zBranch==0 || zBranch[0]==0 ){
    fossil_panic("branch name cannot be empty");
  }
  if( db_exists(
        "SELECT 1 FROM tagxref"
        " WHERE tagtype>0"
        "   AND tagid=(SELECT tagid FROM tag WHERE tagname='sym-%s')",
        zBranch)!=0 ){
    fossil_fatal("branch \"%s\" already exists", zBranch);
  }

  user_select();
  db_begin_transaction();
  if( g.argc<5 ){
    if( unsaved_changes() ){
      fossil_fatal("there are uncommitted changes. please commit first");
    }
    rootid = db_lget_int("checkout", 0);
  }else{
    rootid = name_to_rid(g.argv[4]);
  }
  if( rootid==0 ){
    fossil_fatal("unable to locate check-in off of which to branch");
  }

  /* Create a manifest for the new branch */
  blob_zero(&branch);
  zComment = mprintf("Create new branch named \"%h\"", zBranch);







|
|



















<
<
<
<
<
<
|
<







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73






74

75
76
77
78
79
80
81
  Blob parent;           /* root check-in manifest */
  Manifest mParent;      /* Parsed parent manifest */
  Blob mcksum;           /* Self-checksum on the manifest */
 
  noSign = find_option("nosign","",0)!=0;
  zColor = find_option("bgcolor","c",1);
  verify_all_options();
  if( g.argc<5 ){
    usage("branch new BRANCH-NAME BASE-CHECK-IN ?-bgcolor COLOR?");
  }
  db_find_and_open_repository(1);  
  noSign = db_get_int("omitsign", 0)|noSign;
  
  /* fossil branch new name */
  zBranch = g.argv[3];
  if( zBranch==0 || zBranch[0]==0 ){
    fossil_panic("branch name cannot be empty");
  }
  if( db_exists(
        "SELECT 1 FROM tagxref"
        " WHERE tagtype>0"
        "   AND tagid=(SELECT tagid FROM tag WHERE tagname='sym-%s')",
        zBranch)!=0 ){
    fossil_fatal("branch \"%s\" already exists", zBranch);
  }

  user_select();
  db_begin_transaction();






  rootid = name_to_rid(g.argv[4]);

  if( rootid==0 ){
    fossil_fatal("unable to locate check-in off of which to branch");
  }

  /* Create a manifest for the new branch */
  blob_zero(&branch);
  zComment = mprintf("Create new branch named \"%h\"", zBranch);
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
** COMMAND: branch
**
** Usage: %fossil branch SUBCOMMAND ... ?-R|--repository FILE?
**
** Run various subcommands on the branches of the open repository or
** of the repository identified by the -R or --repository option.
**
**    %fossil branch new BRANCH-NAME ?ROOT-CHECK-IN? ?-bgcolor COLOR? 
**
**        Create a new branch BRANCH-NAME. You can optionally give
**        a commit message and branch color.
**
**    %fossil branch list
**
**        List all branches
**
*/
void branch_cmd(void){







|

|
|







175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
** COMMAND: branch
**
** Usage: %fossil branch SUBCOMMAND ... ?-R|--repository FILE?
**
** Run various subcommands on the branches of the open repository or
** of the repository identified by the -R or --repository option.
**
**    %fossil branch new BRANCH-NAME BASIS ?-bgcolor COLOR? 
**
**        Create a new branch BRANCH-NAME off of check-in BASIS.
**        You can optionally give the branch a default color.
**
**    %fossil branch list
**
**        List all branches
**
*/
void branch_cmd(void){
Changes to src/manifest.c.
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
        "                  bgcolor,euser,ecomment)"
        "VALUES('ci',%.17g,%d,%Q,%Q,"
        " (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d AND tagtype>0),"
        "  (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d),"
        "  (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d));",
        m.rDate, rid, m.zUser, m.zComment, 
        TAG_BGCOLOR, rid,
        TAG_BRBGCOLOR, rid,
        TAG_USER, rid,
        TAG_COMMENT, rid
      );
    }
  }
  if( m.type==CFTYPE_CLUSTER ){
    tag_insert("cluster", 1, 0, rid, m.rDate, rid);







<







920
921
922
923
924
925
926

927
928
929
930
931
932
933
        "                  bgcolor,euser,ecomment)"
        "VALUES('ci',%.17g,%d,%Q,%Q,"
        " (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d AND tagtype>0),"
        "  (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d),"
        "  (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d));",
        m.rDate, rid, m.zUser, m.zComment, 
        TAG_BGCOLOR, rid,

        TAG_USER, rid,
        TAG_COMMENT, rid
      );
    }
  }
  if( m.type==CFTYPE_CLUSTER ){
    tag_insert("cluster", 1, 0, rid, m.rDate, rid);
Changes to src/schema.c.
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
;

/*
** Predefined tagid values
*/
#if INTERFACE
# define TAG_BGCOLOR    1     /* Set the background color for display */
# define TAG_BRBGCOLOR  2     /* Background color for branches */
# define TAG_COMMENT    3     /* The check-in comment */
# define TAG_USER       4     /* User who made a checking */
# define TAG_HIDDEN     5     /* Do not display or sync */
# define TAG_PRIVATE    6     /* Display but do not sync */
# define TAG_CLUSTER    7     /* A cluster */
# define TAG_NEWBRANCH  8     /* First check-in of a new named branch */
# define TAG_CLOSED     9     /* Do not display this check-in as a leaf */
#endif
#if EXPORT_INTERFACE
# define MAX_INT_TAG    9     /* The largest pre-assigned tag id */
#endif

/*
** The schema for the locate FOSSIL database file found at the root
** of very check-out.  This database contains the complete state of
** the checkout.
*/







<
|
|
|
|
|
|
|


|







325
326
327
328
329
330
331

332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
;

/*
** Predefined tagid values
*/
#if INTERFACE
# define TAG_BGCOLOR    1     /* Set the background color for display */

# define TAG_COMMENT    2     /* The check-in comment */
# define TAG_USER       3     /* User who made a checking */
# define TAG_HIDDEN     4     /* Do not display or sync */
# define TAG_PRIVATE    5     /* Display but do not sync */
# define TAG_CLUSTER    6     /* A cluster */
# define TAG_NEWBRANCH  7     /* First check-in of a new named branch */
# define TAG_CLOSED     8     /* Do not display this check-in as a leaf */
#endif
#if EXPORT_INTERFACE
# define MAX_INT_TAG    8     /* The largest pre-assigned tag id */
#endif

/*
** The schema for the locate FOSSIL database file found at the root
** of very check-out.  This database contains the complete state of
** the checkout.
*/