localrepo/branchcache: rebuild the "charset-aware" branchcache when needed
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Sat, 31 Oct 2009 00:20:28 +0100
changeset 9673 863ba2ea1f0b
parent 9672 5bbf4f130684
child 9674 603b23c6967b
localrepo/branchcache: rebuild the "charset-aware" branchcache when needed It's simpler and the two cache weren't always in sync otherwise: localrepo.branchcache would not be updated after calling branchmap()
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Fri Oct 30 15:43:01 2009 +0200
+++ b/mercurial/localrepo.py	Sat Oct 31 00:20:28 2009 +0100
@@ -320,10 +320,7 @@
         return partial
 
     def lbranchmap(self):
-        tip = self.changelog.tip()
-        if self.branchcache is not None and self._branchcachetip == tip:
-            return self.branchcache
-
+        self.branchcache = {}
         partial = self.branchmap()
 
         # the branch cache is stored on disk as UTF-8, but in the local
@@ -339,10 +336,6 @@
 
         oldtip = self._branchcachetip
         self._branchcachetip = tip
-        if self.branchcache is None:
-            self.branchcache = {} # avoid recursion in changectx
-        else:
-            self.branchcache.clear() # keep using the same dict
         if oldtip is None or oldtip not in self.changelog.nodemap:
             partial, last, lrev = self._readbranchcache()
         else: