phases: avoid changectx creation while checking command result
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Mon, 24 Dec 2012 11:57:48 +0100
changeset 18209 6a91cbb67907
parent 18208 f0059ba239cb
child 18210 f730ed2e093d
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.
mercurial/commands.py
--- a/mercurial/commands.py	Tue Dec 04 15:25:22 2012 +0100
+++ b/mercurial/commands.py	Mon Dec 24 11:57:48 2012 +0100
@@ -4630,9 +4630,10 @@
         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))