~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-10-31 04:02:53 UTC
  • mfrom: (3801.1.21 autopack-rpc)
  • Revision ID: pqm@pqm.ubuntu.com-20081031040253-lqwvq5xf6rhnumii
Add 'PackRepository.autopack' RPC. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
810
810
            other, self).search_missing_revision_ids(revision_id, find_ghosts)
811
811
 
812
812
    def fetch(self, source, revision_id=None, pb=None, find_ghosts=False):
 
813
        # Not delegated to _real_repository so that InterRepository.get has a
 
814
        # chance to find an InterRepository specialised for RemoteRepository.
813
815
        if self.has_same_location(source):
814
816
            # check that last_revision is in 'from' and then return a
815
817
            # no-operation.
820
822
        inter = repository.InterRepository.get(source, self)
821
823
        try:
822
824
            return inter.fetch(revision_id=revision_id, pb=pb, find_ghosts=find_ghosts)
823
 
 
824
825
        except NotImplementedError:
825
826
            raise errors.IncompatibleRepositories(source, self)
826
827
 
1217
1218
        count = str(recipe[2])
1218
1219
        return '\n'.join((start_keys, stop_keys, count))
1219
1220
 
 
1221
    def autopack(self):
 
1222
        path = self.bzrdir._path_for_remote_call(self._client)
 
1223
        try:
 
1224
            response = self._call('PackRepository.autopack', path)
 
1225
        except errors.UnknownSmartMethod:
 
1226
            self._ensure_real()
 
1227
            self._real_repository._pack_collection.autopack()
 
1228
            return
 
1229
        if self._real_repository is not None:
 
1230
            # Reset the real repository's cache of pack names.
 
1231
            # XXX: At some point we may be able to skip this and just rely on
 
1232
            # the automatic retry logic to do the right thing, but for now we
 
1233
            # err on the side of being correct rather than being optimal.
 
1234
            self._real_repository._pack_collection.reload_pack_names()
 
1235
        if response[0] != 'ok':
 
1236
            raise errors.UnexpectedSmartServerResponse(response)
 
1237
 
1220
1238
 
1221
1239
class RemoteBranchLockableFiles(LockableFiles):
1222
1240
    """A 'LockableFiles' implementation that talks to a smart server.