Rev 4341: (Jelmer) Mention --force in the error message when unable to access in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu May 7 01:59:46 BST 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4341
revision-id: pqm at pqm.ubuntu.com-20090507005942-wnvvomd3130f1vph
parent: pqm at pqm.ubuntu.com-20090506173137-di6mfn1f3od2khp3
parent: jelmer at samba.org-20090506221216-u3coxykmz4coesk2
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2009-05-07 01:59:42 +0100
message:
(Jelmer) Mention --force in the error message when unable to access
in the master branch in 'bzr switch'.
modified:
bzrlib/switch.py switch.py-20071116011000-v5lnw7d2wkng9eux-1
bzrlib/tests/test_switch.py test_switch.py-20071116011000-v5lnw7d2wkng9eux-2
------------------------------------------------------------
revno: 4340.1.1
revision-id: jelmer at samba.org-20090506221216-u3coxykmz4coesk2
parent: pqm at pqm.ubuntu.com-20090506173137-di6mfn1f3od2khp3
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: bzr.dev
timestamp: Thu 2009-05-07 00:12:16 +0200
message:
Mention --force when bzr switch fails to open the current master branch.
modified:
bzrlib/switch.py switch.py-20071116011000-v5lnw7d2wkng9eux-1
bzrlib/tests/test_switch.py test_switch.py-20071116011000-v5lnw7d2wkng9eux-2
=== modified file 'bzrlib/switch.py'
--- a/bzrlib/switch.py 2009-03-23 14:59:43 +0000
+++ b/bzrlib/switch.py 2009-05-06 22:12:16 +0000
@@ -79,11 +79,17 @@
# synchronise the local branch with the new remote branch
# and bind to it
possible_transports = []
- if not force and _any_local_commits(b, possible_transports):
+ try:
+ if not force and _any_local_commits(b, possible_transports):
+ raise errors.BzrCommandError(
+ 'Cannot switch as local commits found in the checkout. '
+ 'Commit these to the bound branch or use --force to '
+ 'throw them away.')
+ except errors.BoundBranchConnectionFailure, e:
raise errors.BzrCommandError(
- 'Cannot switch as local commits found in the checkout. '
- 'Commit these to the bound branch or use --force to '
- 'throw them away.')
+ 'Unable to connect to current master branch %(target)s: '
+ '%(error)s To switch anyway, use --force.' %
+ e.__dict__)
b.set_bound_location(None)
b.pull(to_branch, overwrite=True,
possible_transports=possible_transports)
=== modified file 'bzrlib/tests/test_switch.py'
--- a/bzrlib/tests/test_switch.py 2009-03-23 14:59:43 +0000
+++ b/bzrlib/tests/test_switch.py 2009-05-06 22:12:16 +0000
@@ -70,9 +70,13 @@
os.rename('branch-1', 'branch-2')
to_branch = branch.Branch.open('branch-2')
# Check fails without --force
- err = self.assertRaises((errors.NotBranchError,
- errors.BoundBranchConnectionFailure),
+ err = self.assertRaises(
+ (errors.BzrCommandError, errors.NotBranchError),
switch.switch, checkout.bzrdir, to_branch)
+ if isinstance(err, errors.BzrCommandError):
+ self.assertContainsRe(str(err),
+ 'Unable to connect to current master branch .*'
+ 'To switch anyway, use --force.')
switch.switch(checkout.bzrdir, to_branch, force=True)
self.failIfExists('checkout/file-1')
self.failUnlessExists('checkout/file-2')
More information about the bazaar-commits
mailing list