Rev 5073: (GaryvdM) Make it possible to detect a BoundBranchOutOfDate from in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Mar 3 08:56:58 GMT 2010
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5073 [merge]
revision-id: pqm at pqm.ubuntu.com-20100303085657-d06ptv6b5dxm9uhi
parent: pqm at pqm.ubuntu.com-20100302204508-4j07g2h9wj49o494
parent: garyvdm at gmail.com-20100303082515-7xkgy4a55m84nio2
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2010-03-03 08:56:57 +0000
message:
(GaryvdM) Make it possible to detect a BoundBranchOutOfDate from
commit.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/tests/commands/test_commit.py test_commit.py-20070913161801-ydrx2k5gmv7k7eiu-1
=== modified file 'NEWS'
--- a/NEWS 2010-03-02 19:50:18 +0000
+++ b/NEWS 2010-03-03 08:25:15 +0000
@@ -130,12 +130,19 @@
* ``bzrlib.branchbuilder.BranchBuilder.build_snapshot`` now accepts a
``message_callback`` in the same way that commit does. (Robert Collins)
+* ``bzrlib.builtins.Commit.run`` raises ``bzrlib.errors.BoundBranchOutOfDate``
+ rather than ``bzrlib.errors.BzrCommandError`` when the bound branch is out
+ of date. (Gary van der Merwe)
+
* ``bzrlib.commands.run_bzr`` is more extensible: callers can supply the
functions to load or disable plugins if they wish to use a different
plugin mechanism; the --help, --version and no-command name code paths
now use the generic pluggable command lookup infrastructure.
(Robert Collins)
+* ``bzrlib.errors.BoundBranchOutOfDate`` has a new field ``extra_help``
+ which can be set to add extra help to the error. (Gary van der Merwe)
+
* The methods ``BzrDir.create_branch()``, ``BzrDir.destroy_branch()`` and
``BzrDir.open_branch()`` now take an optional ``name`` argument.
(Jelmer Vernooij)
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2010-03-02 15:56:28 +0000
+++ b/bzrlib/builtins.py 2010-03-03 08:25:15 +0000
@@ -3174,10 +3174,11 @@
raise errors.BzrCommandError("Commit refused because there are"
" unknown files in the working tree.")
except errors.BoundBranchOutOfDate, e:
- raise errors.BzrCommandError(str(e) + "\n"
- 'To commit to master branch, run update and then commit.\n'
- 'You can also pass --local to commit to continue working '
- 'disconnected.')
+ e.extra_help = ("\n"
+ 'To commit to master branch, run update and then commit.\n'
+ 'You can also pass --local to commit to continue working '
+ 'disconnected.')
+ raise
class cmd_check(Command):
=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py 2010-03-02 19:50:18 +0000
+++ b/bzrlib/errors.py 2010-03-03 08:25:15 +0000
@@ -1297,12 +1297,13 @@
class BoundBranchOutOfDate(BzrError):
_fmt = ("Bound branch %(branch)s is out of date with master branch"
- " %(master)s.")
+ " %(master)s.%(extra_help)s")
def __init__(self, branch, master):
BzrError.__init__(self)
self.branch = branch
self.master = master
+ self.extra_help = ''
class CommitToDoubleBoundBranch(BzrError):
=== modified file 'bzrlib/tests/commands/test_commit.py'
--- a/bzrlib/tests/commands/test_commit.py 2010-02-17 17:11:16 +0000
+++ b/bzrlib/tests/commands/test_commit.py 2010-03-01 19:53:13 +0000
@@ -53,8 +53,7 @@
# commit do not provide a directory parameter, we have to change dir
# manually
os.chdir('local')
- # cmd_commit translates BoundBranchOutOfDate into BzrCommandError
- self.assertRaises(errors.BzrCommandError, commit.run,
+ self.assertRaises(errors.BoundBranchOutOfDate, commit.run,
message=u'empty commit', unchanged=True)
self.assertEquals(1, len(self.connections))
More information about the bazaar-commits
mailing list