changeset 32481: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 4dd292cec3ad
children 57d6c0c74b1b
files mercurial/revlog.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
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.