Rev 5609: (jelmer) Remove more unused imports and more use of specific formats in in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu Jan 13 16:52:06 UTC 2011
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5609 [merge]
revision-id: pqm at pqm.ubuntu.com-20110113165202-44k299aa1yzyy6yk
parent: pqm at pqm.ubuntu.com-20110113024321-d1ssmy4knbv806zp
parent: jelmer at samba.org-20110113155403-z1hqjjta7lfmuwqd
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2011-01-13 16:52:02 +0000
message:
(jelmer) Remove more unused imports and more use of specific formats in
tests. (Jelmer Vernooij)
modified:
bzrlib/tests/blackbox/test_break_lock.py test_break_lock.py-20060303014503-a90e07d38d042d1d
bzrlib/tests/blackbox/test_upgrade.py test_upgrade.py-20060120060132-b41e5ed2f886ad28
bzrlib/tests/per_branch/test_locking.py test_locking.py-20060707151933-tav3o2hpibwi53u4-4
bzrlib/tests/per_branch/test_push.py test_push.py-20070130153159-fhfap8uoifevg30j-1
bzrlib/tests/per_branch/test_sprout.py test_sprout.py-20070521151739-b8t8p7axw1h966ws-1
bzrlib/tests/per_branch/test_stacking.py test_stacking.py-20080214020755-msjlkb7urobwly0f-1
bzrlib/tests/per_controldir/test_controldir.py test_bzrdir.py-20060131065642-0ebeca5e30e30866
bzrlib/tests/per_interbranch/test_push.py test_push.py-20090330192649-pca31sb2ubbtcs15-1
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
=== modified file 'bzrlib/tests/blackbox/test_break_lock.py'
--- a/bzrlib/tests/blackbox/test_break_lock.py 2010-09-14 07:19:22 +0000
+++ b/bzrlib/tests/blackbox/test_break_lock.py 2011-01-13 05:28:55 +0000
@@ -25,7 +25,6 @@
tests,
)
from bzrlib.tests.script import (
- ScriptRunner,
run_script,
)
=== modified file 'bzrlib/tests/blackbox/test_upgrade.py'
--- a/bzrlib/tests/blackbox/test_upgrade.py 2011-01-10 22:20:12 +0000
+++ b/bzrlib/tests/blackbox/test_upgrade.py 2011-01-13 15:54:03 +0000
@@ -48,16 +48,17 @@
def make_format_5_branch(self):
# setup a format 5 branch we can upgrade from.
- self.make_branch_and_tree('format_5_branch',
- format=bzrdir.BzrDirFormat5())
+ path = 'format_5_branch'
+ self.make_branch_and_tree(path, format=bzrdir.BzrDirFormat5())
+ return path
def make_metadir_weave_branch(self):
self.make_branch_and_tree('metadir_weave_branch', format='metaweave')
def test_readonly_url_error(self):
- self.make_format_5_branch()
+ path = self.make_format_5_branch()
(out, err) = self.run_bzr(
- ['upgrade', self.get_readonly_url('format_5_branch')], retcode=3)
+ ['upgrade', self.get_readonly_url(path)], retcode=3)
err_msg = 'Upgrade URL cannot work with readonly URLs.'
self.assertEqualDiff('conversion error: %s\nbzr: ERROR: %s\n'
% (err_msg, err_msg),
@@ -101,14 +102,14 @@
# anonymous branch
pass
- def test_ugrade_branch_in_repo(self):
+ def test_upgrade_branch_in_repo(self):
# upgrading a branch in a repo should warn about not upgrading the repo
pass
def test_upgrade_explicit_metaformat(self):
# users can force an upgrade to metadir format.
- self.make_format_5_branch()
- url = transport.get_transport(self.get_url('format_5_branch')).base
+ path = self.make_format_5_branch()
+ url = transport.get_transport(self.get_url(path)).base
# check --format takes effect
controldir.ControlDirFormat._set_default_format(bzrdir.BzrDirFormat5())
backup_dir = 'backup.bzr.~1~'
@@ -126,7 +127,7 @@
""" % (url, url, url, url, backup_dir), out)
self.assertEqualDiff("", err)
self.assertTrue(isinstance(
- bzrdir.BzrDir.open(self.get_url('format_5_branch'))._format,
+ bzrdir.BzrDir.open(self.get_url(path))._format,
bzrdir.BzrDirMetaFormat1))
def test_upgrade_explicit_knit(self):
@@ -193,10 +194,9 @@
new_perms = os.stat(backup_dir).st_mode & 0777
self.assertTrue(new_perms == old_perms)
-
def test_upgrade_with_existing_backup_dir(self):
- self.make_format_5_branch()
- t = transport.get_transport(self.get_url('format_5_branch'))
+ path = self.make_format_5_branch()
+ t = transport.get_transport(self.get_url(path))
url = t.base
controldir.ControlDirFormat._set_default_format(bzrdir.BzrDirFormat5())
backup_dir1 = 'backup.bzr.~1~'
@@ -218,7 +218,7 @@
""" % (url, url, url, url, backup_dir2), out)
self.assertEqualDiff("", err)
self.assertTrue(isinstance(
- bzrdir.BzrDir.open(self.get_url('format_5_branch'))._format,
+ bzrdir.BzrDir.open(self.get_url(path))._format,
bzrdir.BzrDirMetaFormat1))
self.assertTrue(t.has(backup_dir2))
=== modified file 'bzrlib/tests/per_branch/test_locking.py'
--- a/bzrlib/tests/per_branch/test_locking.py 2010-06-11 07:59:43 +0000
+++ b/bzrlib/tests/per_branch/test_locking.py 2011-01-13 05:30:51 +0000
@@ -17,7 +17,6 @@
"""Test locks across all branch implemenations"""
from bzrlib import (
- branch as _mod_branch,
errors,
tests,
)
@@ -501,10 +500,6 @@
self.assertThat(branch.lock_read, ReturnsUnlockable(branch))
def test_lock_write_locks_repo_too(self):
- if isinstance(self.branch_format, _mod_branch.BzrBranchFormat4):
- # Branch format 4 is combined with the repository, so this test
- # doesn't apply.
- return
branch = self.make_branch('b')
branch = branch.bzrdir.open_branch()
branch.lock_write()
=== modified file 'bzrlib/tests/per_branch/test_push.py'
--- a/bzrlib/tests/per_branch/test_push.py 2010-09-09 00:32:58 +0000
+++ b/bzrlib/tests/per_branch/test_push.py 2011-01-13 01:02:53 +0000
@@ -24,11 +24,9 @@
builtins,
bzrdir,
check,
- debug,
errors,
memorytree,
push,
- repository,
revision,
symbol_versioning,
tests,
@@ -36,8 +34,6 @@
)
from bzrlib.smart import (
client,
- server,
- repository as _mod_smart_repo,
)
from bzrlib.tests import (
per_branch,
=== modified file 'bzrlib/tests/per_branch/test_sprout.py'
--- a/bzrlib/tests/per_branch/test_sprout.py 2009-07-10 07:14:02 +0000
+++ b/bzrlib/tests/per_branch/test_sprout.py 2011-01-13 05:36:39 +0000
@@ -182,9 +182,9 @@
source.last_revision(), possible_transports=[target_transport],
source_branch=source, stacked=True)
except errors.UnstackableBranchFormat:
- if isinstance(self.branch_format, _mod_branch.BzrBranchFormat4):
- raise tests.KnownFailure(
- "Format 4 doesn't auto stack successfully.")
+ if not self.branch_format.supports_stacking():
+ raise tests.TestNotApplicable(
+ "Format doesn't auto stack successfully.")
else:
raise
result = dir.open_branch()
=== modified file 'bzrlib/tests/per_branch/test_stacking.py'
--- a/bzrlib/tests/per_branch/test_stacking.py 2010-07-01 03:41:20 +0000
+++ b/bzrlib/tests/per_branch/test_stacking.py 2011-01-13 01:02:53 +0000
@@ -154,8 +154,6 @@
self.assertRevisionInRepository('newbranch', new_branch_revid)
def test_sprout_stacked_from_smart_server(self):
- if isinstance(self.branch_format, branch.BzrBranchFormat4):
- raise TestNotApplicable('Branch format 4 is not usable via HPSS.')
# We have a mainline
trunk_tree = self.make_branch_and_tree('mainline')
trunk_revid = trunk_tree.commit('mainline')
=== modified file 'bzrlib/tests/per_controldir/test_controldir.py'
--- a/bzrlib/tests/per_controldir/test_controldir.py 2011-01-12 01:01:53 +0000
+++ b/bzrlib/tests/per_controldir/test_controldir.py 2011-01-13 05:28:55 +0000
@@ -33,16 +33,19 @@
)
import bzrlib.revision
from bzrlib.tests import (
- ChrootedTestCase,
- TestNotApplicable,
- TestSkipped,
- )
+ ChrootedTestCase,
+ TestNotApplicable,
+ TestSkipped,
+ )
from bzrlib.tests.per_controldir import TestCaseWithControlDir
from bzrlib.transport.local import LocalTransport
from bzrlib.ui import (
CannedInputUIFactory,
)
-from bzrlib.remote import RemoteBzrDir, RemoteRepository
+from bzrlib.remote import (
+ RemoteBzrDir,
+ RemoteRepository,
+ )
from bzrlib.repofmt import weaverepo
@@ -754,12 +757,11 @@
tree.commit('revision 1', rev_id='1')
tree.commit('revision 2', rev_id='2', allow_pointless=True)
dir = tree.bzrdir
- if isinstance(dir, (bzrdir.BzrDirPreSplitOut,)):
- self.assertRaises(errors.MustHaveWorkingTree, dir.sprout,
- self.get_url('target'),
- create_tree_if_local=False)
- return
- target = dir.sprout(self.get_url('target'), create_tree_if_local=False)
+ try:
+ target = dir.sprout(self.get_url('target'),
+ create_tree_if_local=False)
+ except errors.MustHaveWorkingTree:
+ raise TestNotApplicable("control dir format requires working tree")
self.failIfExists('target/foo')
self.assertEqual(tree.branch.last_revision(),
target.open_branch().last_revision())
@@ -1205,7 +1207,7 @@
self.assertTrue(isinstance(dir.get_repository_transport(None),
transport.Transport))
# with a given format, either the bzr dir supports identifiable
- # repositories, or it supports anonymous repository formats, but not both.
+ # repositories, or it supports anonymous repository formats, but not both.
anonymous_format = weaverepo.RepositoryFormat6()
identifiable_format = weaverepo.RepositoryFormat7()
try:
=== modified file 'bzrlib/tests/per_interbranch/test_push.py'
--- a/bzrlib/tests/per_interbranch/test_push.py 2010-09-07 23:32:42 +0000
+++ b/bzrlib/tests/per_interbranch/test_push.py 2011-01-13 05:42:30 +0000
@@ -26,10 +26,8 @@
from bzrlib import (
branch,
- builtins,
bzrdir,
check,
- debug,
errors,
push,
repository,
@@ -40,7 +38,6 @@
from bzrlib.bzrdir import BzrDir
from bzrlib.memorytree import MemoryTree
from bzrlib.revision import NULL_REVISION
-from bzrlib.smart import client, server
from bzrlib.smart.repository import SmartServerRepositoryGetParentMap
from bzrlib.tests.per_interbranch import (
TestCaseWithInterBranch,
@@ -204,8 +201,6 @@
default for the branch), and will be stacked when the repo format
allows (which means that the branch format isn't necessarly preserved).
"""
- if isinstance(self.branch_format_from, branch.BzrBranchFormat4):
- raise tests.TestNotApplicable('Not a metadir format.')
if isinstance(self.branch_format_from, branch.BranchReferenceFormat):
# This test could in principle apply to BranchReferenceFormat, but
# make_branch_builder doesn't support it.
=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py 2010-11-04 17:48:47 +0000
+++ b/bzrlib/workingtree.py 2011-01-13 02:05:17 +0000
@@ -209,13 +209,7 @@
else:
self._branch = self.bzrdir.open_branch()
self.basedir = realpath(basedir)
- # if branch is at our basedir and is a format 6 or less
- if isinstance(self._format, WorkingTreeFormat2):
- # share control object
- self._control_files = self.branch.control_files
- else:
- # assume all other formats have their own control files.
- self._control_files = _control_files
+ self._control_files = _control_files
self._transport = self._control_files._transport
# update the whole cache up front and write to disk if anything changed;
# in the future we might want to do this more selectively
@@ -2974,7 +2968,8 @@
inv,
_internal=True,
_format=self,
- _bzrdir=a_bzrdir)
+ _bzrdir=a_bzrdir,
+ _control_files=branch.control_files)
basis_tree = branch.repository.revision_tree(revision_id)
if basis_tree.inventory.root is not None:
wt.set_root_id(basis_tree.get_root_id())
@@ -3005,7 +3000,8 @@
wt = WorkingTree2(a_bzrdir.root_transport.local_abspath('.'),
_internal=True,
_format=self,
- _bzrdir=a_bzrdir)
+ _bzrdir=a_bzrdir,
+ _control_files=a_bzrdir.open_branch().control_files)
return wt
class WorkingTreeFormat3(WorkingTreeFormat):
More information about the bazaar-commits
mailing list