Merge lp:~spiv/bzr/rename-init_ex-verb into lp:~bzr/bzr/trunk-old

Proposed by Andrew Bennetts
Status: Merged
Merged at revision: not available
Proposed branch: lp:~spiv/bzr/rename-init_ex-verb
Merge into: lp:~bzr/bzr/trunk-old
Diff against target: 117 lines
To merge this branch: bzr merge lp:~spiv/bzr/rename-init_ex-verb
Reviewer Review Type Date Requested Status
Martin Pool Approve
Review via email: mp+7366@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Andrew Bennetts (spiv) wrote :

As discussed on IRC between jml, myself and lifeless: rename the
BzrDirFormat.initialize_ex verb to BzrDirFormat.initialize_ex_1.16 to avoid
issues with 1.15 clients expecting the old (and broken) behaviour.

Revision history for this message
Martin Pool (mbp) wrote :

I didn't follow the discussion in detail but the patch and reasoning seems ok. I presume you manually tested against an older server?

I think we're getting to the point where we should accept reality and just make the client and server know each other's versions. Just going by actual capabilities is very nice in theory, but it's not what we actually do. Guessing the version from the capabilities is the worst of both.

review: Approve
Revision history for this message
Robert Collins (lifeless) wrote :

On Fri, 2009-06-12 at 02:15 +0000, Martin Pool wrote:
> Review: Approve
> I didn't follow the discussion in detail but the patch and reasoning seems ok. I presume you manually tested against an older server?
>
> I think we're getting to the point where we should accept reality and just make the client and server know each other's versions. Just going by actual capabilities is very nice in theory, but it's not what we actually do. Guessing the version from the capabilities is the worst of both.

FWIW version numbers in the client wouldn't have helped; They may have
helped in the server, but it would have been complex given our code
structure.

-Rob

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS'
--- NEWS 2009-06-12 01:11:00 +0000
+++ NEWS 2009-06-12 02:35:22 +0000
@@ -113,6 +113,15 @@
113* Fix rule handling so that eol is optional, not mandatory.113* Fix rule handling so that eol is optional, not mandatory.
114 (Ian Clatworthy, #379370)114 (Ian Clatworthy, #379370)
115115
116* Pushing a new stacked branch to a 1.15 smart server was broken due to a
117 bug in the ``BzrDirFormat.initialize_ex`` smart verb. This is fixed in
118 1.16, but required changes to the network protocol, so the
119 ``BzrDirFormat.initialize_ex`` verb has been removed and replaced with a
120 corrected ``BzrDirFormat.initialize_ex_1.16`` verb. 1.15 clients will
121 still work with a 1.16 server as they will fallback to slower (and
122 bug-free) methods.
123 (Jonathan Lange, Robert Collins, Andrew Bennetts, #385132)
124
116* Reconcile can now deal with text revisions that originated in revisions 125* Reconcile can now deal with text revisions that originated in revisions
117 that are ghosts. (Jelmer Vernooij, #336749)126 that are ghosts. (Jelmer Vernooij, #336749)
118127
119128
=== modified file 'bzrlib/bzrdir.py'
--- bzrlib/bzrdir.py 2009-06-12 01:11:00 +0000
+++ bzrlib/bzrdir.py 2009-06-12 02:35:22 +0000
@@ -3175,7 +3175,7 @@
3175 if not do_vfs:3175 if not do_vfs:
3176 client = _SmartClient(client_medium)3176 client = _SmartClient(client_medium)
3177 path = client.remote_path_from_transport(transport)3177 path = client.remote_path_from_transport(transport)
3178 if client_medium._is_remote_before((1, 15)):3178 if client_medium._is_remote_before((1, 16)):
3179 do_vfs = True3179 do_vfs = True
3180 if do_vfs:3180 if do_vfs:
3181 # TODO: lookup the local format from a server hint.3181 # TODO: lookup the local format from a server hint.
@@ -3215,9 +3215,10 @@
3215 self._network_name = \3215 self._network_name = \
3216 BzrDirFormat.get_default_format().network_name()3216 BzrDirFormat.get_default_format().network_name()
3217 try:3217 try:
3218 response = client.call('BzrDirFormat.initialize_ex',3218 response = client.call('BzrDirFormat.initialize_ex_1.16',
3219 self.network_name(), path, *args)3219 self.network_name(), path, *args)
3220 except errors.UnknownSmartMethod:3220 except errors.UnknownSmartMethod:
3221 client._medium._remember_remote_is_before((1,16))
3221 local_dir_format = BzrDirMetaFormat1()3222 local_dir_format = BzrDirMetaFormat1()
3222 self._supply_sub_formats_to(local_dir_format)3223 self._supply_sub_formats_to(local_dir_format)
3223 return local_dir_format.initialize_on_transport_ex(transport,3224 return local_dir_format.initialize_on_transport_ex(transport,
32243225
=== modified file 'bzrlib/smart/bzrdir.py'
--- bzrlib/smart/bzrdir.py 2009-06-11 10:11:34 +0000
+++ bzrlib/smart/bzrdir.py 2009-06-12 02:35:22 +0000
@@ -354,7 +354,10 @@
354 def do(self, bzrdir_network_name, path, use_existing_dir, create_prefix,354 def do(self, bzrdir_network_name, path, use_existing_dir, create_prefix,
355 force_new_repo, stacked_on, stack_on_pwd, repo_format_name,355 force_new_repo, stacked_on, stack_on_pwd, repo_format_name,
356 make_working_trees, shared_repo):356 make_working_trees, shared_repo):
357 """Initialize a bzrdir at path as per BzrDirFormat.initialize_ex357 """Initialize a bzrdir at path as per
358 BzrDirFormat.initialize_on_transport_ex.
359
360 New in 1.16. (Replaces BzrDirFormat.initialize_ex verb from 1.15).
358361
359 :return: return SuccessfulSmartServerResponse((repo_path, rich_root,362 :return: return SuccessfulSmartServerResponse((repo_path, rich_root,
360 tree_ref, external_lookup, repo_network_name,363 tree_ref, external_lookup, repo_network_name,
361364
=== modified file 'bzrlib/smart/request.py'
--- bzrlib/smart/request.py 2009-04-24 05:08:51 +0000
+++ bzrlib/smart/request.py 2009-06-12 02:35:22 +0000
@@ -492,7 +492,7 @@
492 'BzrDirFormat.initialize', 'bzrlib.smart.bzrdir',492 'BzrDirFormat.initialize', 'bzrlib.smart.bzrdir',
493 'SmartServerRequestInitializeBzrDir')493 'SmartServerRequestInitializeBzrDir')
494request_handlers.register_lazy(494request_handlers.register_lazy(
495 'BzrDirFormat.initialize_ex', 'bzrlib.smart.bzrdir',495 'BzrDirFormat.initialize_ex_1.16', 'bzrlib.smart.bzrdir',
496 'SmartServerRequestBzrDirInitializeEx')496 'SmartServerRequestBzrDirInitializeEx')
497request_handlers.register_lazy(497request_handlers.register_lazy(
498 'BzrDir.open', 'bzrlib.smart.bzrdir', 'SmartServerRequestOpenBzrDir')498 'BzrDir.open', 'bzrlib.smart.bzrdir', 'SmartServerRequestOpenBzrDir')
499499
=== modified file 'bzrlib/tests/test_remote.py'
--- bzrlib/tests/test_remote.py 2009-06-10 03:56:49 +0000
+++ bzrlib/tests/test_remote.py 2009-06-12 02:35:22 +0000
@@ -750,7 +750,7 @@
750 transport = self.get_transport()750 transport = self.get_transport()
751 client = FakeClient(transport.base)751 client = FakeClient(transport.base)
752 client.add_expected_call(752 client.add_expected_call(
753 'BzrDirFormat.initialize_ex',753 'BzrDirFormat.initialize_ex_1.16',
754 (default_format_name, 'path', 'False', 'False', 'False', '',754 (default_format_name, 'path', 'False', 'False', 'False', '',
755 '', '', '', 'False'),755 '', '', '', 'False'),
756 'success',756 'success',
@@ -772,7 +772,7 @@
772 transport = self.get_transport()772 transport = self.get_transport()
773 client = FakeClient(transport.base)773 client = FakeClient(transport.base)
774 client.add_expected_call(774 client.add_expected_call(
775 'BzrDirFormat.initialize_ex',775 'BzrDirFormat.initialize_ex_1.16',
776 (default_format_name, 'path', 'False', 'False', 'False', '',776 (default_format_name, 'path', 'False', 'False', 'False', '',
777 '', '', '', 'False'),777 '', '', '', 'False'),
778 'error',778 'error',
779779
=== modified file 'bzrlib/tests/test_smart.py'
--- bzrlib/tests/test_smart.py 2009-06-11 07:10:44 +0000
+++ bzrlib/tests/test_smart.py 2009-06-12 02:35:22 +0000
@@ -351,7 +351,7 @@
351351
352352
353class TestSmartServerRequestBzrDirInitializeEx(tests.TestCaseWithMemoryTransport):353class TestSmartServerRequestBzrDirInitializeEx(tests.TestCaseWithMemoryTransport):
354 """Basic tests for BzrDir.initialize_ex in the smart server.354 """Basic tests for BzrDir.initialize_ex_1.16 in the smart server.
355355
356 The main unit tests in test_bzrdir exercise the API comprehensively.356 The main unit tests in test_bzrdir exercise the API comprehensively.
357 """357 """
@@ -1560,7 +1560,7 @@
1560 smart.bzrdir.SmartServerRequestFindRepositoryV2)1560 smart.bzrdir.SmartServerRequestFindRepositoryV2)
1561 self.assertHandlerEqual('BzrDirFormat.initialize',1561 self.assertHandlerEqual('BzrDirFormat.initialize',
1562 smart.bzrdir.SmartServerRequestInitializeBzrDir)1562 smart.bzrdir.SmartServerRequestInitializeBzrDir)
1563 self.assertHandlerEqual('BzrDirFormat.initialize_ex',1563 self.assertHandlerEqual('BzrDirFormat.initialize_ex_1.16',
1564 smart.bzrdir.SmartServerRequestBzrDirInitializeEx)1564 smart.bzrdir.SmartServerRequestBzrDirInitializeEx)
1565 self.assertHandlerEqual('BzrDir.cloning_metadir',1565 self.assertHandlerEqual('BzrDir.cloning_metadir',
1566 smart.bzrdir.SmartServerBzrDirRequestCloningMetaDir)1566 smart.bzrdir.SmartServerBzrDirRequestCloningMetaDir)