[MERGE][#294479] Make InterPackRepo set the packer cache size even when there is stacking.

Andrew Bennetts andrew.bennetts at canonical.com
Thu Nov 13 04:37:17 GMT 2008


Andrew Bennetts wrote:
> This is a bit ugly, but it's the least intrusive fix I could see.  It would
> be nice if stacked pack repositories didn't hit a completely different (and
> apparently buggier and slower) code path than non-stacked pack repositories.

So, here's a different fix for this case:

=== modified file 'bzrlib/repository.py'
--- bzrlib/repository.py	2008-11-12 23:18:47 +0000
+++ bzrlib/repository.py	2008-11-13 01:33:51 +0000
@@ -2809,14 +2809,13 @@
     @needs_write_lock
     def fetch(self, revision_id=None, pb=None, find_ghosts=False):
         """See InterRepository.fetch()."""
-        if (len(self.source._fallback_repositories) > 0 or
-            len(self.target._fallback_repositories) > 0):
+        if (len(self.source._fallback_repositories) > 0):
             # The pack layer is not aware of fallback repositories, so when
             # fetching from a stacked repository or into a stacked repository
             # we use the generic fetch logic which uses the VersionedFiles
             # attributes on repository.
             from bzrlib.fetch import RepoFetcher
-            pack_coll = self.target._pack_collection
+            pack_coll = self._get_target_pack_collection()
             set_cache_size = (
                 lambda: pack_coll._new_pack.set_write_cache_size(1024*1024))
             fetcher = RepoFetcher(self.target, self.source, revision_id,


That is, use the normal InterPackRepo logic even when the target is stacked.
This seems to work except that it trips over the RevisionNotPresent bug
(<https://bugs.launchpad.net/bzr/+bug/288751> I think).

-Andrew.




More information about the bazaar mailing list