[PATCH 2 of 3 V2] phase: default to current revision if no rev is provided (issue4666)

Yuya Nishihara yuya at tcha.org
Fri May 15 20:18:36 CDT 2015


On Fri, 15 May 2015 19:57:05 +0200, Gilles Moris wrote:
> Le 15/05/2015 14:44, Yuya Nishihara a écrit :
> > On Fri, 15 May 2015 11:09:25 +0200, Gilles Moris wrote:
> >> # HG changeset patch
> >> # User Gilles Moris <gilles.moris at free.fr>
> >> # Date 1431675981 -7200
> >> #      Fri May 15 09:46:21 2015 +0200
> >> # Node ID 506ec227e18df2feb51070a50d4f0cb200f0b227
> >> # Parent  b51d7e3407dd0be0807c887c9b6fb82bebf57bf6
> >> phase: default to current revision if no rev is provided (issue4666)
> >>
> >> diff -r b51d7e3407dd -r 506ec227e18d mercurial/commands.py
> >> --- a/mercurial/commands.py	Thu May 14 17:38:38 2015 +0200
> >> +++ b/mercurial/commands.py	Fri May 15 09:46:21 2015 +0200
> >> @@ -4950,11 +4950,11 @@
> >>        ('f', 'force', False, _('allow to move boundary backward')),
> >>        ('r', 'rev', [], _('target revision'), _('REV')),
> >>       ],
> >> -    _('[-p|-d|-s] [-f] [-r] REV...'))
> >> +    _('[-p|-d|-s] [-f] [-r] [REV...]'))
> >>   def phase(ui, repo, *revs, **opts):
> >>       """set or show the current phase name
> >>   
> >> -    With no argument, show the phase name of specified revisions.
> >> +    With no argument, show the phase name of current revision.
> >>   
> >>       With one of -p/--public, -d/--draft or -s/--secret, change the
> >>       phase value of the specified revisions.
> >> @@ -4979,7 +4979,7 @@
> >>       revs = list(revs)
> >>       revs.extend(opts['rev'])
> >>       if not revs:
> >> -        raise util.Abort(_('no revisions specified'))
> >> +        revs = [c.rev() for c in repo[None].parents()]
> > I think it should show only p1 (i.e. revs = ['.'] like other commands.
> 
> Yes, I have been quite hesitating on this one, but if the second parent
> has a higher phase, it will preempt the first parent phase.
> That's why I choose to display both.

Aha, I got it, thanks. Maybe it can have one line comment why we want to
show both parents.


More information about the Mercurial-devel mailing list