Rev 4342: (robertc) Do not trigger NoSuchRevision pulling from a stacked branch in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu May 7 02:50:34 BST 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4342
revision-id: pqm at pqm.ubuntu.com-20090507015029-ymynxbonvgo1qcqi
parent: pqm at pqm.ubuntu.com-20090507005942-wnvvomd3130f1vph
parent: robertc at robertcollins.net-20090506235856-9g3fgc5m5l5bu3ui
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2009-05-07 02:50:29 +0100
message:
(robertc) Do not trigger NoSuchRevision pulling from a stacked branch
when the client needs content from it and the stacked-on
branch. (Robert Collins)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/smart/repository.py repository.py-20061128022038-vr5wy5bubyb8xttk-1
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
------------------------------------------------------------
revno: 4332.2.3
revision-id: robertc at robertcollins.net-20090506235856-9g3fgc5m5l5bu3ui
parent: robertc at robertcollins.net-20090506234213-puzjtbd3grzhefer
parent: pqm at pqm.ubuntu.com-20090506094512-vta3no53wohda83x
committer: Robert Collins <robertc at robertcollins.net>
branch nick: integration
timestamp: Thu 2009-05-07 09:58:56 +1000
message:
NEWS conflict.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/branchbuilder.py branchbuilder.py-20070427022007-zlxpqz2lannhk6y8-1
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/filters/eol.py eol.py-20090327060429-todzdjmqt3bpv5r8-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/rules.py properties.py-20080506032617-9k06uqalkf09ck0z-1
bzrlib/tests/blackbox/test_bound_branches.py test_bound_branches.py-20051109215527-2373188ad566c205
bzrlib/tests/branch_implementations/test_pull.py test_pull.py-20060410103942-83c35b26657414fc
bzrlib/tests/per_repository/test_fetch.py test_fetch.py-20070814052151-5cxha9slx4c93uog-1
bzrlib/tests/test_branchbuilder.py test_branchbuilder.p-20070427022007-zlxpqz2lannhk6y8-2
bzrlib/tests/test_eol_filters.py test_eol_filters.py-20090327060429-todzdjmqt3bpv5r8-2
bzrlib/tests/test_fetch.py testfetch.py-20050825090644-f73e07e7dfb1765a
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
------------------------------------------------------------
revno: 4332.2.2
revision-id: robertc at robertcollins.net-20090506234213-puzjtbd3grzhefer
parent: robertc at robertcollins.net-20090506020536-xckeehz4vv1x66hr
committer: Robert Collins <robertc at robertcollins.net>
branch nick: bug-360791
timestamp: Thu 2009-05-07 09:42:13 +1000
message:
Expand on NEWS.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
------------------------------------------------------------
revno: 4332.2.1
revision-id: robertc at robertcollins.net-20090506020536-xckeehz4vv1x66hr
parent: pqm at pqm.ubuntu.com-20090505195559-0qmeyyua7e407sym
committer: Robert Collins <robertc at robertcollins.net>
branch nick: bug-360791
timestamp: Wed 2009-05-06 12:05:36 +1000
message:
Fix bug 360791 by not raising an error when a smart server is asked for more content than it has locally; the client is assumed to be monitoring what it gets.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/smart/repository.py repository.py-20061128022038-vr5wy5bubyb8xttk-1
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
=== modified file 'NEWS'
--- a/NEWS 2009-05-06 17:31:37 +0000
+++ b/NEWS 2009-05-07 01:50:29 +0000
@@ -79,6 +79,21 @@
* Several bugs related to unicode symlinks have been fixed and the test suite
enhanced to better catch regressions for them. (Vincent Ladeuil)
+* The smart server will no longer raise 'NoSuchRevision' when streaming
+ content with a size mismatch in a reconstructed graph search: it assumes
+ that the client will make sure it is happy with what it got, and this
+ sort of mismatch is normal for stacked environments.
+ bzr 1.13.0/1 will stream from unstacked branches only - in that case not
+ getting all the content expected would be a bug. However the graph
+ search is how we figured out what we wanted, so a mismatch is both odd
+ and unrecoverable without starting over, and starting over will end up
+ with the same data as if we just permitted the mismatch. If data is
+ gc'd, doing a new search will find only the truncated data, so sending
+ only the truncated data seems reasonable. bzr versions newer than this
+ will stream from stacked branches and check the stream to find missing
+ content in the stacked-on branch, and thus will handle the situation
+ implicitly. (Robert Collins, #360791)
+
* Upgrading to, or fetching into a 'rich-root' format will now correctly
set the root data the same way that reconcile does.
(Robert Collins, #368921)
=== modified file 'bzrlib/smart/repository.py'
--- a/bzrlib/smart/repository.py 2009-03-24 23:19:12 +0000
+++ b/bzrlib/smart/repository.py 2009-05-06 02:05:36 +0000
@@ -71,18 +71,34 @@
# is expected)
return None
- def recreate_search(self, repository, search_bytes):
+ def recreate_search(self, repository, search_bytes, discard_excess=False):
+ """Recreate a search from its serialised form.
+
+ :param discard_excess: If True, and the search refers to data we don't
+ have, just silently accept that fact - the verb calling
+ recreate_search trusts that clients will look for missing things
+ they expected and get it from elsewhere.
+ """
lines = search_bytes.split('\n')
if lines[0] == 'ancestry-of':
heads = lines[1:]
search_result = graph.PendingAncestryResult(heads, repository)
return search_result, None
elif lines[0] == 'search':
- return self.recreate_search_from_recipe(repository, lines[1:])
+ return self.recreate_search_from_recipe(repository, lines[1:],
+ discard_excess=discard_excess)
else:
return (None, FailedSmartServerResponse(('BadSearch',)))
- def recreate_search_from_recipe(self, repository, lines):
+ def recreate_search_from_recipe(self, repository, lines,
+ discard_excess=False):
+ """Recreate a specific revision search (vs a from-tip search).
+
+ :param discard_excess: If True, and the search refers to data we don't
+ have, just silently accept that fact - the verb calling
+ recreate_search trusts that clients will look for missing things
+ they expected and get it from elsewhere.
+ """
start_keys = set(lines[0].split(' '))
exclude_keys = set(lines[1].split(' '))
revision_count = int(lines[2])
@@ -97,7 +113,8 @@
break
search.stop_searching_any(exclude_keys.intersection(next_revs))
search_result = search.get_result()
- if search_result.get_recipe()[3] != revision_count:
+ if (not discard_excess and
+ search_result.get_recipe()[3] != revision_count):
# we got back a different amount of data than expected, this
# gets reported as NoSuchRevision, because less revisions
# indicates missing revisions, and more should never happen as
@@ -379,7 +396,8 @@
repository = self._repository
repository.lock_read()
try:
- search_result, error = self.recreate_search(repository, body_bytes)
+ search_result, error = self.recreate_search(repository, body_bytes,
+ discard_excess=True)
if error is not None:
repository.unlock()
return error
=== modified file 'bzrlib/tests/test_remote.py'
--- a/bzrlib/tests/test_remote.py 2009-04-27 16:10:10 +0000
+++ b/bzrlib/tests/test_remote.py 2009-05-06 02:05:36 +0000
@@ -2600,6 +2600,21 @@
# from the backing branch, and one from the stacked on branch.
self.assertLength(2, self.hpss_calls)
+ def test_stacked_pull_more_than_stacking_has_bug_360791(self):
+ # When pulling some fixed amount of content that is more than the
+ # source has (because some is coming from a fallback branch, no error
+ # should be received. This was reported as bug 360791.
+ # Need three branches: a trunk, a stacked branch, and a preexisting
+ # branch pulling content from stacked and trunk.
+ self.setup_smart_server_with_call_log()
+ trunk = self.make_branch_and_tree('trunk', format="1.9-rich-root")
+ r1 = trunk.commit('start')
+ stacked_branch = trunk.branch.create_clone_on_transport(
+ self.get_transport('stacked'), stacked_on=trunk.branch.base)
+ local = self.make_branch('local', format='1.9-rich-root')
+ local.repository.fetch(stacked_branch.repository,
+ stacked_branch.last_revision())
+
class TestRemoteBranchEffort(tests.TestCaseWithTransport):
More information about the bazaar-commits
mailing list