mercurial/revset.py
changeset 25622 85294076adce
parent 25621 21a874693619
child 25630 c88082baf693
--- a/mercurial/revset.py	Wed Jun 17 19:19:57 2015 -0700
+++ b/mercurial/revset.py	Wed Jun 10 19:18:51 2015 -0700
@@ -1464,9 +1464,16 @@
 
 def _phase(repo, subset, target):
     """helper to select all rev in phase <target>"""
-    phase = repo._phasecache.phase
-    condition = lambda r: phase(repo, r) == target
-    return subset.filter(condition, cache=False)
+    repo._phasecache.loadphaserevs(repo) # ensure phase's sets are loaded
+    if repo._phasecache._phasesets:
+        s = repo._phasecache._phasesets[target] - repo.changelog.filteredrevs
+        s = baseset(s)
+        s.sort() # set are non ordered, so we enforce ascending
+        return subset & s
+    else:
+        phase = repo._phasecache.phase
+        condition = lambda r: phase(repo, r) == target
+        return subset.filter(condition, cache=False)
 
 def draft(repo, subset, x):
     """``draft()``