diff mercurial/revset.py @ 32480:4dd292cec3ad

revset: add support for ancestors(wdir()) This is a part of extending support for wdir() predicate.
author Pulkit Goyal <7895pulkit@gmail.com>
date Tue, 23 May 2017 01:22:33 +0530
parents 018f638ad88e
children a3064fe3e495
line wrap: on
line diff
--- a/mercurial/revset.py	Tue May 23 01:08:19 2017 +0530
+++ b/mercurial/revset.py	Tue May 23 01:22:33 2017 +0530
@@ -75,9 +75,14 @@
             if current not in seen:
                 seen.add(current)
                 yield current
-                for parent in cl.parentrevs(current)[:cut]:
-                    if parent != node.nullrev:
-                        heapq.heappush(h, -parent)
+                try:
+                    for parent in cl.parentrevs(current)[:cut]:
+                        if parent != node.nullrev:
+                            heapq.heappush(h, -parent)
+                except error.WdirUnsupported:
+                    for parent in repo[current].parents()[:cut]:
+                        if parent.rev() != node.nullrev:
+                            heapq.heappush(h, -parent.rev())
 
     return generatorset(iterate(), iterasc=False)