Rev 3812: make _walk_to_common responsible for stopping ancestors in http://bzr.arbash-meinel.com/branches/bzr/1.9-dev/stop_searching
John Arbash Meinel
john at arbash-meinel.com
Thu Oct 30 15:20:07 GMT 2008
At http://bzr.arbash-meinel.com/branches/bzr/1.9-dev/stop_searching
------------------------------------------------------------
revno: 3812
revision-id: john at arbash-meinel.com-20081030152000-pzfowc2mapr41kut
parent: andrew.bennetts at canonical.com-20081030064227-t7d1zcgd4ieywssy
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: stop_searching
timestamp: Thu 2008-10-30 10:20:00 -0500
message:
make _walk_to_common responsible for stopping ancestors
and assume that callers that call 'stop' late will handle ancestors,
so don't bother testing what happens if they don't.
-------------- next part --------------
=== modified file 'bzrlib/graph.py'
--- a/bzrlib/graph.py 2008-10-30 06:29:57 +0000
+++ b/bzrlib/graph.py 2008-10-30 15:20:00 +0000
@@ -1331,13 +1331,13 @@
Remove any of the specified revisions from the search list.
None of the specified revisions are required to be present in the
- search list. In this case, the call is a no-op.
+ search list.
- It's ok to stop searching for a revision seen in a previous iteration,
- but doing so won't automatically cause later revisions that are
- connected via that revision to be stopped as well. All explicitly
- stopped revisions will be excluded from the search result's get_keys(),
- though.
+ It is okay to call stop_searching_any() for revisions which were seen
+ in previous iterations. It is the callers responsibility to call
+ find_seen_ancestors() to make sure that current search tips that are
+ ancestors of those revisions are also stopped. All explicitly stopped
+ revisions will be excluded from the search result's get_keys(), though.
"""
# TODO: does this help performance?
# if not revisions:
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py 2008-10-29 23:28:46 +0000
+++ b/bzrlib/remote.py 2008-10-30 15:20:00 +0000
@@ -973,7 +973,7 @@
args = (path,) + tuple(keys)
try:
response = self._call_with_body_bytes_expecting_body(
- verb, args, self._serialise_search_recipe(recipe))
+ verb, args, body)
except errors.UnknownSmartMethod:
# Server does not support this method, so get the whole graph.
# Worse, we have to force a disconnection, because the server now
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2008-10-27 06:15:46 +0000
+++ b/bzrlib/repository.py 2008-10-30 15:20:00 +0000
@@ -2439,11 +2439,14 @@
raise errors.NoSuchRevision(
self.source, ghosts_to_check.pop())
missing_revs.update(next_revs - have_revs)
- searcher.stop_searching_any(have_revs)
+ # Because we may have walked past the original stop point, make
+ # sure everything is stopped
+ stop_revs = searcher.find_seen_ancestors(have_revs)
+ searcher.stop_searching_any(stop_revs)
if searcher_exhausted:
break
return searcher.get_result()
-
+
@deprecated_method(one_two)
@needs_read_lock
def missing_revision_ids(self, revision_id=None, find_ghosts=True):
=== modified file 'bzrlib/tests/test_graph.py'
--- a/bzrlib/tests/test_graph.py 2008-10-30 06:42:27 +0000
+++ b/bzrlib/tests/test_graph.py 2008-10-30 15:20:00 +0000
@@ -1101,34 +1101,7 @@
# 'middle' came from the previous iteration, but we don't stop
# searching it until *after* advancing the searcher.
(set(['head', 'middle', 'child']),
- (set(['head']), set(['middle', 'null:']), 2),
- ['head', 'child'], None, ['middle']),
- ]
- self.assertSeenAndResult(expected, search, search.next)
- # using next_with_ghosts:
- search = graph._make_breadth_first_searcher(['head'])
- self.assertSeenAndResult(expected, search, search.next_with_ghosts)
-
- def test_breadth_first_stop_searching_late_more_keys(self):
- # Like test_breadth_first_stop_searching_late, but stop searching all
- # the keys seen between the earlier iteration and the last (rather than
- # just one).
- graph = self.make_graph({
- 'head':['middle'],
- 'middle':['child'],
- 'child':[NULL_REVISION],
- NULL_REVISION:[],
- })
- search = graph._make_breadth_first_searcher(['head'])
- expected = [
- (set(['head']), (set(['head']), set(['middle']), 1),
- ['head'], None, None),
- (set(['head', 'middle']), (set(['head']), set(['child']), 2),
- ['head', 'middle'], None, None),
- # 'middle' came from the previous iteration, but we don't stop
- # searching it until *after* advancing the searcher.
- (set(['head', 'middle', 'child']),
- (set(['head']), set(['middle']), 1),
+ (set(['head']), set(['middle', 'child']), 1),
['head'], None, ['middle', 'child']),
]
self.assertSeenAndResult(expected, search, search.next)
More information about the bazaar-commits
mailing list