Rev 3201: Use the current search to provide details rather than expensively recreating the border area. in http://people.ubuntu.com/~robertc/baz2.0/search-results
Robert Collins
robertc at robertcollins.net
Sun Feb 3 15:01:41 GMT 2008
At http://people.ubuntu.com/~robertc/baz2.0/search-results
------------------------------------------------------------
revno: 3201
revision-id:robertc at robertcollins.net-20080203150131-v1od7axpjo43ptho
parent: robertc at robertcollins.net-20080201065213-058c0unik3j3o9hb
committer: Robert Collins <robertc at robertcollins.net>
branch nick: Remote_missing_uses_search
timestamp: Mon 2008-02-04 02:01:31 +1100
message:
Use the current search to provide details rather than expensively recreating the border area.
modified:
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py 2008-02-01 06:52:13 +0000
+++ b/bzrlib/remote.py 2008-02-03 15:01:31 +0000
@@ -774,7 +774,7 @@
ancestry = self._parents_map
missing_revisions = set(key for key in keys if key not in ancestry)
if missing_revisions:
- parent_map = self._get_parent_map(missing_revisions)
+ parent_map = self._get_parent_map(missing_revisions, current_search)
if 'hpss' in debug.debug_flags:
mutter('retransmitted revisions: %d of %d',
len(set(self._parents_map).intersection(parent_map)),
@@ -805,7 +805,7 @@
return True
return False
- def _get_parent_map(self, keys):
+ def _get_parent_map(self, keys, current_search):
"""Helper for get_parent_map that performs the RPC."""
keys = set(keys)
if NULL_REVISION in keys:
@@ -815,25 +815,10 @@
return found_parents
else:
found_parents = {}
- # TODO(Needs analysis): We could assume that the keys being requested
- # from get_parent_map are in a breadth first search, so typically they
- # will all be depth N from some common parent, and we don't have to
- # have the server iterate from the root parent, but rather from the
- # keys we're searching; and just tell the server the keyspace we
- # already have; but this may be more traffic again.
-
- # Transform self._parents_map into a search request recipe.
- # TODO: Manage this incrementally to avoid covering the same path
- # repeatedly. (The server will have to on each request, but the less
- # work done the better).
- start_set = set(self._parents_map)
- result_parents = set()
- for parents in self._parents_map.itervalues():
- result_parents.update(parents)
- stop_keys = result_parents.difference(start_set)
- included_keys = start_set.intersection(result_parents)
- start_set.difference_update(included_keys)
- recipe = (start_set, stop_keys, len(self._parents_map))
+ if current_search is not None:
+ recipe = current_search.get_result().get_recipe()
+ else:
+ recipe = (set(), set(), 0)
body = self._serialise_search_recipe(recipe)
path = self.bzrdir._path_for_remote_call(self._client)
for key in keys:
More information about the bazaar-commits
mailing list