[PATCH V3] phase: default to current revision if no rev is provided (issue4666)
Gilles Moris
gilles.moris at free.fr
Sat May 16 10:25:59 UTC 2015
# HG changeset patch
# User Gilles Moris <gilles.moris at free.fr>
# Date 1431675981 -7200
# Fri May 15 09:46:21 2015 +0200
# Node ID a12ab138375b32905664724f8403c72097a58c9a
# Parent 1ef96a3b8b89a896f2c9f3f977dbef8f45bb0e26
phase: default to current revision if no rev is provided (issue4666)
diff -r 1ef96a3b8b89 -r a12ab138375b 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
@@ -4949,11 +4949,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(s).
With one of -p/--public, -d/--draft or -s/--secret, change the
phase value of the specified revisions.
@@ -4978,7 +4978,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)
diff -r 1ef96a3b8b89 -r a12ab138375b tests/test-phases.t
--- a/tests/test-phases.t Thu May 14 17:38:38 2015 +0200
+++ 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
More information about the Mercurial-devel
mailing list