changeset 6120:f89878df40fe

move the reading of branch.cache from _branchtags to branchtags
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 15 Feb 2008 16:06:36 -0200
parents b8919d401313
children 7336aeff1a1d
files hgext/mq.py mercurial/localrepo.py
diffstat 2 files changed, 6 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Fri Feb 15 16:06:36 2008 -0200
+++ b/hgext/mq.py	Fri Feb 15 16:06:36 2008 -0200
@@ -2186,20 +2186,17 @@
 
             return tagscache
 
-        def _branchtags(self):
+        def _branchtags(self, partial, lrev):
             q = self.mq
             if not q.applied:
-                return super(mqrepo, self)._branchtags()
+                return super(mqrepo, self)._branchtags(partial, lrev)
 
             cl = self.changelog
             qbasenode = revlog.bin(q.applied[0].rev)
             if qbasenode not in cl.nodemap:
                 self.ui.warn('mq status file refers to unknown node %s\n'
                              % revlog.short(qbasenode))
-                return super(mqrepo, self)._branchtags()
-
-            self.branchcache = {} # avoid recursion in changectx
-            partial, last, lrev = self._readbranchcache()
+                return super(mqrepo, self)._branchtags(partial, lrev)
 
             qbase = cl.rev(qbasenode)
             start = lrev + 1
--- a/mercurial/localrepo.py	Fri Feb 15 16:06:36 2008 -0200
+++ b/mercurial/localrepo.py	Fri Feb 15 16:06:36 2008 -0200
@@ -345,9 +345,7 @@
                 self.nodetagscache.setdefault(n, []).append(t)
         return self.nodetagscache.get(node, [])
 
-    def _branchtags(self):
-        partial, last, lrev = self._readbranchcache()
-
+    def _branchtags(self, partial, lrev):
         tiprev = self.changelog.count() - 1
         if lrev != tiprev:
             self._updatebranchcache(partial, lrev+1, tiprev+1)
@@ -360,7 +358,8 @@
             return self.branchcache
 
         self.branchcache = {} # avoid recursion in changectx
-        partial = self._branchtags()
+        partial, last, lrev = self._readbranchcache()
+        self._branchtags(partial, lrev)
 
         # the branch cache is stored on disk as UTF-8, but in the local
         # charset internally