Rev 3196: Include revisions past searched ones rather than doing very small replies. in http://people.ubuntu.com/~robertc/baz2.0/search-results
Robert Collins
robertc at robertcollins.net
Fri Jan 18 04:05:36 GMT 2008
At http://people.ubuntu.com/~robertc/baz2.0/search-results
------------------------------------------------------------
revno: 3196
revision-id:robertc at robertcollins.net-20080118040529-7uc3xpwd6yovctoz
parent: robertc at robertcollins.net-20080118034319-tp2b9j8u4h1uxspx
committer: Robert Collins <robertc at robertcollins.net>
branch nick: Repository.get_parent_map
timestamp: Fri 2008-01-18 15:05:29 +1100
message:
Include revisions past searched ones rather than doing very small replies.
modified:
bzrlib/smart/repository.py repository.py-20061128022038-vr5wy5bubyb8xttk-1
=== modified file 'bzrlib/smart/repository.py'
--- a/bzrlib/smart/repository.py 2008-01-18 03:43:19 +0000
+++ b/bzrlib/smart/repository.py 2008-01-18 04:05:29 +0000
@@ -125,10 +125,13 @@
return error
# TODO might be nice to start up the search again; but thats not
# written or tested yet.
- queried_revs = set(search.get_result().get_keys())
+ client_seen_revs = set(search.get_result().get_keys())
+ # Always include the requested ids.
+ client_seen_revs.difference_update(revision_ids)
lines = []
repo_graph = repository.get_graph()
result = {}
+ queried_revs = set()
size_so_far = 0
next_revs = revision_ids
first_loop_done = False
@@ -140,17 +143,19 @@
# adjust for the wire
if parents == (_mod_revision.NULL_REVISION,):
parents = ()
- # add parents to the result
- result[revision_id] = parents
# prepare the next query
next_revs.update(parents)
- # Approximate the serialized cost of this revision_id.
- size_so_far += 2 + len(revision_id) + sum(map(len, parents))
- # get all the directly asked for parents, and then flesh out to
- # 64K or so.
- if first_loop_done and size_so_far > 65000:
- next_revs = set()
- break
+ if revision_id not in client_seen_revs:
+ # Client does not have this revision, give it to it.
+ # add parents to the result
+ result[revision_id] = parents
+ # Approximate the serialized cost of this revision_id.
+ size_so_far += 2 + len(revision_id) + sum(map(len, parents))
+ # get all the directly asked for parents, and then flesh out to
+ # 64K or so.
+ if first_loop_done and size_so_far > 65000:
+ next_revs = set()
+ break
# don't query things we've already queried
next_revs.difference_update(queried_revs)
first_loop_done = True
More information about the bazaar-commits
mailing list