Rev 3877: (jam) branch_format._matching_bzrdir.branch_format should always in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Mon Dec 1 23:50:56 GMT 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3877
revision-id: pqm at pqm.ubuntu.com-20081201235052-tlg1kksgj0kuya56
parent: pqm at pqm.ubuntu.com-20081201201721-zconkq0v7pow8nmw
parent: john at arbash-meinel.com-20081201211547-j1j916fkt5m1e957
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2008-12-01 23:50:52 +0000
message:
(jam) branch_format._matching_bzrdir.branch_format should always
match.
modified:
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/tests/branch_implementations/__init__.py __init__.py-20060123013057-b12a52c3f361daf4
bzrlib/tests/branch_implementations/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
bzrlib/tests/branch_implementations/test_sprout.py test_sprout.py-20070521151739-b8t8p7axw1h966ws-1
bzrlib/tests/branch_implementations/test_stacking.py test_stacking.py-20080214020755-msjlkb7urobwly0f-1
------------------------------------------------------------
revno: 3834.5.4
revision-id: john at arbash-meinel.com-20081201211547-j1j916fkt5m1e957
parent: john at arbash-meinel.com-20081118184909-1zzbag6llm5z1ucc
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: sprout_matching_bzrdir
timestamp: Mon 2008-12-01 15:15:47 -0600
message:
Skip the stack_on_repository test for BranchReference branches.
modified:
bzrlib/tests/branch_implementations/test_stacking.py test_stacking.py-20080214020755-msjlkb7urobwly0f-1
------------------------------------------------------------
revno: 3834.5.3
revision-id: john at arbash-meinel.com-20081118184909-1zzbag6llm5z1ucc
parent: john at arbash-meinel.com-20081118184304-9zsvcjp81ma63f04
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-integration
timestamp: Tue 2008-11-18 12:49:09 -0600
message:
Remove some asserts that are in the test_branch tests.
modified:
bzrlib/tests/branch_implementations/test_sprout.py test_sprout.py-20070521151739-b8t8p7axw1h966ws-1
------------------------------------------------------------
revno: 3834.5.2
revision-id: john at arbash-meinel.com-20081118184304-9zsvcjp81ma63f04
parent: andrew.bennetts at canonical.com-20081114034737-4dsajao903vu5qy7
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-integration
timestamp: Tue 2008-11-18 12:43:04 -0600
message:
Track down the various BranchFormats that weren't setting the branch format as part of the _matchingbzrdir format.
Also track down bits of the test suite that weren't using _matchingbzrdir.
Still need to fix some sprout testing.
modified:
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/tests/branch_implementations/__init__.py __init__.py-20060123013057-b12a52c3f361daf4
bzrlib/tests/branch_implementations/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
bzrlib/tests/branch_implementations/test_sprout.py test_sprout.py-20070521151739-b8t8p7axw1h966ws-1
------------------------------------------------------------
revno: 3834.5.1
revision-id: andrew.bennetts at canonical.com-20081114034737-4dsajao903vu5qy7
parent: pqm at pqm.ubuntu.com-20081112073322-dpai0jsluo3cvpf2
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: improve test_sprout
timestamp: Fri 2008-11-14 13:47:37 +1000
message:
Improve test_sprout.
modified:
bzrlib/tests/branch_implementations/test_sprout.py test_sprout.py-20070521151739-b8t8p7axw1h966ws-1
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2008-11-27 06:29:56 +0000
+++ b/bzrlib/branch.py 2008-12-01 23:50:52 +0000
@@ -1269,6 +1269,7 @@
def __init__(self):
super(BranchFormatMetadir, self).__init__()
self._matchingbzrdir = bzrdir.BzrDirMetaFormat1()
+ self._matchingbzrdir.set_branch_format(self)
def supports_tags(self):
return True
@@ -1424,6 +1425,7 @@
def __init__(self):
super(BranchReferenceFormat, self).__init__()
self._matchingbzrdir = bzrdir.BzrDirMetaFormat1()
+ self._matchingbzrdir.set_branch_format(self)
def _make_reference_clone_function(format, a_branch):
"""Create a clone() routine for a branch dynamically."""
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py 2008-11-18 21:43:36 +0000
+++ b/bzrlib/remote.py 2008-12-01 23:50:52 +0000
@@ -1279,6 +1279,11 @@
class RemoteBranchFormat(branch.BranchFormat):
+ def __init__(self):
+ super(RemoteBranchFormat, self).__init__()
+ self._matchingbzrdir = RemoteBzrDirFormat()
+ self._matchingbzrdir.set_branch_format(self)
+
def __eq__(self, other):
return (isinstance(other, RemoteBranchFormat) and
self.__dict__ == other.__dict__)
=== modified file 'bzrlib/tests/branch_implementations/__init__.py'
--- a/bzrlib/tests/branch_implementations/__init__.py 2008-07-07 10:31:06 +0000
+++ b/bzrlib/tests/branch_implementations/__init__.py 2008-11-18 18:43:04 +0000
@@ -184,10 +184,11 @@
tests.adapt_modules(test_branch_implementations, adapter, loader, result)
# Add RemoteBranch tests, which need a special server.
+ remote_branch_format = RemoteBranchFormat()
adapt_to_smart_server = BranchTestProviderAdapter(
SmartTCPServer_for_testing,
ReadonlySmartTCPServer_for_testing,
- [(RemoteBranchFormat(), RemoteBzrDirFormat())],
+ [(remote_branch_format, remote_branch_format._matchingbzrdir)],
MemoryServer,
name_suffix='-default')
tests.adapt_modules(test_branch_implementations,
@@ -200,7 +201,7 @@
adapt_to_smart_server = BranchTestProviderAdapter(
SmartTCPServer_for_testing_v2_only,
ReadonlySmartTCPServer_for_testing_v2_only,
- [(RemoteBranchFormat(), RemoteBzrDirFormat())],
+ [(remote_branch_format, remote_branch_format._matchingbzrdir)],
MemoryServer,
name_suffix='-v2')
tests.adapt_modules(test_branch_implementations,
=== modified file 'bzrlib/tests/branch_implementations/test_branch.py'
--- a/bzrlib/tests/branch_implementations/test_branch.py 2008-06-25 10:06:48 +0000
+++ b/bzrlib/tests/branch_implementations/test_branch.py 2008-11-18 18:43:04 +0000
@@ -51,6 +51,14 @@
from bzrlib.workingtree import WorkingTree
+class TestTestCaseWithBranch(TestCaseWithBranch):
+
+ def test_branch_format_matches_bzrdir_branch_format(self):
+ bzrdir_branch_format = self.bzrdir_format.get_branch_format()
+ self.assertIs(self.branch_format.__class__,
+ bzrdir_branch_format.__class__)
+
+
class TestBranch(TestCaseWithBranch):
def test_create_tree_with_merge(self):
=== modified file 'bzrlib/tests/branch_implementations/test_sprout.py'
--- a/bzrlib/tests/branch_implementations/test_sprout.py 2008-10-27 01:02:06 +0000
+++ b/bzrlib/tests/branch_implementations/test_sprout.py 2008-12-01 23:50:52 +0000
@@ -18,6 +18,7 @@
import os
from bzrlib import (
+ branch as _mod_branch,
remote,
revision as _mod_revision,
tests,
@@ -37,17 +38,17 @@
target = source.bzrdir.sprout(self.get_url('target')).open_branch()
self.assertEqual(source.bzrdir.root_transport.base, target.get_parent())
- def test_sprout_preserves_kind(self):
- branch1 = self.make_branch('branch1')
- target_repo = self.make_repository('branch2')
- target_repo.fetch(branch1.repository)
- branch2 = branch1.sprout(target_repo.bzrdir)
- if isinstance(branch1, remote.RemoteBranch):
- branch1._ensure_real()
- target_class = branch1._real_branch.__class__
- else:
- target_class = branch1.__class__
- self.assertIsInstance(branch2, target_class)
+ def test_sprout_uses_bzrdir_branch_format(self):
+ if isinstance(self.branch_format, _mod_branch.BranchReferenceFormat):
+ raise tests.TestNotApplicable('cannot sprout to a reference')
+ # Start with a format that is unlikely to be the target format
+ source = tests.TestCaseWithTransport.make_branch(self, 'old-branch',
+ format='metaweave')
+ target_bzrdir = self.make_bzrdir('target')
+ target_bzrdir.create_repository()
+ target = source.sprout(target_bzrdir)
+
+ self.assertIs(self.branch_format.__class__, target._format.__class__)
def test_sprout_partial(self):
# test sprouting with a prefix of the revision-history.
=== modified file 'bzrlib/tests/branch_implementations/test_stacking.py'
--- a/bzrlib/tests/branch_implementations/test_stacking.py 2008-11-21 20:24:15 +0000
+++ b/bzrlib/tests/branch_implementations/test_stacking.py 2008-12-01 23:50:52 +0000
@@ -415,7 +415,10 @@
raise TestNotApplicable()
# Avoid make_branch, which produces standalone branches.
bzrdir = self.make_bzrdir('repo/stack-on')
- b = bzrdir.create_branch()
+ try:
+ b = bzrdir.create_branch()
+ except errors.UninitializableFormat:
+ raise TestNotApplicable()
transport = self.get_transport('stacked')
b.bzrdir.clone_on_transport(transport, stacked_on=b.base)
# Ensure that opening the branch doesn't raise.
More information about the bazaar-commits
mailing list