Rev 2447: (Andrew Bennetts) Make RemoteBzrDir.open_workingtree raise NoWorkingTree instead of NotLocalUrl when appropriate. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Mon Apr 23 18:08:01 BST 2007
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 2447
revision-id: pqm at pqm.ubuntu.com-20070423170758-qd512ltqglzfo6w9
parent: pqm at pqm.ubuntu.com-20070423075015-340ajk1vo3pzxheu
parent: andrew.bennetts at canonical.com-20070423083030-1mzq93srvd6b3abg
committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2007-04-23 18:07:58 +0100
message:
(Andrew Bennetts) Make RemoteBzrDir.open_workingtree raise NoWorkingTree instead of NotLocalUrl when appropriate.
modified:
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/tests/bzrdir_implementations/test_bzrdir.py test_bzrdir.py-20060131065642-0ebeca5e30e30866
------------------------------------------------------------
revno: 2445.1.1
merged: andrew.bennetts at canonical.com-20070423083030-1mzq93srvd6b3abg
parent: pqm at pqm.ubuntu.com-20070423070809-7imm5hgj6g0n78s5
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: workingtree-msg
timestamp: Mon 2007-04-23 18:30:30 +1000
message:
Make RemoteBzrDir.open_workingtree raise NoWorkingTree rather than NotLocalUrl
when there is no remote working tree, avoiding spurious "This transport does not
update the working tree" warnings from cmd_push.
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py 2007-04-20 05:11:46 +0000
+++ b/bzrlib/remote.py 2007-04-23 08:30:30 +0000
@@ -135,7 +135,11 @@
raise errors.NoRepositoryPresent(self)
def open_workingtree(self, recommend_upgrade=True):
- raise errors.NotLocalUrl(self.root_transport)
+ self._ensure_real()
+ if self._real_bzrdir.has_workingtree():
+ raise errors.NotLocalUrl(self.root_transport)
+ else:
+ raise errors.NoWorkingTree(self.root_transport.base)
def _path_for_remote_call(self, client):
"""Return the path to be used for this bzrdir in a remote call."""
=== modified file 'bzrlib/tests/bzrdir_implementations/test_bzrdir.py'
--- a/bzrlib/tests/bzrdir_implementations/test_bzrdir.py 2007-04-18 11:24:53 +0000
+++ b/bzrlib/tests/bzrdir_implementations/test_bzrdir.py 2007-04-23 08:30:30 +0000
@@ -179,6 +179,18 @@
bzrdir.destroy_workingtree_metadata()
self.failUnlessExists('tree/file')
self.assertRaises(errors.NoWorkingTree, bzrdir.open_workingtree)
+
+ def test_open_workingtree_raises_no_working_tree(self):
+ """BzrDir.open_workingtree() should raise NoWorkingTree (rather than
+ e.g. NotLocalUrl) if there is no working tree.
+ """
+ dir = self.make_bzrdir('source')
+ vfs_dir = bzrdir.BzrDir.open(self.get_vfs_only_url('source'))
+ if vfs_dir.has_workingtree():
+ # This BzrDir format doesn't support BzrDirs without working trees,
+ # so this test is irrelevant.
+ return
+ self.assertRaises(errors.NoWorkingTree, dir.open_workingtree)
def test_clone_bzrdir_empty(self):
dir = self.make_bzrdir('source')
@@ -553,9 +565,9 @@
target.open_branch()
try:
target.open_workingtree()
- except errors.NotLocalUrl:
- # bzrdir's that test against non-local urls are allowed to pass:
- # whitelist them for now
+ except errors.NoWorkingTree:
+ # bzrdir's that never have working trees are allowed to pass;
+ # whitelist them for now.
self.assertIsInstance(target, RemoteBzrDir)
def test_sprout_bzrdir_empty_under_shared_repo_force_new(self):
More information about the bazaar-commits
mailing list