[PATCH 05 of 14 clfilter part 1 V2] clfilter: ensure `branchcache` logic run unfiltered

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Mon Nov 26 12:34:38 CST 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1353954344 -3600
# Node ID 9fccc74aab7bfcd9b5a2394e6f0bc794c7a720c8
# Parent  215b42e05200ff83478dc0badd4742023f0755a4
clfilter: ensure `branchcache` logic run unfiltered

The current branchcache construction if not aware of filtering. We keep the
satus-co, ensuring that the branch cache logic is computed as before: Without
any filtering.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -611,10 +611,11 @@ class localrepository(object):
             self._updatebranchcache(partial, ctxgen)
             self._writebranchcache(partial, self.changelog.tip(), tiprev)
 
         return partial
 
+    @unfilteredmeth # Until we get a smarter cache management
     def updatebranchcache(self):
         tip = self.changelog.tip()
         if self._branchcache is not None and self._branchcachetip == tip:
             return
 
@@ -663,10 +664,11 @@ class localrepository(object):
         bt = {}
         for bn, heads in self.branchmap().iteritems():
             bt[bn] = self._branchtip(heads)
         return bt
 
+    @unfilteredmeth # Until we get a smarter cache management
     def _readbranchcache(self):
         partial = {}
         try:
             f = self.opener("cache/branchheads")
             lines = f.read().split('\n')
@@ -695,10 +697,11 @@ class localrepository(object):
             if self.ui.debugflag:
                 self.ui.warn(str(inst), '\n')
             partial, last, lrev = {}, nullid, nullrev
         return partial, last, lrev
 
+    @unfilteredmeth # Until we get a smarter cache management
     def _writebranchcache(self, branches, tip, tiprev):
         try:
             f = self.opener("cache/branchheads", "w", atomictemp=True)
             f.write("%s %s\n" % (hex(tip), tiprev))
             for label, nodes in branches.iteritems():
@@ -706,10 +709,11 @@ class localrepository(object):
                     f.write("%s %s\n" % (hex(node), encoding.fromlocal(label)))
             f.close()
         except (IOError, OSError):
             pass
 
+    @unfilteredmeth # Until we get a smarter cache management
     def _updatebranchcache(self, partial, ctxgen):
         """Given a branchhead cache, partial, that may have extra nodes or be
         missing heads, and a generator of nodes that are at least a superset of
         heads missing, this function updates partial to be correct.
         """
@@ -1049,12 +1053,12 @@ class localrepository(object):
             except AttributeError:
                 pass
 
         delcache('_tagscache')
 
-        self._branchcache = None # in UTF-8
-        self._branchcachetip = None
+        self.unfiltered()._branchcache = None # in UTF-8
+        self.unfiltered()._branchcachetip = None
         obsolete.clearobscaches(self)
 
     def invalidatedirstate(self):
         '''Invalidates the dirstate, causing the next call to dirstate
         to check if it was modified since the last time it was read,


More information about the Mercurial-devel mailing list