[MERGE] Re: [BUG][0.16 blocker] HPSS raises NotLocalURL when there is no working tree
Andrew Bennetts
andrew at canonical.com
Mon Apr 23 09:33:54 BST 2007
John Arbash Meinel wrote:
> I was just trying:
>
> jigglypuff % bzr push
> bzr+ssh://juju/srv/bzr/public/branches/bzr/0.16-dev/rename_directory_105479
> This transport does not update the working tree of:
> bzr+ssh://juju/srv/bzr/public/branches/bzr/0.16-dev/rename_directory_105479/
> Pushed up to revision 2452.
>
> However that branch does not have a working tree.
>
> I haven't dug into it deeply, but my guess is that '.open_workingtree()'
> is raising NotLocalURL even though it hasn't checked whether or not
> there is a remote working tree.
Your diagnosis is correct.
> It should raise NoWorkingTree if there isn't one, and only raise
> NotLocalURL if there *is* a working tree, but it *isn't* accessible.
Interestingly there's no test for this behaviour, hence why this bug slipped
through :)
> This (IMO) is worth blocking 0.16rc1.
Fair enough. Here's a bundle to fix this.
-Andrew.
-------------- next part --------------
# Bazaar revision bundle v0.9
#
# 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.
#
# committer: Andrew Bennetts <andrew.bennetts at canonical.com>
# date: Mon 2007-04-23 18:30:30.628999949 +1000
=== modified file bzrlib/remote.py
--- bzrlib/remote.py
+++ bzrlib/remote.py
@@ -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
--- bzrlib/tests/bzrdir_implementations/test_bzrdir.py
+++ bzrlib/tests/bzrdir_implementations/test_bzrdir.py
@@ -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):
=== modified directory // last-changed:andrew.bennetts at canonical.com-200704230
... 83030-1mzq93srvd6b3abg
# revision id: andrew.bennetts at canonical.com-20070423083030-1mzq93srvd6b3abg
# sha1: bfdb7489f8e5eb307a62f71d0a30b94cc35032f9
# inventory sha1: ebcbdc66380500a6986c8c2471b65ef9a6e3bc25
# parent ids:
# pqm at pqm.ubuntu.com-20070423070809-7imm5hgj6g0n78s5
# base id: pqm at pqm.ubuntu.com-20070423070809-7imm5hgj6g0n78s5
# properties:
# bugs:
# branch-nick: workingtree-msg
More information about the bazaar
mailing list