"hg branches"

Brendan Cully brendan at kublai.com
Mon Jun 11 20:21:30 CDT 2007


On Saturday, 09 June 2007 at 12:14, Matt Mackall wrote:
> On Sat, Jun 09, 2007 at 09:11:30AM -0700, Brendan Cully wrote:
> > On Saturday, 09 June 2007 at 00:08, Daniel Holth wrote:
> > > -----BEGIN PGP SIGNED MESSAGE-----
> > > Hash: SHA1
> > > 
> > > The current Mercurial "hg branches" feature, imo, is a horrible
> > > misfeature the proper use of which was never understood by anyone at
> > > all. That is because the feature as implemented is properly left unused.
> > > 
> > > Once you have the misfortune to try to use the current "hg branches"
> > > feature, which is a way of giving a special kind of tag to individual
> > > revisions, you find it is completely unintuitive. For starters, "hg
> > > branch x" does not create a branch, "hg update -r branch-name" is
> > 
> > hg branch might want a flag to create the branch immediately via empty
> > commit, I guess.
> 
> Or perhaps a reminder message, like hg pull has:
> 
>  New branch 'foo' created, don't forget to commit.
> 
> That seems quite reasonable.

will this do?

-------------- next part --------------
# HG changeset patch
# User Brendan Cully <brendan at kublai.com>
# Date 1181611200 25200
# Node ID 00c77b7c81d04d1b52d3c6bb582922431ed430cd
# Parent  133a52d70958824380aa31985402de5e66b976d4
Notify the user that hg branch does not create a branch until commit

diff -r 133a52d70958 -r 00c77b7c81d0 mercurial/commands.py
--- a/mercurial/commands.py	Mon Jun 11 12:14:31 2007 -0700
+++ b/mercurial/commands.py	Mon Jun 11 18:20:00 2007 -0700
@@ -256,7 +256,9 @@ def branch(ui, repo, label=None, **opts)
     """set or show the current branch name
 
     With <name>, set the current branch name. Otherwise, show the
-    current branch name.
+    current branch name. The branch name is applied to the working
+    directory, but does not exist in the repository until the next
+    commit.
 
     Unless --force is specified, branch will not let you set a
     branch name that shadows an existing branch.
@@ -268,6 +270,7 @@ def branch(ui, repo, label=None, **opts)
                 raise util.Abort(_('a branch of the same name already exists'
                                    ' (use --force to override)'))
         repo.dirstate.setbranch(util.fromlocal(label))
+        ui.status('the next commit will be on branch %s\n' % label)
     else:
         ui.write("%s\n" % util.tolocal(repo.dirstate.branch()))
 


More information about the Mercurial-devel mailing list