Rev 3509: Add Remote-v2 variant to branch/repository/bzrdir implementations in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Jun 25 06:21:32 BST 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3509
revision-id:pqm at pqm.ubuntu.com-20080625052120-j14uqsf6jlbg1lbb
parent: pqm at pqm.ubuntu.com-20080624011313-cq85foncf9mozmen
parent: andrew.bennetts at canonical.com-20080624225843-8e4tdnekeltv4g1j
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2008-06-25 06:21:20 +0100
message:
  Add Remote-v2 variant to branch/repository/bzrdir implementations
  	tests. (Andrew Bennetts)
modified:
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/smart/server.py         server.py-20061110062051-chzu10y32vx8gvur-1
  bzrlib/tests/branch_implementations/__init__.py __init__.py-20060123013057-b12a52c3f361daf4
  bzrlib/tests/bzrdir_implementations/__init__.py __init__.py-20060131065642-34c39b54f42dd048
  bzrlib/tests/repository_implementations/__init__.py __init__.py-20060131092037-9564957a7d4a841b
  bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
  bzrlib/transport/__init__.py   transport.py-20050711165921-4978aa7ce1285ad5
  bzrlib/transport/remote.py     ssh.py-20060608202016-c25gvf1ob7ypbus6-1
    ------------------------------------------------------------
    revno: 3453.4.4.1.10
    revision-id:andrew.bennetts at canonical.com-20080624225843-8e4tdnekeltv4g1j
    parent: andrew.bennetts at canonical.com-20080624225343-2r1potmqskvij8v2
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: old-hpss-branch-implementation-test
    timestamp: Wed 2008-06-25 08:58:43 +1000
    message:
      Fix test failures.
    modified:
      bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
    ------------------------------------------------------------
    revno: 3453.4.4.1.9
    revision-id:andrew.bennetts at canonical.com-20080624225343-2r1potmqskvij8v2
    parent: andrew.bennetts at canonical.com-20080618070236-x1eavwimpg8y4tff
    parent: pqm at pqm.ubuntu.com-20080624011313-cq85foncf9mozmen
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: old-hpss-branch-implementation-test
    timestamp: Wed 2008-06-25 08:53:43 +1000
    message:
      Merge from bzr.dev
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/index.py                index.py-20070712131115-lolkarso50vjr64s-1
      bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
      bzrlib/smart/medium.py         medium.py-20061103051856-rgu2huy59fkz902q-1
      bzrlib/tests/test_transport.py testtransport.py-20050718175618-e5cdb99f4555ddce
      bzrlib/tests/tree_implementations/__init__.py __init__.py-20060717075546-420s7b0bj9hzeowi-2
      bzrlib/tests/tree_implementations/test_tree.py test_tree.py-20061215160206-usu7lwcj8aq2n3br-1
      bzrlib/transport/__init__.py   transport.py-20050711165921-4978aa7ce1285ad5
      bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
    ------------------------------------------------------------
    revno: 3453.4.4.1.8
    revision-id:andrew.bennetts at canonical.com-20080618070236-x1eavwimpg8y4tff
    parent: andrew.bennetts at canonical.com-20080618010351-r4bju8oa7m9k8hxz
    parent: pqm at pqm.ubuntu.com-20080618051428-txnglk8ls5jd93fc
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: old-hpss-branch-implementation-test
    timestamp: Wed 2008-06-18 17:02:36 +1000
    message:
      Merge bzr.dev.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzr                            bzr.py-20050313053754-5485f144c7006fa6
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/decorators.py           decorators.py-20060112082512-6bfc2d882df1698d
      bzrlib/revisionspec.py         revisionspec.py-20050907152633-17567659fd5c0ddb
      bzrlib/tests/branch_implementations/test_revision_history.py test_revision_histor-20070326062311-v7co92liyuchb80w-1
      bzrlib/tests/test_decorators.py test_decorators.py-20060113063037-0e7bd4566758f4fa
      bzrlib/tests/test_lockdir.py   test_lockdir.py-20060220222025-33d4221569a3d600
      bzrlib/tests/test_revisionspec.py testrevisionnamespaces.py-20050711050225-8b4af89e6b1efe84
      bzrlib/tests/test_trace.py     testtrace.py-20051110225523-a21117fc7a07eeff
      bzrlib/trace.py                trace.py-20050309040759-c8ed824bdcd4748a
      doc/developers/releasing.txt   releasing.txt-20080502015919-fnrcav8fwy8ccibu-1
    ------------------------------------------------------------
    revno: 3453.4.4.1.7
    revision-id:andrew.bennetts at canonical.com-20080618010351-r4bju8oa7m9k8hxz
    parent: andrew.bennetts at canonical.com-20080618010118-ox8k0k08bnksnp23
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: old-hpss-branch-implementation-test
    timestamp: Wed 2008-06-18 11:03:51 +1000
    message:
      Fix error introduced by merge.
    modified:
      bzrlib/transport/remote.py     ssh.py-20060608202016-c25gvf1ob7ypbus6-1
    ------------------------------------------------------------
    revno: 3453.4.4.1.6
    revision-id:andrew.bennetts at canonical.com-20080618010118-ox8k0k08bnksnp23
    parent: andrew.bennetts at canonical.com-20080612000058-akw5xzm3hmqqg814
    parent: andrew.bennetts at canonical.com-20080618005845-3y0ae9qp05d48que
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: old-hpss-branch-implementation-test
    timestamp: Wed 2008-06-18 11:01:18 +1000
    message:
      Merge from make-branch-and-tree-fix.
    modified:
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/smart/client.py         client.py-20061116014825-2k6ada6xgulslami-1
      bzrlib/smart/medium.py         medium.py-20061103051856-rgu2huy59fkz902q-1
      bzrlib/tests/test_remote.py    test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
      bzrlib/tests/test_smart_transport.py test_ssh_transport.py-20060608202016-c25gvf1ob7ypbus6-2
      bzrlib/xml_serializer.py       xml.py-20050309040759-57d51586fdec365d
    ------------------------------------------------------------
    revno: 3453.4.4.1.5
    revision-id:andrew.bennetts at canonical.com-20080612000058-akw5xzm3hmqqg814
    parent: andrew.bennetts at canonical.com-20080611075635-asua1e59xzsxg4te
    parent: andrew.bennetts at canonical.com-20080612000017-rj3iicm3ftpv1fin
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: old-hpss-branch-implementation-test
    timestamp: Thu 2008-06-12 10:00:58 +1000
    message:
      Merge from make-branch-and-tree-fix.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/__init__.py             __init__.py-20050309040759-33e65acf91bbcd5d
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/diff.py                 diff.py-20050309040759-26944fbbf2ebbf36
      bzrlib/export/tar_exporter.py  tar_exporter.py-20051114235828-1f6349a2f090a5d0
      bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/smart/protocol.py       protocol.py-20061108035435-ot0lstk2590yqhzr-1
      bzrlib/tests/blackbox/test_export.py test_export.py-20051229024010-e6c26658e460fb1c
      bzrlib/tests/test_diff.py      testdiff.py-20050727164403-d1a3496ebb12e339
      bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
      bzrlib/tests/test_smart_transport.py test_ssh_transport.py-20060608202016-c25gvf1ob7ypbus6-2
      doc/developers/HACKING.txt     HACKING-20050805200004-2a5dc975d870f78c
      doc/developers/index.txt       index.txt-20070508041241-qznziunkg0nffhiw-1
      doc/developers/releasing.txt   releasing.txt-20080502015919-fnrcav8fwy8ccibu-1
      doc/index.txt                  index.txt-20070813101924-07gd9i9d2jt124bf-1
    ------------------------------------------------------------
    revno: 3453.4.4.1.4
    revision-id:andrew.bennetts at canonical.com-20080611075635-asua1e59xzsxg4te
    parent: andrew.bennetts at canonical.com-20080610075420-sjzf37kdpxcbra0d
    parent: andrew.bennetts at canonical.com-20080611075454-evxru0ssycsdywgd
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: old-hpss-branch-implementation-test
    timestamp: Wed 2008-06-11 17:56:35 +1000
    message:
      Merge from make-branch-and-tree-fix.
    modified:
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/branch_implementations/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
      bzrlib/tests/branch_implementations/test_check.py test_check.py-20080429151303-1sbfclxhddpz0tnj-1
      bzrlib/tests/branch_implementations/test_reconcile.py test_reconcile.py-20080429161555-qlmccuyeyt6pvho7-1
    ------------------------------------------------------------
    revno: 3453.4.4.1.3
    revision-id:andrew.bennetts at canonical.com-20080610075420-sjzf37kdpxcbra0d
    parent: andrew.bennetts at canonical.com-20080605230341-33kb0jzhn8wi3glg
    parent: andrew.bennetts at canonical.com-20080610074115-e4isop261jrba6ip
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: old-hpss-branch-implementation-test
    timestamp: Tue 2008-06-10 17:54:20 +1000
    message:
      Merge make-branch-and-tree-fix.
    added:
      bzrlib/tests/blackbox/test_alias.py test_alias.py-20080425112253-fbt0yz1c1834jriz-1
      bzrlib/tests/blackbox/test_modified.py test_modified.py-20080424085848-nwqjenan4dq2vq3w-1
      bzrlib/tests/per_repository_reference/ repository_external_-20080220025549-nnm2s80it1lvcwnc-1
      bzrlib/tests/per_repository_reference/__init__.py __init__.py-20080220025549-nnm2s80it1lvcwnc-2
      bzrlib/tests/per_repository_reference/test_add_inventory.py test_add_inventory.p-20080220025549-nnm2s80it1lvcwnc-3
      bzrlib/tests/per_repository_reference/test_add_revision.py test_add_revision.py-20080220034108-ao1u8qgakqbo5a08-1
      bzrlib/tests/per_repository_reference/test_add_signature_text.py test_add_signature_t-20080220041905-1j2g4lyz3c6h34v4-1
      bzrlib/tests/per_repository_reference/test_all_revision_ids.py test_all_revision_id-20080220041905-1j2g4lyz3c6h34v4-2
      bzrlib/tests/per_repository_reference/test_break_lock.py test_break_lock.py-20080220042825-1f48qmpnuqqp5wg2-1
      bzrlib/tests/per_repository_reference/test_check.py test_check.py-20080220044229-sxxe747gzi6q8fyv-1
    renamed:
      doc/en/user-guide/revnos.txt => doc/en/user-guide/zen.txt revnos.txt-20080111231928-pbntxea0ynh9ww1t-1
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/check.py                check.py-20050309040759-f3a679400c06bcc1
      bzrlib/config.py               config.py-20051011043216-070c74f4e9e338e8
      bzrlib/counted_lock.py         counted_lock.py-20070502135927-7dk86io3ok7ctx6k-1
      bzrlib/dirstate.py             dirstate.py-20060728012006-d6mvoihjb3je9peu-1
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/fetch.py                fetch.py-20050818234941-26fea6105696365d
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
      bzrlib/merge_directive.py      merge_directive.py-20070228184838-ja62280spt1g7f4x-1
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/tag.py                  tag.py-20070212110532-91cw79inah2cfozx-1
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/blackbox/__init__.py __init__.py-20051128053524-eba30d8255e08dc3
      bzrlib/tests/blackbox/test_added.py test_added.py-20060119085008-6b8b90369d42a26c
      bzrlib/tests/blackbox/test_non_ascii.py test_non_ascii.py-20060105214030-68010be784a5d854
      bzrlib/tests/blackbox/test_unknowns.py test_unknowns.py-20070905015344-74tg6s1synijo2oe-1
      bzrlib/tests/branch_implementations/test_pull.py test_pull.py-20060410103942-83c35b26657414fc
      bzrlib/tests/http_server.py    httpserver.py-20061012142527-m1yxdj1xazsf8d7s-1
      bzrlib/tests/repository_implementations/__init__.py __init__.py-20060131092037-9564957a7d4a841b
      bzrlib/tests/test_config.py    testconfig.py-20051011041908-742d0c15d8d8c8eb
      bzrlib/tests/test_counted_lock.py test_counted_lock.py-20070502135927-7dk86io3ok7ctx6k-2
      bzrlib/tests/test_diff.py      testdiff.py-20050727164403-d1a3496ebb12e339
      bzrlib/tests/test_dirstate.py  test_dirstate.py-20060728012006-d6mvoihjb3je9peu-2
      bzrlib/tests/test_lockable_files.py test_lockable_files.py-20051225183927-365c7fd99591caf1
      bzrlib/tests/test_merge_directive.py test_merge_directive-20070228184838-ja62280spt1g7f4x-2
      bzrlib/tests/test_msgeditor.py test_msgeditor.py-20051202041359-920315ec6011ee51
      bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
      bzrlib/tests/test_transport_implementations.py test_transport_implementations.py-20051227111451-f97c5c7d5c49fce7
      bzrlib/tests/test_versionedfile.py test_versionedfile.py-20060222045249-db45c9ed14a1c2e5
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
      bzrlib/transport/__init__.py   transport.py-20050711165921-4978aa7ce1285ad5
      bzrlib/versionedfile.py        versionedfile.py-20060222045106-5039c71ee3b65490
      bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
      contrib/bzr_access             bzr_access-20071210163004-c9lb1renhra2ncg0-1
      doc/en/user-guide/core_concepts.txt core_concepts.txt-20071114035000-q36a9h57ps06uvnl-2
      doc/en/user-guide/index.txt    index.txt-20060622101119-tgwtdci8z769bjb9-2
      doc/en/user-guide/zen.txt      revnos.txt-20080111231928-pbntxea0ynh9ww1t-1
    ------------------------------------------------------------
    revno: 3453.4.4.1.2
    revision-id:andrew.bennetts at canonical.com-20080605230341-33kb0jzhn8wi3glg
    parent: andrew.bennetts at canonical.com-20080605225642-0twch8sh5q6h0bw4
    parent: andrew.bennetts at canonical.com-20080605230057-raqbjdzpzvu4emf8
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: old-hpss-branch-implementation-test
    timestamp: Fri 2008-06-06 09:03:41 +1000
    message:
      Merge from remote-is-at-least.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/__init__.py             __init__.py-20050309040759-33e65acf91bbcd5d
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/lockdir.py              lockdir.py-20060220222025-98258adf27fbdda3
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/tests/blackbox/test_uncommit.py test_uncommit.py-20051027212835-84944b63adae51be
      bzrlib/tests/branch_implementations/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
      bzrlib/tests/test_branch.py    test_branch.py-20060116013032-97819aa07b8ab3b5
      bzrlib/tests/test_lockdir.py   test_lockdir.py-20060220222025-33d4221569a3d600
      bzrlib/tests/test_switch.py    test_switch.py-20071116011000-v5lnw7d2wkng9eux-2
      bzrlib/tests/test_transport_implementations.py test_transport_implementations.py-20051227111451-f97c5c7d5c49fce7
      bzrlib/tests/test_workingtree_4.py test_workingtree_4.p-20070223025758-531n3tznl3zacv2o-1
      bzrlib/tests/workingtree_implementations/test_parents.py test_set_parents.py-20060807231740-yicmnlci1mj8smu1-1
      bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
      bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
    ------------------------------------------------------------
    revno: 3453.4.4.1.1
    revision-id:andrew.bennetts at canonical.com-20080605225642-0twch8sh5q6h0bw4
    parent: andrew.bennetts at canonical.com-20080603224305-qmk0zbwc8kieqlbm
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: old-hpss-branch-implementation-test
    timestamp: Fri 2008-06-06 08:56:42 +1000
    message:
      Add {bzrdir,repository,branch}_implementations tests for Remote objects using protocol v2 and pre-1.6 RPCs.
    modified:
      bzrlib/fetch.py                fetch.py-20050818234941-26fea6105696365d
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/smart/server.py         server.py-20061110062051-chzu10y32vx8gvur-1
      bzrlib/tests/branch_implementations/__init__.py __init__.py-20060123013057-b12a52c3f361daf4
      bzrlib/tests/bzrdir_implementations/__init__.py __init__.py-20060131065642-34c39b54f42dd048
      bzrlib/tests/repository_implementations/__init__.py __init__.py-20060131092037-9564957a7d4a841b
      bzrlib/transport/__init__.py   transport.py-20050711165921-4978aa7ce1285ad5
      bzrlib/transport/remote.py     ssh.py-20060608202016-c25gvf1ob7ypbus6-1
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2008-06-10 05:05:40 +0000
+++ b/bzrlib/repository.py	2008-06-10 07:54:20 +0000
@@ -2966,7 +2966,7 @@
 
     def fetch(self, revision_id=None, pb=None, find_ghosts=False):
         self._ensure_real_inter()
-        self._real_inter.fetch(revision_id=revision_id, pb=pb,
+        return self._real_inter.fetch(revision_id=revision_id, pb=pb,
             find_ghosts=find_ghosts)
 
     @classmethod

=== modified file 'bzrlib/smart/server.py'
--- a/bzrlib/smart/server.py	2008-05-16 05:55:23 +0000
+++ b/bzrlib/smart/server.py	2008-06-05 22:56:42 +0000
@@ -275,3 +275,25 @@
         """Get a backing transport from a server we are decorating."""
         url = 'readonly+' + backing_transport_server.get_url()
         return transport.get_transport(url)
+
+
+class SmartTCPServer_for_testing_v2_only(SmartTCPServer_for_testing):
+    """A variation of SmartTCPServer_for_testing that limits the client to
+    using RPCs in protocol v2 (i.e. bzr <= 1.5).
+    """
+
+    def get_url(self):
+        url = super(SmartTCPServer_for_testing_v2_only, self).get_url()
+        url = 'bzr-v2://' + url[len('bzr://'):]
+        return url
+
+
+class ReadonlySmartTCPServer_for_testing_v2_only(SmartTCPServer_for_testing_v2_only):
+    """Get a readonly server for testing."""
+
+    def get_backing_transport(self, backing_transport_server):
+        """Get a backing transport from a server we are decorating."""
+        url = 'readonly+' + backing_transport_server.get_url()
+        return transport.get_transport(url)
+
+

=== modified file 'bzrlib/tests/branch_implementations/__init__.py'
--- a/bzrlib/tests/branch_implementations/__init__.py	2008-04-30 20:09:39 +0000
+++ b/bzrlib/tests/branch_implementations/__init__.py	2008-06-05 22:56:42 +0000
@@ -33,8 +33,10 @@
                            )
 from bzrlib.remote import RemoteBranchFormat, RemoteBzrDirFormat
 from bzrlib.smart.server import (
+    ReadonlySmartTCPServer_for_testing,
+    ReadonlySmartTCPServer_for_testing_v2_only,
     SmartTCPServer_for_testing,
-    ReadonlySmartTCPServer_for_testing,
+    SmartTCPServer_for_testing_v2_only,
     )
 from bzrlib.tests.bzrdir_implementations.test_bzrdir import TestCaseWithBzrDir
 from bzrlib.transport.memory import MemoryServer
@@ -50,9 +52,10 @@
     """
 
     def __init__(self, transport_server, transport_readonly_server, formats,
-        vfs_transport_factory=None):
+        vfs_transport_factory=None, name_suffix=''):
         self._transport_server = transport_server
         self._transport_readonly_server = transport_readonly_server
+        self._name_suffix = name_suffix
         self.scenarios = self.formats_to_scenarios(formats)
     
     def formats_to_scenarios(self, formats):
@@ -66,6 +69,7 @@
             # so we have a conditional here to handle them.
             scenario_name = getattr(branch_format, '__name__',
                 branch_format.__class__.__name__)
+            scenario_name += self._name_suffix
             scenario = (scenario_name, {
                 "transport_server":self._transport_server,
                 "transport_readonly_server":self._transport_readonly_server,
@@ -178,12 +182,26 @@
     # add the tests for the sub modules
     tests.adapt_modules(test_branch_implementations, adapter, loader, result)
 
+    # Add RemoteBranch tests, which need a special server.
     adapt_to_smart_server = BranchTestProviderAdapter(
         SmartTCPServer_for_testing,
         ReadonlySmartTCPServer_for_testing,
         [(RemoteBranchFormat(), RemoteBzrDirFormat())],
-        MemoryServer
-        )
+        MemoryServer,
+        name_suffix='-default')
+    tests.adapt_modules(test_branch_implementations,
+                        adapt_to_smart_server,
+                        loader,
+                        result)
+
+    # Also add tests for RemoteBranch with HPSS protocol v2 (i.e. bzr <1.6)
+    # server.
+    adapt_to_smart_server = BranchTestProviderAdapter(
+        SmartTCPServer_for_testing_v2_only,
+        ReadonlySmartTCPServer_for_testing_v2_only,
+        [(RemoteBranchFormat(), RemoteBzrDirFormat())],
+        MemoryServer,
+        name_suffix='-v2')
     tests.adapt_modules(test_branch_implementations,
                         adapt_to_smart_server,
                         loader,

=== modified file 'bzrlib/tests/bzrdir_implementations/__init__.py'
--- a/bzrlib/tests/bzrdir_implementations/__init__.py	2008-04-28 08:57:45 +0000
+++ b/bzrlib/tests/bzrdir_implementations/__init__.py	2008-06-05 22:56:42 +0000
@@ -44,7 +44,7 @@
     """
 
     def __init__(self, vfs_factory, transport_server, transport_readonly_server,
-        formats):
+        formats, name_suffix=''):
         """Create an object to adapt tests.
 
         :param vfs_server: A factory to create a Transport Server which has
@@ -53,6 +53,7 @@
         self._vfs_factory = vfs_factory
         self._transport_server = transport_server
         self._transport_readonly_server = transport_readonly_server
+        self._name_suffix = name_suffix
         self.scenarios = self.formats_to_scenarios(formats)
     
     def formats_to_scenarios(self, formats):
@@ -62,7 +63,9 @@
         """
         result = []
         for format in formats:
-            scenario = (format.__class__.__name__, {
+            scenario_name = format.__class__.__name__
+            scenario_name += self._name_suffix
+            scenario = (scenario_name, {
                 "vfs_transport_factory":self._vfs_factory,
                 "transport_server":self._transport_server,
                 "transport_readonly_server":self._transport_readonly_server,
@@ -112,8 +115,10 @@
     # This will always add the tests for smart server transport, regardless of
     # the --transport option the user specified to 'bzr selftest'.
     from bzrlib.smart.server import (
+        ReadonlySmartTCPServer_for_testing,
+        ReadonlySmartTCPServer_for_testing_v2_only,
         SmartTCPServer_for_testing,
-        ReadonlySmartTCPServer_for_testing,
+        SmartTCPServer_for_testing_v2_only,
         )
     from bzrlib.remote import RemoteBzrDirFormat
 
@@ -123,7 +128,18 @@
         MemoryServer,
         SmartTCPServer_for_testing,
         ReadonlySmartTCPServer_for_testing,
-        [(RemoteBzrDirFormat())])
+        [(RemoteBzrDirFormat())],
+        name_suffix='-default')
+    adapt_modules(test_bzrdir_implementations,
+                  adapt_to_smart_server,
+                  loader,
+                  smart_server_suite)
+    adapt_to_smart_server = BzrDirTestProviderAdapter(
+        MemoryServer,
+        SmartTCPServer_for_testing_v2_only,
+        ReadonlySmartTCPServer_for_testing_v2_only,
+        [(RemoteBzrDirFormat())],
+        name_suffix='-v2')
     adapt_modules(test_bzrdir_implementations,
                   adapt_to_smart_server,
                   loader,

=== modified file 'bzrlib/tests/repository_implementations/__init__.py'
--- a/bzrlib/tests/repository_implementations/__init__.py	2008-06-06 08:20:03 +0000
+++ b/bzrlib/tests/repository_implementations/__init__.py	2008-06-10 07:54:20 +0000
@@ -33,8 +33,10 @@
     )
 from bzrlib.remote import RemoteBzrDirFormat, RemoteRepositoryFormat
 from bzrlib.smart.server import (
+    ReadonlySmartTCPServer_for_testing,
+    ReadonlySmartTCPServer_for_testing_v2_only,
     SmartTCPServer_for_testing,
-    ReadonlySmartTCPServer_for_testing,
+    SmartTCPServer_for_testing_v2_only,
     )
 from bzrlib.tests import (
                           adapt_modules,
@@ -52,12 +54,14 @@
     vfs_transport_factory=None):
     """Transform the input formats to a list of scenarios.
 
-    :param formats: A list of (scenario_name, scenario_info)
+    :param formats: A list of (scenario_name_suffix, repo_format, bzrdir_format)
         where the scenario_info is a dict that controls the test.
     """
     result = []
-    for repository_format, bzrdir_format in formats:
-        scenario = (repository_format.__class__.__name__,
+    for scenario_name_suffix, repository_format, bzrdir_format in formats:
+        scenario_name = repository_format.__class__.__name__
+        scenario_name += scenario_name_suffix
+        scenario = (scenario_name,
             {"transport_server":transport_server,
              "transport_readonly_server":transport_readonly_server,
              "bzrdir_format":bzrdir_format,
@@ -73,9 +77,6 @@
 
 def all_repository_format_scenarios():
     """Return a list of test scenarios for parameterising repository tests.
-    
-    :param formats: A list of (scenario_name, scenario_info)
-        where the scenario_info is a dict that controls the test.
     """
     registry = repository.format_registry
     all_formats = [registry.get(k) for k in registry.keys()]
@@ -83,16 +84,21 @@
     # format_scenarios is all the implementations of Repository; i.e. all disk
     # formats plus RemoteRepository.
     format_scenarios = formats_to_scenarios(
-        [(format, format._matchingbzrdir) for format in all_formats],
+        [('', format, format._matchingbzrdir) for format in all_formats],
         default_transport,
         # None here will cause a readonly decorator to be created
         # by the TestCaseWithTransport.get_readonly_transport method.
         None)
     format_scenarios.extend(formats_to_scenarios(
-        [(RemoteRepositoryFormat(), RemoteBzrDirFormat())],
+        [('-default', RemoteRepositoryFormat(), RemoteBzrDirFormat())],
         SmartTCPServer_for_testing,
         ReadonlySmartTCPServer_for_testing,
         MemoryServer))
+    format_scenarios.extend(formats_to_scenarios(
+        [('-v2', RemoteRepositoryFormat(), RemoteBzrDirFormat())],
+        SmartTCPServer_for_testing_v2_only,
+        ReadonlySmartTCPServer_for_testing_v2_only,
+        MemoryServer))
     return format_scenarios
 
 

=== modified file 'bzrlib/tests/test_selftest.py'
--- a/bzrlib/tests/test_selftest.py	2008-06-06 13:56:24 +0000
+++ b/bzrlib/tests/test_selftest.py	2008-06-24 22:58:43 +0000
@@ -241,18 +241,18 @@
         """The vfs_transport_factory can be set optionally."""
         from bzrlib.tests.repository_implementations import formats_to_scenarios
         scenarios = formats_to_scenarios(
-            [("a", "b"), ("c", "d")],
+            [("(one)", "a", "b"), ("(two)", "c", "d")],
             None,
             None,
             vfs_transport_factory="vfs")
         self.assertEqual([
-            ('str',
+            ('str(one)',
              {'bzrdir_format': 'b',
               'repository_format': 'a',
               'transport_readonly_server': None,
               'transport_server': None,
               'vfs_transport_factory': 'vfs'}),
-            ('str',
+            ('str(two)',
              {'bzrdir_format': 'd',
               'repository_format': 'c',
               'transport_readonly_server': None,
@@ -263,32 +263,32 @@
     def test_formats_to_scenarios(self):
         """The adapter can generate all the scenarios needed."""
         from bzrlib.tests.repository_implementations import formats_to_scenarios
-        formats = [("c", "C"), (1, "D")]
+        formats = [("(c)", "c", "C"), ("(d)", 1, "D")]
         no_vfs_scenarios = formats_to_scenarios(formats, "server", "readonly",
             None)
         vfs_scenarios = formats_to_scenarios(formats, "server", "readonly",
             vfs_transport_factory="vfs")
         # no_vfs generate scenarios without vfs_transport_factor
         self.assertEqual([
-            ('str',
+            ('str(c)',
              {'bzrdir_format': 'C',
               'repository_format': 'c',
               'transport_readonly_server': 'readonly',
               'transport_server': 'server'}),
-            ('int',
+            ('int(d)',
              {'bzrdir_format': 'D',
               'repository_format': 1,
               'transport_readonly_server': 'readonly',
               'transport_server': 'server'})],
             no_vfs_scenarios)
         self.assertEqual([
-            ('str',
+            ('str(c)',
              {'bzrdir_format': 'C',
               'repository_format': 'c',
               'transport_readonly_server': 'readonly',
               'transport_server': 'server',
               'vfs_transport_factory': 'vfs'}),
-            ('int',
+            ('int(d)',
              {'bzrdir_format': 'D',
               'repository_format': 1,
               'transport_readonly_server': 'readonly',

=== modified file 'bzrlib/transport/__init__.py'
--- a/bzrlib/transport/__init__.py	2008-06-19 06:57:22 +0000
+++ b/bzrlib/transport/__init__.py	2008-06-24 22:53:43 +0000
@@ -1772,6 +1772,10 @@
 
 register_lazy_transport('bzr://', 'bzrlib.transport.remote',
                         'RemoteTCPTransport')
+register_transport_proto('bzr-v2://', register_netloc=True)
+
+register_lazy_transport('bzr-v2://', 'bzrlib.transport.remote',
+                        'RemoteTCPTransportV2Only')
 register_transport_proto('bzr+http://',
 #                help="Fast access using the Bazaar smart server over HTTP."
                          register_netloc=True)

=== modified file 'bzrlib/transport/remote.py'
--- a/bzrlib/transport/remote.py	2008-05-19 11:20:29 +0000
+++ b/bzrlib/transport/remote.py	2008-06-18 01:03:51 +0000
@@ -475,6 +475,21 @@
         return client_medium, None
 
 
+class RemoteTCPTransportV2Only(RemoteTransport):
+    """Connection to smart server over plain tcp with the client hard-coded to
+    assume protocol v2 and remote server version <= 1.6.
+
+    This should only be used for testing.
+    """
+
+    def _build_medium(self):
+        client_medium = medium.SmartTCPClientMedium(
+            self._host, self._port, self.base)
+        client_medium._protocol_version = 2
+        client_medium._remember_remote_is_before((1, 6))
+        return client_medium, None
+
+
 class RemoteSSHTransport(RemoteTransport):
     """Connection to smart server over SSH.
 




More information about the bazaar-commits mailing list