[PATCH 04 of 10] bundlerepo: use _cachabletip mechanism in bundlerepo

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Wed Dec 19 07:53:20 CST 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1355924510 -3600
# Node ID 64f6c124bb6554988020edb9809ba691f8cf9b08
# Parent  bf7e57987ee82b00ec22f8131ddbbe97b188cbcd
bundlerepo: use _cachabletip mechanism in bundlerepo

Instead of preventing any cache write we allow writing cache for all content of
the original repo.

The motivation for this change is to drop the custom _writebranchcache of
bundlerepo to help extraction of the branchmap logic out of localrepo.

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -30,10 +30,11 @@ class bundlerevlog(revlog.revlog):
         #
         revlog.revlog.__init__(self, opener, indexfile)
         self.bundle = bundle
         self.basemap = {}
         n = len(self)
+        self.disktiprev = n - 1
         chain = None
         self.bundlenodes = []
         while True:
             chunkdata = bundle.deltachunk(chain)
             if not chunkdata:
@@ -282,13 +283,15 @@ class bundlerepository(localrepo.localre
         return bundlepeer(self)
 
     def getcwd(self):
         return os.getcwd() # always outside the repo
 
-    def _writebranchcache(self, branches, tip, tiprev):
-        # don't overwrite the disk cache with bundle-augmented data
-        pass
+    def _cachabletip(self):
+        # we should not cache data from the bundle on disk
+        ret = super(bundlerepository, self)._cachabletip()
+        return min(self.changelog.disktiprev, ret)
+
 
 def instance(ui, path, create):
     if create:
         raise util.Abort(_('cannot create new bundle repository'))
     parentpath = ui.config("bundle", "mainreporoot", "")


More information about the Mercurial-devel mailing list