revlog: fix pure nodemap to not access missing index entry
authorYuya Nishihara <yuya@tcha.org>
Fri, 17 Aug 2018 12:54:50 +0900
changeset 39143 65d5de1169dd
parent 39142 13a1901176f1
child 39144 5f924aa0567c
revlog: fix pure nodemap to not access missing index entry This bug was revealed by a3dacabd476b and a1f934573c0b.
mercurial/revlog.py
--- a/mercurial/revlog.py	Fri Aug 17 12:48:44 2018 +0900
+++ b/mercurial/revlog.py	Fri Aug 17 12:54:50 2018 +0900
@@ -1107,7 +1107,9 @@
 
     @util.propertycache
     def nodemap(self):
-        self.rev(self.node(0))
+        if self.index:
+            # populate mapping down to the initial node
+            self.rev(self.node(0))
         return self._nodecache
 
     def hasnode(self, node):