~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/fetch.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:
28
28
from bzrlib.lazy_import import lazy_import
29
29
lazy_import(globals(), """
30
30
from bzrlib import (
31
 
    graph as _mod_graph,
32
31
    tsort,
33
32
    versionedfile,
 
33
    vf_search,
34
34
    )
35
35
""")
36
36
from bzrlib import (
161
161
        elif self._last_revision == NULL_REVISION:
162
162
            # fetch_spec is None + last_revision is null => empty fetch.
163
163
            # explicit limit of no revisions needed
164
 
            return _mod_graph.EmptySearchResult()
 
164
            return vf_search.EmptySearchResult()
165
165
        elif self._last_revision is not None:
166
 
            return _mod_graph.NotInOtherForRevs(self.to_repository,
 
166
            return vf_search.NotInOtherForRevs(self.to_repository,
167
167
                self.from_repository, [self._last_revision],
168
168
                find_ghosts=self.find_ghosts).execute()
169
169
        else: # self._last_revision is None:
170
 
            return _mod_graph.EverythingNotInOther(self.to_repository,
 
170
            return vf_search.EverythingNotInOther(self.to_repository,
171
171
                self.from_repository,
172
172
                find_ghosts=self.find_ghosts).execute()
173
173
 
389
389
                    "limit is only supported with a source branch set")
390
390
            # Caller hasn't specified any revisions or source branch
391
391
            if self.target_repo_kind == TargetRepoKinds.EMPTY:
392
 
                return _mod_graph.EverythingResult(self.source_repo)
 
392
                return vf_search.EverythingResult(self.source_repo)
393
393
            else:
394
394
                # We want everything not already in the target (or target's
395
395
                # fallbacks).
396
 
                return _mod_graph.EverythingNotInOther(
 
396
                return vf_search.EverythingNotInOther(
397
397
                    self.target_repo, self.source_repo).execute()
398
398
        heads_to_fetch = set(self._explicit_rev_ids)
399
399
        if self.source_branch is not None:
416
416
            # heads_to_fetch will almost certainly be present so this doesn't
417
417
            # matter much.
418
418
            all_heads = heads_to_fetch.union(if_present_fetch)
419
 
            ret = _mod_graph.PendingAncestryResult(all_heads, self.source_repo)
 
419
            ret = vf_search.PendingAncestryResult(all_heads, self.source_repo)
420
420
            if self.limit is not None:
421
421
                graph = self.source_repo.get_graph()
422
422
                topo_order = list(graph.iter_topo_order(ret.get_keys()))
424
424
                ret = self.source_repo.revision_ids_to_search_result(result_set)
425
425
            return ret
426
426
        else:
427
 
            return _mod_graph.NotInOtherForRevs(self.target_repo, self.source_repo,
 
427
            return vf_search.NotInOtherForRevs(self.target_repo, self.source_repo,
428
428
                required_ids=heads_to_fetch, if_present_ids=if_present_fetch,
429
429
                limit=self.limit).execute()