[PATCH] branch: avoid using reserved tag names

Benoit Boissinot bboissin at gmail.com
Wed Feb 10 14:40:16 UTC 2010


On Wed, Feb 10, 2010 at 3:37 PM, Wagner Bruna
<wagner.bruna+mercurial at gmail.com> wrote:
> # HG changeset patch
> # User Wagner Bruna <wbruna at softwareexpress.com.br>
> # Date 1265812365 7200
> # Branch stable
> # Node ID 41f5ce0c74a5479735aaf594d19b764304add709
> # Parent  b8801b58bbd8fe42571e52c0ba8646bb59077efb
> branch: avoid using reserved tag names

Sorry, you resubmited too quickly.

>
> Reported as Debian bug #552423.
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -426,6 +426,8 @@
>         repo.dirstate.setbranch(label)
>         ui.status(_('reset working directory to branch %s\n') % label)
>     elif label:
> +        if label in ['tip', '.', 'null']:
> +            raise util.Abort(_('the name \'%s\' is reserved') % label)

This should actually go in dirstate.setbranch()

>         utflabel = encoding.fromlocal(label)
>         if not opts.get('force') and utflabel in repo.branchtags():
>             if label not in [p.branch() for p in repo.parents()]:

You'll need a check in changelog.add() too (for people who don't use
the working dir).

thanks,

Benoit



More information about the Mercurial-devel mailing list