branchmap: merge _branchtags into updatebranchcache
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Thu, 20 Dec 2012 13:23:29 +0100
changeset 18114 35ce17796e0e
parent 18113 da1714bd0250
child 18115 6db318a15a12
branchmap: merge _branchtags into updatebranchcache Now that nobody overwrite it, there is no reasons for `_branchtags` to remains separated from `updatebranchcache`.
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Wed Dec 19 17:39:49 2012 +0100
+++ b/mercurial/localrepo.py	Thu Dec 20 13:23:29 2012 +0100
@@ -661,9 +661,20 @@
         cl = self.changelog
         return cl.rev(cl.tip())
 
-    def _branchtags(self, partial, lrev):
-        # TODO: rename this function?
+    @unfilteredmethod # Until we get a smarter cache management
+    def updatebranchcache(self):
         cl = self.changelog
+        tip = cl.tip()
+        if self._branchcache is not None and self._branchcachetip == tip:
+            return
+
+        oldtip = self._branchcachetip
+        if oldtip is None or oldtip not in cl.nodemap:
+            partial, last, lrev = self._readbranchcache()
+        else:
+            lrev = cl.rev(oldtip)
+            partial = self._branchcache
+
         catip = self._cacheabletip()
         # if lrev == catip: cache is already up to date
         # if lrev >  catip: we have uncachable element in `partial` can't write
@@ -680,26 +691,8 @@
         if lrev < tiprev:
             ctxgen = (self[r] for r in cl.revs(lrev + 1, tiprev))
             self._updatebranchcache(partial, ctxgen)
-        return partial
-
-    @unfilteredmethod # Until we get a smarter cache management
-    def updatebranchcache(self):
-        cl = self.changelog
-        tip = cl.tip()
-        if self._branchcache is not None and self._branchcachetip == tip:
-            return
-
-        oldtip = self._branchcachetip
+        self._branchcache = partial
         self._branchcachetip = tip
-        if oldtip is None or oldtip not in cl.nodemap:
-            partial, last, lrev = self._readbranchcache()
-        else:
-            lrev = cl.rev(oldtip)
-            partial = self._branchcache
-
-        self._branchtags(partial, lrev)
-        # this private cache holds all heads (not just the branch tips)
-        self._branchcache = partial
 
     def branchmap(self):
         '''returns a dictionary {branch: [branchheads]}'''