~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: Patch Queue Manager
  • Date: 2011-12-06 16:05:01 UTC
  • mfrom: (6341.1.6 vf-search)
  • Revision ID: pqm@pqm.ubuntu.com-20111206160501-uxh307vklxc6zztm
(jelmer) Move search result handling into a separate module. (Jelmer
 Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
    testament as _mod_testament,
39
39
    urlutils,
40
40
    vf_repository,
 
41
    vf_search,
41
42
    )
42
43
from bzrlib.branch import BranchReferenceFormat, BranchWriteLockResult
43
44
from bzrlib.decorators import needs_read_lock, needs_write_lock, only_raises
1841
1842
        included_keys = result_set.intersection(result_parents)
1842
1843
        start_keys = result_set.difference(included_keys)
1843
1844
        exclude_keys = result_parents.difference(result_set)
1844
 
        result = graph.SearchResult(start_keys, exclude_keys,
 
1845
        result = vf_search.SearchResult(start_keys, exclude_keys,
1845
1846
            len(result_set), result_set)
1846
1847
        return result
1847
1848
 
1895
1896
        # the InterRepository base class, which raises an
1896
1897
        # IncompatibleRepositories when asked to fetch.
1897
1898
        inter = _mod_repository.InterRepository.get(source, self)
 
1899
        if (fetch_spec is not None and
 
1900
            not getattr(inter, "supports_fetch_spec", False)):
 
1901
            raise errors.UnsupportedOperation(
 
1902
                "fetch_spec not supported for %r" % inter)
1898
1903
        return inter.fetch(revision_id=revision_id,
1899
1904
            find_ghosts=find_ghosts, fetch_spec=fetch_spec)
1900
1905
 
2062
2067
            parents_map = {}
2063
2068
        if _DEFAULT_SEARCH_DEPTH <= 0:
2064
2069
            (start_set, stop_keys,
2065
 
             key_count) = graph.search_result_from_parent_map(
 
2070
             key_count) = vf_search.search_result_from_parent_map(
2066
2071
                parents_map, self._unstacked_provider.missing_keys)
2067
2072
        else:
2068
2073
            (start_set, stop_keys,
2069
 
             key_count) = graph.limited_search_result_from_parent_map(
 
2074
             key_count) = vf_search.limited_search_result_from_parent_map(
2070
2075
                parents_map, self._unstacked_provider.missing_keys,
2071
2076
                keys, depth=_DEFAULT_SEARCH_DEPTH)
2072
2077
        recipe = ('manual', start_set, stop_keys, key_count)
2684
2689
            except errors.UnknownSmartMethod:
2685
2690
                medium._remember_remote_is_before(version)
2686
2691
            except errors.UnknownErrorFromSmartServer, e:
2687
 
                if isinstance(search, graph.EverythingResult):
 
2692
                if isinstance(search, vf_search.EverythingResult):
2688
2693
                    error_verb = e.error_from_smart_server.error_verb
2689
2694
                    if error_verb == 'BadSearch':
2690
2695
                        # Pre-2.4 servers don't support this sort of search.