Merge lp:~spiv/bzr/cross-format-stacking-fetch-562380-2.0 into lp:bzr/2.0

Proposed by Andrew Bennetts
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~spiv/bzr/cross-format-stacking-fetch-562380-2.0
Merge into: lp:bzr/2.0
Diff against target: 139 lines (+40/-5)
5 files modified
NEWS (+6/-0)
bzrlib/remote.py (+12/-0)
bzrlib/tests/per_repository_reference/__init__.py (+17/-0)
bzrlib/tests/per_repository_reference/test_default_stacking.py (+0/-1)
bzrlib/tests/test_remote.py (+5/-4)
To merge this branch: bzr merge lp:~spiv/bzr/cross-format-stacking-fetch-562380-2.0
Reviewer Review Type Date Requested Status
Vincent Ladeuil Approve
Review via email: mp+23987@code.launchpad.net

Commit message

Don't allow RemoteRepository to stack on an incompatible-format repository. (#562380)

Description of the change

Backport to 2.0 of <https://code.edge.launchpad.net/~spiv/bzr/cross-format-stacking-fetch-562380/+merge/23526>: Don't allow RemoteRepository to stack on an incompatible-format repository. (#562380)

To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) :
review: Approve
Revision history for this message
Vincent Ladeuil (vila) wrote :

This can't merge by pqm, same root cause as jam's one:

test_selftest.TestSelftest.test_runner_class ERROR 9ms
    'AutoTimingTestResultDecorator' object has no attribute 'done'

======================================================================
ERROR: test_runner_class (bzrlib.tests.test_selftest.TestSelftest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/net/bigmamac.local/Users/vila/src/bzr/integration/2.0/bzrlib/tests/test_selftest.py", line 1845, in test_runner_class
    test_suite_factory=self.factory)
  File "/net/bigmamac.local/Users/vila/src/bzr/integration/2.0/bzrlib/tests/test_selftest.py", line 1772, in run_selftest
    self.assertEqual(True, tests.selftest(stream=output, **kwargs))
  File "/net/bigmamac.local/Users/vila/src/bzr/integration/2.0/bzrlib/tests/__init__.py", line 3261, in selftest
    stream=stream,
  File "/net/bigmamac.local/Users/vila/src/bzr/integration/2.0/bzrlib/tests/__init__.py", line 2815, in run_suite
    result.done()
AttributeError: 'AutoTimingTestResultDecorator' object has no attribute 'done'

----------------------------------------------------------------------
Ran 21905 tests in 2064.942s

FAILED (errors=1, known_failure_count=30)

Revision history for this message
Vincent Ladeuil (vila) wrote :

Note that I had to run the test locally to get that result, pqm didn't issue any feedback, happily trying again adn againg (see pqm loops bug).

Revision history for this message
bzr PQM (bzr-pqm) wrote :

Successful steps
Failure output:
All lines of log output:
Executing star-merge lp:~spiv/bzr/cross-format-stacking-fetch-562380-2.0 at Thu Apr 29 04:26:54 2010
['Nothing to merge.']

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS'
--- NEWS 2010-04-01 14:10:47 +0000
+++ NEWS 2010-04-23 05:34:16 +0000
@@ -26,6 +26,12 @@
26 history no longer crash when deleted files are involved.26 history no longer crash when deleted files are involved.
27 (Vincent Ladeuil, John Arbash Meinel, #375898)27 (Vincent Ladeuil, John Arbash Meinel, #375898)
2828
29* Repositories accessed via a smart server now reject being stacked on a
30 repository in an incompatible format, as is the case when accessing them
31 via other methods. This was causing fetches from those repositories via
32 a smart server (e.g. using ``bzr branch``) to receive invalid data.
33 (Andrew Bennetts, #562380)
34
29bzr 2.0.535bzr 2.0.5
30#########36#########
3137
3238
=== modified file 'bzrlib/remote.py'
--- bzrlib/remote.py 2009-10-07 05:33:23 +0000
+++ bzrlib/remote.py 2010-04-23 05:34:16 +0000
@@ -27,6 +27,7 @@
27 lock,27 lock,
28 lockdir,28 lockdir,
29 repository,29 repository,
30 repository as _mod_repository,
30 revision,31 revision,
31 revision as _mod_revision,32 revision as _mod_revision,
32 symbol_versioning,33 symbol_versioning,
@@ -1151,6 +1152,7 @@
1151 # state, so always add a lock here. If a caller passes us a locked1152 # state, so always add a lock here. If a caller passes us a locked
1152 # repository, they are responsible for unlocking it later.1153 # repository, they are responsible for unlocking it later.
1153 repository.lock_read()1154 repository.lock_read()
1155 self._check_fallback_repository(repository)
1154 self._fallback_repositories.append(repository)1156 self._fallback_repositories.append(repository)
1155 # If self._real_repository was parameterised already (e.g. because a1157 # If self._real_repository was parameterised already (e.g. because a
1156 # _real_branch had its get_stacked_on_url method called), then the1158 # _real_branch had its get_stacked_on_url method called), then the
@@ -1161,6 +1163,16 @@
1161 if repository.bzrdir.root_transport.base not in fallback_locations:1163 if repository.bzrdir.root_transport.base not in fallback_locations:
1162 self._real_repository.add_fallback_repository(repository)1164 self._real_repository.add_fallback_repository(repository)
11631165
1166 def _check_fallback_repository(self, repository):
1167 """Check that this repository can fallback to repository safely.
1168
1169 Raise an error if not.
1170
1171 :param repository: A repository to fallback to.
1172 """
1173 return _mod_repository.InterRepository._assert_same_model(
1174 self, repository)
1175
1164 def add_inventory(self, revid, inv, parents):1176 def add_inventory(self, revid, inv, parents):
1165 self._ensure_real()1177 self._ensure_real()
1166 return self._real_repository.add_inventory(revid, inv, parents)1178 return self._real_repository.add_inventory(revid, inv, parents)
11671179
=== modified file 'bzrlib/tests/per_repository_reference/__init__.py'
--- bzrlib/tests/per_repository_reference/__init__.py 2009-07-15 17:51:40 +0000
+++ bzrlib/tests/per_repository_reference/__init__.py 2010-04-23 05:34:16 +0000
@@ -23,6 +23,7 @@
23"""23"""
2424
25from bzrlib import (25from bzrlib import (
26 errors,
26 repository,27 repository,
27 remote,28 remote,
28 )29 )
@@ -66,6 +67,22 @@
66 self.repository_format.__class__)67 self.repository_format.__class__)
6768
6869
70class TestIncompatibleStacking(TestCaseWithRepository):
71
72 def test_add_fallback_repository_rejects_incompatible(self):
73 # Repository.add_fallback_repository raises IncompatibleRepositories if
74 # you take two repositories in different serializations and try to
75 # stack them.
76 if self.make_repository('test')._format.supports_chks:
77 different_fmt = '1.9'
78 else:
79 different_fmt = '2a'
80 repo = self.make_repository('repo', format=different_fmt)
81 referring = self.make_repository('referring')
82 self.assertRaises(errors.IncompatibleRepositories,
83 referring.add_fallback_repository, repo)
84
85
69def external_reference_test_scenarios():86def external_reference_test_scenarios():
70 """Generate test scenarios for repositories supporting external references.87 """Generate test scenarios for repositories supporting external references.
71 """88 """
7289
=== modified file 'bzrlib/tests/per_repository_reference/test_default_stacking.py'
--- bzrlib/tests/per_repository_reference/test_default_stacking.py 2009-06-10 03:56:49 +0000
+++ bzrlib/tests/per_repository_reference/test_default_stacking.py 2010-04-23 05:34:16 +0000
@@ -15,7 +15,6 @@
15# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA15# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1616
1717
18from bzrlib.smart import server
19from bzrlib.tests.per_repository import TestCaseWithRepository18from bzrlib.tests.per_repository import TestCaseWithRepository
2019
2120
2221
=== modified file 'bzrlib/tests/test_remote.py'
--- bzrlib/tests/test_remote.py 2009-10-07 05:33:23 +0000
+++ bzrlib/tests/test_remote.py 2010-04-23 05:34:16 +0000
@@ -1164,8 +1164,8 @@
1164 len(branch.repository._real_repository._fallback_repositories))1164 len(branch.repository._real_repository._fallback_repositories))
11651165
1166 def test_get_stacked_on_real_branch(self):1166 def test_get_stacked_on_real_branch(self):
1167 base_branch = self.make_branch('base', format='1.6')1167 base_branch = self.make_branch('base')
1168 stacked_branch = self.make_branch('stacked', format='1.6')1168 stacked_branch = self.make_branch('stacked')
1169 stacked_branch.set_stacked_on_url('../base')1169 stacked_branch.set_stacked_on_url('../base')
1170 reference_format = self.get_repo_format()1170 reference_format = self.get_repo_format()
1171 network_name = reference_format.network_name()1171 network_name = reference_format.network_name()
@@ -1176,7 +1176,7 @@
1176 'success', ('branch', branch_network_name))1176 'success', ('branch', branch_network_name))
1177 client.add_expected_call(1177 client.add_expected_call(
1178 'BzrDir.find_repositoryV3', ('stacked/',),1178 'BzrDir.find_repositoryV3', ('stacked/',),
1179 'success', ('ok', '', 'no', 'no', 'yes', network_name))1179 'success', ('ok', '', 'yes', 'no', 'yes', network_name))
1180 # called twice, once from constructor and then again by us1180 # called twice, once from constructor and then again by us
1181 client.add_expected_call(1181 client.add_expected_call(
1182 'Branch.get_stacked_on_url', ('stacked/',),1182 'Branch.get_stacked_on_url', ('stacked/',),
@@ -2115,12 +2115,13 @@
2115 """2115 """
2116 # Make a repo with a fallback repo, both using a FakeClient.2116 # Make a repo with a fallback repo, both using a FakeClient.
2117 format = remote.response_tuple_to_repo_format(2117 format = remote.response_tuple_to_repo_format(
2118 ('yes', 'no', 'yes', 'fake-network-name'))2118 ('yes', 'no', 'yes', self.get_repo_format().network_name()))
2119 repo, client = self.setup_fake_client_and_repository('quack')2119 repo, client = self.setup_fake_client_and_repository('quack')
2120 repo._format = format2120 repo._format = format
2121 fallback_repo, ignored = self.setup_fake_client_and_repository(2121 fallback_repo, ignored = self.setup_fake_client_and_repository(
2122 'fallback')2122 'fallback')
2123 fallback_repo._client = client2123 fallback_repo._client = client
2124 fallback_repo._format = format
2124 repo.add_fallback_repository(fallback_repo)2125 repo.add_fallback_repository(fallback_repo)
2125 # First the client should ask the primary repo2126 # First the client should ask the primary repo
2126 client.add_expected_call(2127 client.add_expected_call(

Subscribers

People subscribed via source and target branches