[PATCH 2 of 4] phases: avoid changectx creation while checking command result
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Tue Jan 1 19:35:58 CST 2013
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1356346668 -3600
# Node ID 582c14e67f556532de2822fd3850e697406b1b6e
# Parent b8f90b582ea1dd0e3d4a456cea824add48fb8b13
phases: avoid changectx creation while checking command result
This minor changesets saves the creation of a `changectx` ctx object only used to
fetch the revision number.
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4628,13 +4628,14 @@ def phase(ui, repo, *revs, **opts):
if opts['force']:
phases.retractboundary(repo, targetphase, nodes)
finally:
lock.release()
newdata = repo._phasecache.getphaserevs(repo)
+ cl = repo.changelog
changes = sum(o != newdata[i] for i, o in enumerate(olddata))
rejected = [n for n in nodes
- if newdata[repo[n].rev()] < targetphase]
+ if newdata[cl.rev(n)] < targetphase]
if rejected:
ui.warn(_('cannot move %i changesets to a more permissive '
'phase, use --force\n') % len(rejected))
ret = 1
if changes:
More information about the Mercurial-devel
mailing list