mercurial/revset.py
changeset 41274 4c6fdc7e2e7d
parent 41222 8aca89a694d4
child 41276 5affe1583e1d
--- a/mercurial/revset.py	Sun Jan 13 22:24:11 2019 +0100
+++ b/mercurial/revset.py	Mon Jan 14 16:53:55 2019 +0100
@@ -1168,9 +1168,18 @@
     # argument set should never define order
     if order == defineorder:
         order = followorder
-    s = getset(repo, subset, x, order=order)
-    ps = parents(repo, subset, x)
-    return s - ps
+    inputset = getset(repo, fullreposet(repo), x, order=order)
+    ps = set()
+    cl = repo.changelog
+    up = ps.update
+    parentrevs = cl.parentrevs
+    for r in inputset:
+        try:
+            up(parentrevs(r))
+        except error.WdirUnsupported:
+            up(p.rev() for p in repo[r].parents())
+    ps.discard(node.nullrev)
+    return subset & (inputset - ps)
 
 @predicate('hidden()', safe=True)
 def hidden(repo, subset, x):