[PATCH 2 of 3] revlog: fix pure nodemap to not access missing index entry

Yuya Nishihara yuya at tcha.org
Fri Aug 17 00:41:44 EDT 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1534478090 -32400
#      Fri Aug 17 12:54:50 2018 +0900
# Node ID a492553fb5277889521c5400d59b51fe238dc4d8
# Parent  0a01692d0560e11e15b8d9c25d944684cc9cab72
revlog: fix pure nodemap to not access missing index entry

This bug was revealed by a3dacabd476b and a1f934573c0b.

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1107,7 +1107,9 @@ class revlog(object):
 
     @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):


More information about the Mercurial-devel mailing list