Bug 5948 - Add -r argument to hg branch
Summary: Add -r argument to hg branch
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: 4.6rc0
Hardware: PC Mac OS
: wish feature
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-30 11:28 UTC by joshgold
Modified: 2019-01-15 00:00 UTC (History)
4 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description joshgold 2018-07-30 11:28 UTC
Please add a -r argument to hg branch for showing the branch of a revision besides the current revision.

This would be easier than the alternatives below and I suspect it would be would be a simple addition.  I think hg branch is also a natural place to look for the functionality of checking the branch of a changeset.

The current alternatives I can think of:

1. hg log -r rev --template '{branch}\n'

2. (or if the working directory is clean) 
hg log -r . 
(copy the revision hash)
hg up rev
hg branch
hg up oldrev
Comment 1 Navaneeth Suresh 2018-12-22 05:54 UTC
This is a good idea. I would like to take this up. But, there exists an experimental option `r` which changes the branch of the changesets.
Comment 2 Navaneeth Suresh 2018-12-23 05:34 UTC
I've done it via `-s` option here https://phab.mercurial-scm.org/D5475. Please see
Comment 3 Boris Feld 2018-12-23 06:54 UTC
The two does not conflicts:

hg branch --rev X branchname → update the branch on the changeset
hg branch --rev X → display the name on the changeset
Comment 4 joshgold 2018-12-23 12:53 UTC
I'd want to suggest we not use -s here — to keep consistency with other commands that select a revision with -r / --rev.

(And I do agree with Boris that this dovetails with changing the branch of the changeset -- in both cases, you're selecting a revision, whether that's to display or make a change.)
Comment 5 Navaneeth Suresh 2018-12-24 06:40 UTC
As suggested by @yuja, I added the `-r` option in the branches command. See https://phab.mercurial-scm.org/D5477.
Comment 6 HG Bot 2019-01-07 18:38 UTC
Fixed by https://mercurial-scm.org/repo/hg/rev/4506f801e492
Navaneeth Suresh <navaneeths1998@gmail.com>
branches: add -r option to show branch name(s) of a given rev (issue5948)

Differential Revision: https://phab.mercurial-scm.org/D5486

(please test the fix)
Comment 7 Bugzilla 2019-01-15 00:00 UTC
Bug was set to TESTING for 7 days, resolving