Rev 4083: (andrew) Skip less Remote* tests in test_bzrdir, in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu Mar 5 23:23:05 GMT 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4083
revision-id: pqm at pqm.ubuntu.com-20090305232301-81w9o9ib70oe7dio
parent: pqm at pqm.ubuntu.com-20090305212433-54adz2sk2taghu7d
parent: andrew.bennetts at canonical.com-20090305140050-5eetlqzebb43ivri
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2009-03-05 23:23:01 +0000
message:
(andrew) Skip less Remote* tests in test_bzrdir,
and fix cloning_metadir RPC to work with branch references.
modified:
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/smart/bzrdir.py bzrdir.py-20061122024551-ol0l0o0oofsu9b3t-1
bzrlib/tests/bzrdir_implementations/test_bzrdir.py test_bzrdir.py-20060131065642-0ebeca5e30e30866
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
bzrlib/tests/test_smart.py test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
------------------------------------------------------------
revno: 4070.7.6
revision-id: andrew.bennetts at canonical.com-20090305140050-5eetlqzebb43ivri
parent: andrew.bennetts at canonical.com-20090305054504-u0or723wfgv3ub1q
parent: pqm at pqm.ubuntu.com-20090305091217-h813qd8f83wghtpr
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: less-skips
timestamp: Fri 2009-03-06 01:00:50 +1100
message:
Merge bzr.dev.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/branchbuilder.py branchbuilder.py-20070427022007-zlxpqz2lannhk6y8-1
bzrlib/log.py log.py-20050505065812-c40ce11702fe5fb1
bzrlib/smart/protocol.py protocol.py-20061108035435-ot0lstk2590yqhzr-1
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tests/blackbox/test_logformats.py test_logformats.py-20060216104208-ba5a16c83480b7e4
bzrlib/tests/test_branchbuilder.py test_branchbuilder.p-20070427022007-zlxpqz2lannhk6y8-2
bzrlib/tests/test_smart_transport.py test_ssh_transport.py-20060608202016-c25gvf1ob7ypbus6-2
bzrlib/transport/trace.py trace.py-20070828055009-7kt0bbc4t4b92apz-1
doc/developers/testing.txt testing.txt-20080812140359-i70zzh6v2z7grqex-1
------------------------------------------------------------
revno: 4070.7.5
revision-id: andrew.bennetts at canonical.com-20090305054504-u0or723wfgv3ub1q
parent: andrew.bennetts at canonical.com-20090305043703-b9svfiz2ysr2z109
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: less-skips
timestamp: Thu 2009-03-05 16:45:04 +1100
message:
Tweak comment.
modified:
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
------------------------------------------------------------
revno: 4070.7.4
revision-id: andrew.bennetts at canonical.com-20090305043703-b9svfiz2ysr2z109
parent: andrew.bennetts at canonical.com-20090305015028-a8fi604clhl8yjwm
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: less-skips
timestamp: Thu 2009-03-05 15:37:03 +1100
message:
Deal with branch references better in BzrDir.cloning_metadir RPC (changes protocol).
modified:
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/smart/bzrdir.py bzrdir.py-20061122024551-ol0l0o0oofsu9b3t-1
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
bzrlib/tests/test_smart.py test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
------------------------------------------------------------
revno: 4070.7.3
revision-id: andrew.bennetts at canonical.com-20090305015028-a8fi604clhl8yjwm
parent: andrew.bennetts at canonical.com-20090304232813-rd4gxw1z94xu8r3w
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: less-skips
timestamp: Thu 2009-03-05 12:50:28 +1100
message:
Make the sprout_bzrdir_branch_reference tests pass by returning an error from the cloning_metadir RPC which triggers a VFS fallback on the client.
modified:
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/smart/bzrdir.py bzrdir.py-20061122024551-ol0l0o0oofsu9b3t-1
bzrlib/tests/bzrdir_implementations/test_bzrdir.py test_bzrdir.py-20060131065642-0ebeca5e30e30866
------------------------------------------------------------
revno: 4070.7.2
revision-id: andrew.bennetts at canonical.com-20090304232813-rd4gxw1z94xu8r3w
parent: andrew.bennetts at canonical.com-20090304041327-oopxigpa9c64h9xz
parent: pqm at pqm.ubuntu.com-20090304163710-r7hhqdi9f3jsbe5g
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: less-skips
timestamp: Thu 2009-03-05 10:28:13 +1100
message:
Merge from bzr.dev.
added:
doc/developers/ec2-windows.txt ec2windows.txt-20090219062112-2ga0nqpcm7n02njf-1
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/annotate.py annotate.py-20050922133147-7c60541d2614f022
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
bzrlib/commit.py commit.py-20050511101309-79ec1a0168e0e825
bzrlib/log.py log.py-20050505065812-c40ce11702fe5fb1
bzrlib/mail_client.py mail_client.py-20070809192806-vuxt3t19srtpjpdn-1
bzrlib/mutabletree.py mutabletree.py-20060906023413-4wlkalbdpsxi2r4y-2
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/revision.py revision.py-20050309040759-e77802c08f3999d5
bzrlib/smart/bzrdir.py bzrdir.py-20061122024551-ol0l0o0oofsu9b3t-1
bzrlib/smart/request.py request.py-20061108095550-gunadhxmzkdjfeek-1
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tests/blackbox/test_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
bzrlib/tests/blackbox/test_commit.py test_commit.py-20060212094538-ae88fc861d969db0
bzrlib/tests/branch_implementations/test_last_revision_info.py test_last_revision_i-20070201133317-51mzi40m8hv1i0i9-1
bzrlib/tests/branch_implementations/test_push.py test_push.py-20070130153159-fhfap8uoifevg30j-1
bzrlib/tests/branch_implementations/test_sprout.py test_sprout.py-20070521151739-b8t8p7axw1h966ws-1
bzrlib/tests/bzrdir_implementations/test_bzrdir.py test_bzrdir.py-20060131065642-0ebeca5e30e30866
bzrlib/tests/test_annotate.py test_annotate.py-20061213215015-sttc9agsxomls7q0-1
bzrlib/tests/test_commit.py test_commit.py-20050914060732-279f057f8c295434
bzrlib/tests/test_log.py testlog.py-20050728115707-1a514809d7d49309
bzrlib/tests/test_options.py testoptions.py-20051014093702-96457cfc86319a8f
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
bzrlib/tests/test_revision.py testrevision.py-20050804210559-46f5e1eb67b01289
bzrlib/tests/test_smart.py test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
bzrlib/ui/text.py text.py-20051130153916-2e438cffc8afc478
doc/developers/index.txt index.txt-20070508041241-qznziunkg0nffhiw-1
doc/developers/network-protocol.txt networkprotocol.txt-20070903044232-woustorrjbmg5zol-1
doc/developers/revision-properties.txt revisionproperties.t-20070807133526-w57m8zv5o7t5kugm-1
doc/en/user-guide/recording_changes.txt recording_changes.tx-20071121073725-0corxykv5irjal00-4
------------------------------------------------------------
revno: 4070.7.1
revision-id: andrew.bennetts at canonical.com-20090304041327-oopxigpa9c64h9xz
parent: pqm at pqm.ubuntu.com-20090302155409-89pygn9tisbc0lir
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: less-skips
timestamp: Wed 2009-03-04 15:13:27 +1100
message:
Cause 32 less test skips in bzrdir_implementations.test_bzrdir.
modified:
bzrlib/tests/bzrdir_implementations/test_bzrdir.py test_bzrdir.py-20060131065642-0ebeca5e30e30866
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py 2009-03-03 07:22:25 +0000
+++ b/bzrlib/remote.py 2009-03-05 05:45:04 +0000
@@ -154,15 +154,27 @@
return self._vfs_cloning_metadir(require_stacking=require_stacking)
if len(response) != 3:
raise errors.UnexpectedSmartServerResponse(response)
- control_name, repo_name, branch_name = response
+ control_name, repo_name, branch_info = response
+ if len(branch_info) != 2:
+ raise errors.UnexpectedSmartServerResponse(response)
+ branch_ref, branch_name = branch_info
# ICK: perhaps change these registries to be factories only?
format = bzrdir.network_format_registry.get(control_name).__class__()
if repo_name:
format.repository_format = repository.network_format_registry.get(
repo_name)
- if branch_name:
- format.set_branch_format(
- branch.network_format_registry.get(branch_name))
+ if branch_ref == 'reference':
+ # XXX: we need possible_transports here to avoid reopening the
+ # connection to the referenced location
+ ref_bzrdir = BzrDir.open(branch_name)
+ branch_format = ref_bzrdir.cloning_metadir().get_branch_format()
+ format.set_branch_format(branch_format)
+ elif branch_ref == 'direct':
+ if branch_name:
+ format.set_branch_format(
+ branch.network_format_registry.get(branch_name))
+ else:
+ raise errors.UnexpectedSmartServerResponse(response)
return format
def create_repository(self, shared=False):
=== modified file 'bzrlib/smart/bzrdir.py'
--- a/bzrlib/smart/bzrdir.py 2009-03-03 04:17:53 +0000
+++ b/bzrlib/smart/bzrdir.py 2009-03-05 04:37:03 +0000
@@ -90,6 +90,10 @@
def do_bzrdir_request(self, require_stacking):
"""Get the format that should be used when cloning from this dir."""
+ try:
+ branch_ref = self._bzrdir.get_branch_reference()
+ except errors.NotBranchError:
+ branch_ref = None
if require_stacking == "True":
require_stacking = True
else:
@@ -100,7 +104,13 @@
# XXX: There should be a method that tells us that the format does/does not
# have subformats.
if isinstance(control_format, BzrDirMetaFormat1):
- branch_name = control_format.get_branch_format().network_name()
+ if branch_ref is not None:
+ # If there's a branch reference, the client will have to resolve
+ # the branch reference to figure out the cloning metadir
+ branch_name = ('reference', branch_ref)
+ else:
+ branch_name = (
+ 'direct', control_format.get_branch_format().network_name())
repository_name = control_format.repository_format.network_name()
else:
# Only MetaDir has delegated formats today.
=== modified file 'bzrlib/tests/bzrdir_implementations/test_bzrdir.py'
--- a/bzrlib/tests/bzrdir_implementations/test_bzrdir.py 2009-03-03 03:27:51 +0000
+++ b/bzrlib/tests/bzrdir_implementations/test_bzrdir.py 2009-03-05 01:50:28 +0000
@@ -178,6 +178,14 @@
raise TestSkipped("bzrdir on transport %r has no working tree"
% a_bzrdir.transport)
+ def openWorkingTreeIfLocal(self, a_bzrdir):
+ """If a_bzrdir is on a local transport, call open_workingtree() on it.
+ """
+ if not isinstance(a_bzrdir.root_transport, LocalTransport):
+ # it's not local, but that's ok
+ return
+ a_bzrdir.open_workingtree()
+
def createWorkingTreeOrSkip(self, a_bzrdir):
"""Create a working tree on a_bzrdir, or raise TestSkipped.
@@ -688,12 +696,12 @@
def test_sprout_bzrdir_empty(self):
dir = self.make_bzrdir('source')
- target = self.sproutOrSkip(dir, self.get_url('target'))
+ target = dir.sprout(self.get_url('target'))
self.assertNotEqual(dir.transport.base, target.transport.base)
# creates a new repository branch and tree
target.open_repository()
target.open_branch()
- target.open_workingtree()
+ self.openWorkingTreeIfLocal(target)
def test_sprout_bzrdir_empty_under_shared_repo(self):
# sprouting an empty dir into a repo uses the repo
@@ -702,7 +710,7 @@
self.make_repository('target', shared=True)
except errors.IncompatibleFormat:
return
- target = self.sproutOrSkip(dir, self.get_url('target/child'))
+ target = dir.sprout(self.get_url('target/child'))
self.assertRaises(errors.NoRepositoryPresent, target.open_repository)
target.open_branch()
try:
@@ -720,11 +728,10 @@
self.make_repository('target', shared=True)
except errors.IncompatibleFormat:
return
- target = self.sproutOrSkip(dir, self.get_url('target/child'),
- force_new_repo=True)
+ target = dir.sprout(self.get_url('target/child'), force_new_repo=True)
target.open_repository()
target.open_branch()
- target.open_workingtree()
+ self.openWorkingTreeIfLocal(target)
def test_sprout_bzrdir_repository(self):
tree = self.make_branch_and_tree('commit_tree')
@@ -741,7 +748,7 @@
dir.open_branch().last_revision())))
except errors.NotBranchError:
pass
- target = self.sproutOrSkip(dir, self.get_url('target'))
+ target = dir.sprout(self.get_url('target'))
self.assertNotEqual(dir.transport.base, target.transport.base)
# testing inventory isn't reasonable for repositories
self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
@@ -779,7 +786,7 @@
shared_repo = self.make_repository('target', shared=True)
except errors.IncompatibleFormat:
return
- target = self.sproutOrSkip(dir, self.get_url('target/child'))
+ target = dir.sprout(self.get_url('target/child'))
self.assertNotEqual(dir.transport.base, target.transport.base)
self.assertTrue(shared_repo.has_revision('1'))
@@ -798,7 +805,7 @@
tree.branch.repository.copy_content_into(shared_repo)
dir = self.make_bzrdir('shared/source')
dir.create_branch()
- target = self.sproutOrSkip(dir, self.get_url('shared/target'))
+ target = dir.sprout(self.get_url('shared/target'))
self.assertNotEqual(dir.transport.base, target.transport.base)
self.assertNotEqual(dir.transport.base, shared_repo.bzrdir.transport.base)
self.assertTrue(shared_repo.has_revision('1'))
@@ -822,7 +829,7 @@
self.assertTrue(shared_repo.has_revision('1'))
dir = self.make_bzrdir('shared/source')
dir.create_branch()
- target = self.sproutOrSkip(dir, self.get_url('target'))
+ target = dir.sprout(self.get_url('target'))
self.assertNotEqual(dir.transport.base, target.transport.base)
self.assertNotEqual(dir.transport.base, shared_repo.bzrdir.transport.base)
branch = target.open_branch()
@@ -846,8 +853,7 @@
shared_repo = self.make_repository('target', shared=True)
except errors.IncompatibleFormat:
return
- target = self.sproutOrSkip(dir, self.get_url('target/child'),
- force_new_repo=True)
+ target = dir.sprout(self.get_url('target/child'), force_new_repo=True)
self.assertNotEqual(dir.transport.base, target.transport.base)
self.assertFalse(shared_repo.has_revision('1'))
@@ -878,7 +884,7 @@
tree.branch.repository.copy_content_into(source.repository)
tree.bzrdir.open_branch().copy_content_into(source)
dir = source.bzrdir
- target = self.sproutOrSkip(dir, self.get_url('target'))
+ target = dir.sprout(self.get_url('target'))
self.assertNotEqual(dir.transport.base, target.transport.base)
self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
[
@@ -910,7 +916,7 @@
shared_repo = self.make_repository('target', shared=True)
except errors.IncompatibleFormat:
return
- target = self.sproutOrSkip(dir, self.get_url('target/child'))
+ target = dir.sprout(self.get_url('target/child'))
self.assertTrue(shared_repo.has_revision('1'))
def test_sprout_bzrdir_branch_and_repo_shared_force_new_repo(self):
@@ -928,14 +934,13 @@
shared_repo = self.make_repository('target', shared=True)
except errors.IncompatibleFormat:
return
- target = self.sproutOrSkip(dir, self.get_url('target/child'),
- force_new_repo=True)
+ target = dir.sprout(self.get_url('target/child'), force_new_repo=True)
self.assertNotEqual(dir.transport.base, target.transport.base)
self.assertFalse(shared_repo.has_revision('1'))
def test_sprout_bzrdir_branch_reference(self):
# sprouting should create a repository if needed and a sprouted branch.
- referenced_branch = self.make_branch('referencced')
+ referenced_branch = self.make_branch('referenced')
dir = self.make_bzrdir('source')
try:
reference = bzrlib.branch.BranchReferenceFormat().initialize(dir,
@@ -944,7 +949,7 @@
# this is ok too, not all formats have to support references.
return
self.assertRaises(errors.NoRepositoryPresent, dir.open_repository)
- target = self.sproutOrSkip(dir, self.get_url('target'))
+ target = dir.sprout(self.get_url('target'))
self.assertNotEqual(dir.transport.base, target.transport.base)
# we want target to have a branch that is in-place.
self.assertEqual(target, target.open_branch().bzrdir)
@@ -968,7 +973,7 @@
shared_repo = self.make_repository('target', shared=True)
except errors.IncompatibleFormat:
return
- target = self.sproutOrSkip(dir, self.get_url('target/child'))
+ target = dir.sprout(self.get_url('target/child'))
self.assertNotEqual(dir.transport.base, target.transport.base)
# we want target to have a branch that is in-place.
self.assertEqual(target, target.open_branch().bzrdir)
@@ -994,8 +999,7 @@
shared_repo = self.make_repository('target', shared=True)
except errors.IncompatibleFormat:
return
- target = self.sproutOrSkip(dir, self.get_url('target/child'),
- force_new_repo=True)
+ target = dir.sprout(self.get_url('target/child'), force_new_repo=True)
self.assertNotEqual(dir.transport.base, target.transport.base)
# we want target to have a branch that is in-place.
self.assertEqual(target, target.open_branch().bzrdir)
@@ -1018,7 +1022,7 @@
tree.branch.repository.copy_content_into(source.repository)
tree.bzrdir.open_branch().copy_content_into(source)
dir = source.bzrdir
- target = self.sproutOrSkip(dir, self.get_url('target'), revision_id='1')
+ target = dir.sprout(self.get_url('target'), revision_id='1')
self.assertEqual('1', target.open_branch().last_revision())
def test_sprout_bzrdir_tree_branch_repo(self):
@@ -1059,7 +1063,7 @@
tree = self.createWorkingTreeOrSkip(dir)
self.build_tree(['source/subdir/'])
tree.add('subdir')
- target = self.sproutOrSkip(dir, self.get_url('target'))
+ target = dir.sprout(self.get_url('target'))
self.assertNotEqual(dir.transport.base, target.transport.base)
# we want target to have a branch that is in-place.
self.assertEqual(target, target.open_branch().bzrdir)
@@ -1133,12 +1137,11 @@
tree.commit('revision 2', rev_id='2', allow_pointless=True)
dir = tree.bzrdir
if isinstance(dir, (bzrdir.BzrDirPreSplitOut,)):
- self.assertRaises(errors.MustHaveWorkingTree, self.sproutOrSkip,
- dir, self.get_url('target'),
+ self.assertRaises(errors.MustHaveWorkingTree, dir.sprout,
+ self.get_url('target'),
create_tree_if_local=False)
return
- target = self.sproutOrSkip(dir, self.get_url('target'),
- create_tree_if_local=False)
+ target = dir.sprout(self.get_url('target'), create_tree_if_local=False)
self.failIfExists('target/foo')
self.assertEqual(tree.branch.last_revision(),
target.open_branch().last_revision())
=== modified file 'bzrlib/tests/test_remote.py'
--- a/bzrlib/tests/test_remote.py 2009-03-03 08:12:05 +0000
+++ b/bzrlib/tests/test_remote.py 2009-03-05 04:37:03 +0000
@@ -371,7 +371,7 @@
control_name = reference_bzrdir_format.network_name()
client.add_expected_call(
'BzrDir.cloning_metadir', ('quack/', 'False'),
- 'success', (control_name, '', '')),
+ 'success', (control_name, '', ('direct', ''))),
a_bzrdir = RemoteBzrDir(transport, remote.RemoteBzrDirFormat(),
_client=client)
result = a_bzrdir.cloning_metadir()
=== modified file 'bzrlib/tests/test_smart.py'
--- a/bzrlib/tests/test_smart.py 2009-03-03 03:27:51 +0000
+++ b/bzrlib/tests/test_smart.py 2009-03-05 04:37:03 +0000
@@ -177,7 +177,26 @@
expected = SuccessfulSmartServerResponse(
(local_result.network_name(),
local_result.repository_format.network_name(),
- local_result.get_branch_format().network_name()))
+ ('direct', local_result.get_branch_format().network_name())))
+ self.assertEqual(expected, request.execute('', 'False'))
+
+ def test_cloning_metadir_reference(self):
+ """The request works when bzrdir contains a branch reference."""
+ backing = self.get_transport()
+ referenced_branch = self.make_branch('referenced')
+ dir = self.make_bzrdir('.')
+ local_result = dir.cloning_metadir()
+ reference = BranchReferenceFormat().initialize(dir, referenced_branch)
+ reference_url = BranchReferenceFormat().get_reference(dir)
+ # The server shouldn't try to follow the branch reference, so it's fine
+ # if the referenced branch isn't reachable.
+ backing.rename('referenced', 'moved')
+ request_class = smart_dir.SmartServerBzrDirRequestCloningMetaDir
+ request = request_class(backing)
+ expected = SuccessfulSmartServerResponse(
+ (local_result.network_name(),
+ local_result.repository_format.network_name(),
+ ('reference', reference_url)))
self.assertEqual(expected, request.execute('', 'False'))
More information about the bazaar-commits
mailing list