# HG changeset patch # User Steve Borho # Date 2010-02-05 10:33:08 # Node ID be324d31b6c5a3df315ae596c4da136b4122b739 # Parent 7c5eb0988e7a9d4fb3f95aef9d6561ff488c170d commands: label from user is in local encoding repo.branchtags().keys() are in UTF-8, so the label should be converted to UTF-8 before checking for a naming conflict. Keep the original label for ui.status() diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -426,11 +426,12 @@ def branch(ui, repo, label=None, **opts) repo.dirstate.setbranch(label) ui.status(_('reset working directory to branch %s\n') % label) elif label: - if not opts.get('force') and label in repo.branchtags(): + 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()]: raise util.Abort(_('a branch of the same name already exists' ' (use --force to override)')) - repo.dirstate.setbranch(encoding.fromlocal(label)) + repo.dirstate.setbranch(utflabel) ui.status(_('marked working directory as branch %s\n') % label) else: ui.write("%s\n" % encoding.tolocal(repo.dirstate.branch()))