[PATCH phases] phases: ``hg phase`` command informs of phase movement
pierre-yves.david at logilab.fr
pierre-yves.david at logilab.fr
Tue Jan 17 16:08:26 UTC 2012
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1326773541 -3600
# Node ID b960e14d42513391989cd0f5010f8334613f5466
# Parent 476a981fdf341f5bedbd958ca6c8e930fe35b5f9
phases: ``hg phase`` command informs of phase movement
When used in "set" mode, the phase command now display the number of changeset
who changed phase.
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4262,15 +4262,25 @@ def phase(ui, repo, *revs, **opts):
try:
# set phase
nodes = [ctx.node() for ctx in repo.set('%lr', revs)]
if not nodes:
raise util.Abort(_('empty revision set'))
+ olddata = repo._phaserev[:]
phases.advanceboundary(repo, targetphase, nodes)
if opts['force']:
phases.retractboundary(repo, targetphase, nodes)
finally:
lock.release()
+ if olddata is not None:
+ changes = 0
+ newdata = repo._phaserev
+ changes = sum(o != newdata[i] for i, o in enumerate(olddata))
+ if changes:
+ ui.status(_('phase change for %i changesets\n') % changes)
+ else:
+ ui.status(_('No phase movement\n'))
+ return 0
def postincoming(ui, repo, modheads, optupdate, checkout):
if modheads == 0:
return
if optupdate:
diff --git a/tests/test-phases-exchange.t b/tests/test-phases-exchange.t
--- a/tests/test-phases-exchange.t
+++ b/tests/test-phases-exchange.t
@@ -796,10 +796,11 @@ Discovery locally secret changeset on a
pushing a locally public and draft changesets remotly secret should make them appear on the remote side
$ hg -R ../mu phase --secret --force 967b449fbc94
+ phase change for 2 changesets
$ hg push -r 435b5d83910c ../mu
pushing to ../mu
searching for changes
adding changesets
adding manifests
@@ -841,10 +842,11 @@ pull new changeset with common draft loc
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
$ cd ../mu
$ hg phase --secret --force 1c5cfd894796
+ phase change for 1 changesets
$ hg up -q 435b5d83910c
$ mkcommit 'mu-more'
$ cd ../alpha
$ hg pull ../mu
pulling from ../mu
@@ -894,11 +896,13 @@ Test that test are properly ignored on r
# * secret remotely
# * known locally
# * repo have uncommon changeset
$ hg -R beta phase --secret --force f54f1bb90ff3
+ phase change for 1 changesets
$ hg -R gamma phase --draft --force f54f1bb90ff3
+ phase change for 1 changesets
$ cd gamma
$ hg pull ../beta
pulling from ../beta
searching for changes
@@ -947,10 +951,11 @@ 1. cloning non-publishing repository
(Phase should be preserved)
# make sure there is no secret so we can use a copy clone
$ hg -R mu phase --draft 'secret()'
+ phase change for 1 changesets
$ hg clone -U mu Tau
$ hgph -R Tau
o 12 draft mu-more - 5237fb433fc8
|
diff --git a/tests/test-phases.t b/tests/test-phases.t
--- a/tests/test-phases.t
+++ b/tests/test-phases.t
@@ -25,10 +25,11 @@ Following commit are draft too
0 1 A
Draft commit are properly created over public one:
$ hg phase --public .
+ phase change for 2 changesets
$ hglog
1 0 B
0 0 A
$ mkcommit C
@@ -232,10 +233,11 @@ display changesets phase
move changeset forward
(with -r option)
$ hg phase --public -r 2
+ phase change for 1 changesets
$ hg log -G --template "{rev} {phase} {desc}\n"
@ 7 secret merge B' and E
|\
| o 6 draft B'
| |
@@ -255,10 +257,11 @@ move changeset forward
move changeset backward
(without -r option)
$ hg phase --draft --force 2
+ phase change for 1 changesets
$ hg log -G --template "{rev} {phase} {desc}\n"
@ 7 secret merge B' and E
|\
| o 6 draft B'
| |
@@ -276,10 +279,11 @@ move changeset backward
move changeset forward and backward
$ hg phase --draft --force 1::4
+ phase change for 2 changesets
$ hg log -G --template "{rev} {phase} {desc}\n"
@ 7 secret merge B' and E
|\
| o 6 draft B'
| |
More information about the Mercurial-devel
mailing list