Branch and tag name conflict

Sune Foldager cryo at cyanite.org
Fri Apr 16 02:35:48 CDT 2010


On 16-04-2010 01:36, wbyoung at fadingred.com wrote:
> Today I ran into an issue with Mercurial.  I created a tag that used a
> name that was already taken by a branch.  There were no errors in
> doing so or in committing.  I ran into problems when trying to merge
> that branch into the default branch (I assume because it was trying to
> merge from the tag).

Yes, in the lookup-chain, tags come before branches, so any tag will
trump a branch with the same name.

> I've recovered from the problem by renaming the branch, but I think it
> would be nice if Mercurial had stopped me from creating the tag since
> the name was already taken by a branch.

You may have a point there; I wonder if the current behavior is
intentional or just a result of features being added through many
iterations.

> Is this an issue that anyone else has experienced?  Is there a way to
> refer to a branch in the 'hg merge' command that differentiates it
> from a tag?  Would name conflicts also be an issue with local
> branches?

You can always refer to the changeset directly, using its revision
number or hash. Otherwise, there is no way. For some commands, like pull
and push, there is a --branch (-b) option which always prefers branches.

/Sune


More information about the Mercurial mailing list