phase: default to current revision if no rev is provided (
issue4666)
--- a/mercurial/commands.py Sun Apr 12 23:51:06 2015 -0700
+++ b/mercurial/commands.py Fri May 15 09:46:21 2015 +0200
@@ -4952,11 +4952,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 the current revision(s).
With one of -p/--public, -d/--draft or -s/--secret, change the
phase value of the specified revisions.
@@ -4981,7 +4981,9 @@
revs = list(revs)
revs.extend(opts['rev'])
if not revs:
- raise util.Abort(_('no revisions specified'))
+ # display both parents as the second parent phase can influence
+ # the phase of a merge commit
+ revs = [c.rev() for c in repo[None].parents()]
revs = scmutil.revrange(repo, revs)
--- a/tests/test-phases.t Sun Apr 12 23:51:06 2015 -0700
+++ b/tests/test-phases.t Fri May 15 09:46:21 2015 +0200
@@ -36,6 +36,8 @@
Draft commit are properly created over public one:
$ hg phase --public .
+ $ hg phase
+ 1: public
$ hglog
1 0 B
0 0 A
@@ -86,6 +88,9 @@
$ hg merge 4 # E
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
+ $ hg phase
+ 6: draft
+ 4: secret
$ hg ci -m "merge B' and E"
$ hglog
7 2 merge B' and E