D5475: branch:Added option to show branch name of a given rev (Issue5948)
Yuya Nishihara
yuya at tcha.org
Sun Dec 23 09:01:12 EST 2018
> _('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
How about adding the -r/--rev option to the branches command instead?
I came to this idea while working on the issue4505, tag sorting. I haven't sent
the patch yet because I noticed we would also want to sort tags
lexicographically, which can't be achieved by the revset. But at least, tags,
branches, and bookmarks can be filtered by the -r/--rev option.
https://bz.mercurial-scm.org/show_bug.cgi?id=4505
branch, tag, and bookmark (without -l) are basically the commands to mutate
the repository, and the -r option of the branch command is highly experimental.
IIRC, @pulkit regrets of adding `branch -r`.
More information about the Mercurial-devel
mailing list