mercurial/commands.py
changeset 22892 40f46fd7c50e
parent 22837 2be7d5ebd4d0
child 22899 67cb1ab1ad1d
--- a/mercurial/commands.py	Fri Oct 10 13:09:22 2014 -0700
+++ b/mercurial/commands.py	Sun Oct 12 23:30:04 2014 -0700
@@ -4855,7 +4855,11 @@
             if not revs:
                 raise util.Abort(_('empty revision set'))
             nodes = [repo[r].node() for r in revs]
-            olddata = repo._phasecache.getphaserevs(repo)[:]
+            # moving revision from public to draft may hide them
+            # We have to check result on an unfiltered repository
+            unfi = repo.unfiltered()
+            getphase = unfi._phasecache.phase
+            olddata = [getphase(unfi, r) for r in unfi]
             phases.advanceboundary(repo, tr, targetphase, nodes)
             if opts['force']:
                 phases.retractboundary(repo, tr, targetphase, nodes)
@@ -4864,11 +4868,9 @@
             if tr is not None:
                 tr.release()
             lock.release()
-        # moving revision from public to draft may hide them
-        # We have to check result on an unfiltered repository
-        unfi = repo.unfiltered()
-        newdata = repo._phasecache.getphaserevs(unfi)
-        changes = sum(o != newdata[i] for i, o in enumerate(olddata))
+        getphase = unfi._phasecache.phase
+        newdata = [getphase(unfi, r) for r in unfi]
+        changes = sum(newdata[r] != olddata[r] for r in unfi)
         cl = unfi.changelog
         rejected = [n for n in nodes
                     if newdata[cl.rev(n)] < targetphase]