Merge lp:~dobey/tarmac/broken-author into lp:tarmac

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: 416
Merged at revision: 417
Proposed branch: lp:~dobey/tarmac/broken-author
Merge into: lp:tarmac
Diff against target: 46 lines (+17/-4)
2 files modified
tarmac/branch.py (+5/-2)
tarmac/tests/test_branch.py (+12/-2)
To merge this branch: bzr merge lp:~dobey/tarmac/broken-author
Reviewer Review Type Date Requested Status
Mike McCracken Approve
Review via email: mp+193827@code.launchpad.net

Commit message

Handle an AssertionError from bzrlib on commit, and add a test for it.

To post a comment you must log in.
Revision history for this message
Mike McCracken (mikemc) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tarmac/branch.py'
2--- tarmac/branch.py 2013-10-31 18:32:39 +0000
3+++ tarmac/branch.py 2013-11-04 17:53:52 +0000
4@@ -154,8 +154,11 @@
5 'review identity or vote.')
6 revprops['reviews'] = '\n'.join(reviews)
7
8- self.tree.commit(commit_message, committer='Tarmac',
9- revprops=revprops, authors=authors)
10+ try:
11+ self.tree.commit(commit_message, committer='Tarmac',
12+ revprops=revprops, authors=authors)
13+ except AssertionError as error:
14+ raise TarmacMergeError(str(error))
15
16 @property
17 def landing_candidates(self):
18
19=== modified file 'tarmac/tests/test_branch.py'
20--- tarmac/tests/test_branch.py 2013-10-31 22:02:47 +0000
21+++ tarmac/tests/test_branch.py 2013-11-04 17:53:52 +0000
22@@ -21,8 +21,11 @@
23 from bzrlib.errors import PointlessMerge
24
25 from tarmac import branch
26-from tarmac.tests import BranchTestCase
27-from tarmac.tests import MockLPBranch
28+from tarmac.exceptions import TarmacMergeError
29+from tarmac.tests import (
30+ BranchTestCase,
31+ MockLPBranch,
32+)
33
34
35 class TestBranch(BranchTestCase):
36@@ -199,3 +202,10 @@
37 self.assertEqual(sorted(self.branch1.unmanaged_files), expected)
38 self.branch1.cleanup()
39 self.assertEqual(self.branch1.unmanaged_files, [])
40+
41+ def test_commit_with_author_with_newline(self):
42+ """Test that committing a branch with an author containing \n fails."""
43+ authors = ['author1', 'author2']
44+ self.assertRaises(TarmacMergeError,
45+ self.branch2.commit,
46+ 'Authors Merge test', authors=['\n'.join(authors)])

Subscribers

People subscribed via source and target branches