SV: spurious error with hg branch foo; hg up
benoit.boissinot at ens-lyon.org
Fri Sep 18 02:14:55 CDT 2009
On Fri, Sep 18, 2009 at 08:54:04AM +0200, Sune Foldager wrote:
> > Hi,
> > $ hg init ex; cd ex; hg branch foo; hg up;
> > gives
> > abort: branch foo not found
> > This message misleadingly appears to be an error, because hg is trying to
> > update to the tip of a branch that does not exist yet. In this case it
> > really needs to go nowhere, since it is already at the tip. I think no
> > message is really needed here, or at any rate a less alarming one. There
> > are probably other similar cases, but I've not thought through all the
> > possibilities. Thanks to Benoit Boissinot for discussing this on IRC.
> I agree it needs to go nowhere (as it already does), but not because we're at
> the tip necessarily.
It is necessarily the tip of the branch (not of the repo).
> We may want to create the named branch off some other node
> in the past history, after all. I don't see the alarming in the message 'branch
> not found', when, as you say yourself, update to a branch which does not exist
> yet and hence is not found.
It somehow exists in the working copy.
> I guess it could be special cased for the current dirstate branch to say
> something else, but I am not sure what :-)
The message Faheem is seeing is already for this exact case: hg up on a
the dirstate branch.
See merge.py for details.
And actually the exact behaviour and this error message is tested in
test-newbranch (it was explicitely added in 83153299aab5).
More information about the Mercurial-devel