~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: 2011-01-14 17:18:23 UTC
  • mfrom: (5536.2.9 fetch-dev-docs)
  • Revision ID: pqm@pqm.ubuntu.com-20110114171823-5gx64sero62ag6r4
(jelmer) Add a developer doc on the topic of fetch. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1348
1348
        return result
1349
1349
 
1350
1350
    @needs_read_lock
1351
 
    def search_missing_revision_ids(self, other, revision_id=None, find_ghosts=True):
 
1351
    def search_missing_revision_ids(self, other,
 
1352
            revision_id=symbol_versioning.DEPRECATED_PARAMETER,
 
1353
            find_ghosts=True, revision_ids=None, if_present_ids=None):
1352
1354
        """Return the revision ids that other has that this does not.
1353
1355
 
1354
1356
        These are returned in topological order.
1355
1357
 
1356
1358
        revision_id: only return revision ids included by revision_id.
1357
1359
        """
1358
 
        return repository.InterRepository.get(
1359
 
            other, self).search_missing_revision_ids(revision_id, find_ghosts)
 
1360
        if symbol_versioning.deprecated_passed(revision_id):
 
1361
            symbol_versioning.warn(
 
1362
                'search_missing_revision_ids(revision_id=...) was '
 
1363
                'deprecated in 2.3.  Use revision_ids=[...] instead.',
 
1364
                DeprecationWarning, stacklevel=2)
 
1365
            if revision_ids is not None:
 
1366
                raise AssertionError(
 
1367
                    'revision_ids is mutually exclusive with revision_id')
 
1368
            if revision_id is not None:
 
1369
                revision_ids = [revision_id]
 
1370
        inter_repo = repository.InterRepository.get(other, self)
 
1371
        return inter_repo.search_missing_revision_ids(
 
1372
            find_ghosts=find_ghosts, revision_ids=revision_ids,
 
1373
            if_present_ids=if_present_ids)
1360
1374
 
1361
1375
    def fetch(self, source, revision_id=None, pb=None, find_ghosts=False,
1362
1376
            fetch_spec=None):
1763
1777
        return '\n'.join((start_keys, stop_keys, count))
1764
1778
 
1765
1779
    def _serialise_search_result(self, search_result):
1766
 
        if isinstance(search_result, graph.PendingAncestryResult):
1767
 
            parts = ['ancestry-of']
1768
 
            parts.extend(search_result.heads)
1769
 
        else:
1770
 
            recipe = search_result.get_recipe()
1771
 
            parts = [recipe[0], self._serialise_search_recipe(recipe)]
 
1780
        parts = search_result.get_network_struct()
1772
1781
        return '\n'.join(parts)
1773
1782
 
1774
1783
    def autopack(self):
1968
1977
        candidate_verbs = [
1969
1978
            ('Repository.get_stream_1.19', (1, 19)),
1970
1979
            ('Repository.get_stream', (1, 13))]
 
1980
 
1971
1981
        found_verb = False
1972
1982
        for verb, version in candidate_verbs:
1973
1983
            if medium._is_remote_before(version):
1977
1987
                    verb, args, search_bytes)
1978
1988
            except errors.UnknownSmartMethod:
1979
1989
                medium._remember_remote_is_before(version)
 
1990
            except errors.UnknownErrorFromSmartServer, e:
 
1991
                if isinstance(search, graph.EverythingResult):
 
1992
                    error_verb = e.error_from_smart_server.error_verb
 
1993
                    if error_verb == 'BadSearch':
 
1994
                        # Pre-2.3 servers don't support this sort of search.
 
1995
                        # XXX: perhaps falling back to VFS on BadSearch is a
 
1996
                        # good idea in general?  It might provide a little bit
 
1997
                        # of protection against client-side bugs.
 
1998
                        medium._remember_remote_is_before((2, 3))
 
1999
                        break
 
2000
                raise
1980
2001
            else:
1981
2002
                response_tuple, response_handler = response
1982
2003
                found_verb = True