diff mercurial/revlog.py @ 32441:a28c76e1cea9

revlog: raise WdirUnsupported when wdirrev is passed revlog.parentrevs() is called while evaluating ^ operator in revsets. When wdir is passed, it raises IndexError. This patch raises WdirUnsupported if wdir is passed in the function. The error will be caugth in future patches.
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 19 May 2017 19:12:06 +0530
parents d47b62368f3a
children 34e9b8b94f66
line wrap: on
line diff
--- a/mercurial/revlog.py	Fri May 19 19:10:37 2017 +0530
+++ b/mercurial/revlog.py	Fri May 19 19:12:06 2017 +0530
@@ -26,6 +26,7 @@
     hex,
     nullid,
     nullrev,
+    wdirrev,
 )
 from .i18n import _
 from . import (
@@ -481,7 +482,12 @@
         return self.index[rev][4]
 
     def parentrevs(self, rev):
-        return self.index[rev][5:7]
+        try:
+            return self.index[rev][5:7]
+        except IndexError:
+            if rev == wdirrev:
+                raise error.WdirUnsupported
+            raise
 
     def node(self, rev):
         return self.index[rev][7]