diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1054,6 +1054,7 @@ _('set branch name even if it shadows an existing branch')), ('C', 'clean', None, _('reset branch name to parent branch name')), ('r', 'rev', [], _('change branches of the given revs (EXPERIMENTAL)')), + ('s', 'show', None, _('show branch name of the given rev')) ], _('[-fC] [NAME]'), helpcategory=command.CATEGORY_CHANGE_ORGANIZATION) @@ -1097,6 +1098,11 @@ ui.write("%s\n" % repo.dirstate.branch()) return + elif opts.get('show') and label: + ctx = scmutil.revsingle(repo, label) + ui.write("%s\n" % ctx.branch()) + return + with repo.wlock(): if opts.get('clean'): label = repo[None].p1().branch()