diff mercurial/revlog.py @ 32443:34e9b8b94f66

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.
author Pulkit Goyal <7895pulkit@gmail.com>
date Tue, 23 May 2017 01:30:36 +0530
parents a28c76e1cea9
children 7b17f9de6d3e
line wrap: on
line diff
--- 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.