134
134
from revision_ids is returned. The verb takes a body containing the
135
135
current search state, see do_body for details.
137
If 'include-missing:' is in revision_ids, ghosts encountered in the
138
graph traversal for getting parent data are included in the result with
139
a prefix of 'missing:'.
137
141
:param repository: The repository to query in.
138
142
:param revision_ids: The utf8 encoded revision_id to answer for.
158
162
def _do_repository_request(self, body_bytes):
159
163
repository = self._repository
160
164
revision_ids = set(self._revision_ids)
165
include_missing = 'include-missing:' in revision_ids
167
revision_ids.remove('include-missing:')
161
168
body_lines = body_bytes.split('\n')
162
169
search_result, error = self.recreate_search_from_recipe(
163
170
repository, body_lines)
179
186
queried_revs.update(next_revs)
180
187
parent_map = repo_graph.get_parent_map(next_revs)
188
current_revs = next_revs
181
189
next_revs = set()
182
for revision_id, parents in parent_map.iteritems():
183
# adjust for the wire
184
if parents == (_mod_revision.NULL_REVISION,):
186
# prepare the next query
187
next_revs.update(parents)
188
if revision_id not in client_seen_revs:
190
for revision_id in current_revs:
192
parents = parent_map.get(revision_id)
193
if parents is not None:
194
# adjust for the wire
195
if parents == (_mod_revision.NULL_REVISION,):
197
# prepare the next query
198
next_revs.update(parents)
199
encoded_id = revision_id
202
encoded_id = "missing:" + revision_id
204
if (revision_id not in client_seen_revs and
205
(not missing_rev or include_missing)):
189
206
# Client does not have this revision, give it to it.
190
207
# add parents to the result
191
result[revision_id] = parents
208
result[encoded_id] = parents
192
209
# Approximate the serialized cost of this revision_id.
193
size_so_far += 2 + len(revision_id) + sum(map(len, parents))
210
size_so_far += 2 + len(encoded_id) + sum(map(len, parents))
194
211
# get all the directly asked for parents, and then flesh out to
195
212
# 64K (compressed) or so. We do one level of depth at a time to
196
213
# stay in sync with the client. The 250000 magic number is