revlog: raise error.WdirUnsupported from revlog.node() if wdirrev is passed
authorPulkit Goyal <7895pulkit@gmail.com>
Tue, 23 May 2017 01:30:36 +0530
changeset 32443 34e9b8b94f66
parent 32442 4dd292cec3ad
child 32444 57d6c0c74b1b
revlog: raise error.WdirUnsupported from revlog.node() if wdirrev is passed When we try to run, 'hg debugrevspec 'branch(wdir())'', it throws an index error and blows up. Lets raise the WdirUnsupported if wdir() is passed so that we can catch that later.
mercurial/revlog.py
--- a/mercurial/revlog.py	Tue May 23 01:22:33 2017 +0530
+++ b/mercurial/revlog.py	Tue May 23 01:30:36 2017 +0530
@@ -490,7 +490,12 @@
             raise
 
     def node(self, rev):
-        return self.index[rev][7]
+        try:
+            return self.index[rev][7]
+        except IndexError:
+            if rev == wdirrev:
+                raise error.WdirUnsupported
+            raise
 
     # Derived from index values.