diff --git a/mercurial/revset.py b/mercurial/revset.py
index e1aa1ed30030d240ed7567e22f30073f346de5f3_bWVyY3VyaWFsL3JldnNldC5weQ==..76bcd3eac67e3b1628a463926b59809be4daa424_bWVyY3VyaWFsL3JldnNldC5weQ== 100644
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -192,9 +192,15 @@
     return [x for x in r if x in s]
 
 def dagrange(repo, subset, x, y):
-    return andset(repo, subset,
-                  ('func', ('symbol', 'descendants'), x),
-                  ('func', ('symbol', 'ancestors'), y))
+    if subset:
+        r = range(len(repo))
+        m = getset(repo, r, x)
+        n = getset(repo, r, y)
+        cl = repo.changelog
+        xs = map(cl.rev, cl.nodesbetween(map(cl.node, m), map(cl.node, n))[0])
+        s = set(subset)
+        return [r for r in xs if r in s]
+    return []
 
 def andset(repo, subset, x, y):
     return getset(repo, getset(repo, subset, x), y)