[Fwd: Re: RFC: ERROR: Unsupported branch format (improve message)]
Martin Pool
mbp at sourcefrog.net
Sun Apr 1 05:36:48 BST 2007
> I think the right fix is probably that _cloning_metadata should say "I
> don't care if it's an old format", as in this patch.
*this* patch :)
=== modified file 'bzrlib/bzrdir.py'
--- bzrlib/bzrdir.py 2007-03-26 07:34:59 +0000
+++ bzrlib/bzrdir.py 2007-04-01 04:18:24 +0000
@@ -132,8 +132,8 @@
the user through the ui object that they may wish
to upgrade the object.
"""
- # TODO: perhaps move this into the format itself.
- # mbp 20070323
+ # TODO: perhaps move this into a base Format class; it's not BzrDir
+ # specific. mbp 20070323
if not allow_unsupported and not format.is_supported():
# see open_downlevel to open legacy branches.
raise errors.UnsupportedFormatError(format=format)
@@ -720,7 +720,10 @@
except errors.NoRepositoryPresent:
source_repository = None
try:
- tree = self.open_workingtree()
+ # TODO: Couldn't we just probe for the format in these cases,
+ # rather than opening the whole tree? It would be a little
+ # faster. mbp 20070401
+ tree = self.open_workingtree(recommend_upgrade=False)
except (errors.NoWorkingTree, errors.NotLocalUrl):
result_format.workingtree_format = None
else:
=== modified file 'bzrlib/tests/blackbox/test_upgrade.py'
--- bzrlib/tests/blackbox/test_upgrade.py 2007-03-22 05:27:08 +0000
+++ bzrlib/tests/blackbox/test_upgrade.py 2007-04-01 02:44:54 +0000
@@ -192,3 +192,12 @@
self.run_bzr('init', '--knit', 'a')
out, err = self.run_bzr('status', 'a')
self.assertContainsRe(err, 'bzr upgrade .*[/\\\\]a')
+
+ def test_no_upgrade_recommendation_from_bzrdir(self):
+ # we should only get a recommendation to upgrade when we're accessing
+ # the actual workingtree, not when we only open a bzrdir that contains
+ # an old workngtree
+ self.run_bzr('init', '--knit', 'a')
+ out, err = self.run_bzr('checkout', 'a', 'b')
+ if err.find('upgrade') > -1:
+ self.fail("message shouldn't suggest upgrade:\n%s" % err)
--
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20070401-upgrade-recommendation.diff
Type: text/x-patch
Size: 2006 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070401/9c94d5ef/attachment-0001.bin
More information about the bazaar
mailing list