D5475: branch:Added option to show branch name of a given rev (Issue5948)

2018-12-24 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh added a comment.


  In https://phab.mercurial-scm.org/D5475#81071, @yuja wrote:
  
  > >   Thanks for the info @yuja. I'm thinking to move --rev/-r to branches 
command and replacing --show/-s that I've made to --rev/-r in the branch 
command itself.
  >
  > I'm not sure if I get it, but my idea is to add `hg branches -r/--rev`
  >  that selects branches to be listed by revisions. So, `hg branch -srREV` in
  >  your original patch will be equivalent to `hg branches -qrREV` (-q to
  >  suppress detailed output.)
  
  
  I've made the suggested changes in https://phab.mercurial-scm.org/D5477 
@yuja. Please see.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5475

To: navaneeth.suresh, #hg-reviewers
Cc: yuja, pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5475: branch:Added option to show branch name of a given rev (Issue5948)

2018-12-23 Thread yuja (Yuya Nishihara)
yuja added a comment.


  >   Thanks for the info @yuja. I'm thinking to move --rev/-r to branches 
command and replacing --show/-s that I've made to --rev/-r in the branch 
command itself.
  
  I'm not sure if I get it, but my idea is to add `hg branches -r/--rev`
  that selects branches to be listed by revisions. So, `hg branch -srREV` in
  your original patch will be equivalent to `hg branches -qrREV` (-q to
  suppress detailed output.)

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5475

To: navaneeth.suresh, #hg-reviewers
Cc: yuja, pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: D5475: branch:Added option to show branch name of a given rev (Issue5948)

2018-12-23 Thread Yuya Nishihara
>   Thanks for the info @yuja. I'm thinking to move --rev/-r to branches 
> command and replacing --show/-s that I've made to --rev/-r in the branch 
> command itself.

I'm not sure if I get it, but my idea is to add `hg branches -r/--rev`
that selects branches to be listed by revisions. So, `hg branch -srREV` in
your original patch will be equivalent to `hg branches -qrREV` (-q to
suppress detailed output.)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5475: branch:Added option to show branch name of a given rev (Issue5948)

2018-12-23 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh added a comment.


  Thanks for the info @yuja. I'm thinking to move --rev/-r to branches command 
and replacing --show/-s that I've made to --rev/-r in the branch command 
itself. How's that sound to you guys, @pulkit  @yuja ?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5475

To: navaneeth.suresh, #hg-reviewers
Cc: yuja, pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5475: branch:Added option to show branch name of a given rev (Issue5948)

2018-12-23 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  In https://phab.mercurial-scm.org/D5475#81060, @yuja wrote:
  
  > >   _('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`.
  
  
  Yep I do. I don't think it's a good UI. It should either be part of commands 
like metaedit, or should be moved to a change-branch extension for now.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5475

To: navaneeth.suresh, #hg-reviewers
Cc: yuja, pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5475: branch:Added option to show branch name of a given rev (Issue5948)

2018-12-23 Thread yuja (Yuya Nishihara)
yuja added subscribers: pulkit, yuja.
yuja added a comment.


  >   _('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`.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5475

To: navaneeth.suresh, #hg-reviewers
Cc: yuja, pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: D5475: branch:Added option to show branch name of a given rev (Issue5948)

2018-12-23 Thread Yuya Nishihara
>   _('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`.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5475: branch:Added option to show branch name of a given rev (Issue5948)

2018-12-23 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5475

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS

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()



To: navaneeth.suresh, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel