Improve branch cache sanity check for mq
authorMatt Mackall <mpm@selenic.com>
Wed, 18 Oct 2006 02:08:33 -0500
changeset 3443 e6045fc3cd50
parent 3442 798bcde0c9c2
child 3444 3505fcd5a231
Improve branch cache sanity check for mq
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Tue Oct 17 22:59:01 2006 -0500
+++ b/mercurial/localrepo.py	Wed Oct 18 02:08:33 2006 -0500
@@ -299,7 +299,8 @@
             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)