changeset 39177:65d5de1169dd

revlog: fix pure nodemap to not access missing index entry This bug was revealed by a3dacabd476b and a1f934573c0b.
author Yuya Nishihara <yuya@tcha.org>
date Fri, 17 Aug 2018 12:54:50 +0900
parents 13a1901176f1
children 5f924aa0567c
files mercurial/revlog.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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):