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

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 17, 2018, 4:41 a.m.
Message ID <a492553fb5277889521c.1534480904@mimosa>
Download mbox | patch
Permalink /patch/33814/
State Accepted
Headers show

Comments

Yuya Nishihara - Aug. 17, 2018, 4:41 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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.

Patch

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):