~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/repository.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
    bencode,
29
29
    errors,
30
30
    estimate_compressed_size,
31
 
    graph,
32
31
    osutils,
33
32
    pack,
34
33
    trace,
35
34
    ui,
 
35
    vf_search,
36
36
    )
37
37
from bzrlib.bzrdir import BzrDir
38
38
from bzrlib.smart.request import (
85
85
            they expected and get it from elsewhere.
86
86
        """
87
87
        if search_bytes == 'everything':
88
 
            return graph.EverythingResult(repository), None
 
88
            return vf_search.EverythingResult(repository), None
89
89
        lines = search_bytes.split('\n')
90
90
        if lines[0] == 'ancestry-of':
91
91
            heads = lines[1:]
92
 
            search_result = graph.PendingAncestryResult(heads, repository)
 
92
            search_result = vf_search.PendingAncestryResult(heads, repository)
93
93
            return search_result, None
94
94
        elif lines[0] == 'search':
95
95
            return self.recreate_search_from_recipe(repository, lines[1:],
119
119
                except StopIteration:
120
120
                    break
121
121
                search.stop_searching_any(exclude_keys.intersection(next_revs))
122
 
            search_result = search.get_result()
123
 
            if (not discard_excess and
124
 
                search_result.get_recipe()[3] != revision_count):
 
122
            (started_keys, excludes, included_keys) = search.get_state()
 
123
            if (not discard_excess and len(included_keys) != revision_count):
125
124
                # we got back a different amount of data than expected, this
126
125
                # gets reported as NoSuchRevision, because less revisions
127
126
                # indicates missing revisions, and more should never happen as
128
127
                # the excludes list considers ghosts and ensures that ghost
129
128
                # filling races are not a problem.
130
129
                return (None, FailedSmartServerResponse(('NoSuchRevision',)))
 
130
            search_result = vf_search.SearchResult(started_keys, excludes,
 
131
                len(included_keys), included_keys)
131
132
            return (search_result, None)
132
133
        finally:
133
134
            repository.unlock()