# HG changeset patch # User Matt Mackall # Date 1161155313 18000 # Node ID e6045fc3cd50c15e4013f7bc353d3e5f60d6cfb6 # Parent 798bcde0c9c272b83b297cbb183afb3fba43aca2 Improve branch cache sanity check for mq diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -299,7 +299,8 @@ class localrepository(repo.repository): f = self.opener("branches.cache") last, lrev = f.readline().rstrip().split(" ", 1) last, lrev = bin(last), int(lrev) - if self.changelog.node(lrev) == last: # sanity check + if (lrev < self.changelog.count() and + self.changelog.node(lrev) == last): # sanity check for l in f: node, label = l.rstrip().split(" ", 1) self.branchcache[label] = bin(node)