Merge lp:~rockstar/launchpad/bug-520446 into lp:launchpad

Proposed by Paul Hummer
Status: Merged
Approved by: Graham Binns
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~rockstar/launchpad/bug-520446
Merge into: lp:launchpad
Prerequisite: lp:~rockstar/launchpad/bug-527450
Diff against target: 43 lines (+15/-0)
2 files modified
lib/lp/code/errors.py (+3/-0)
lib/lp/code/stories/webservice/xx-branchmergeproposal.txt (+12/-0)
To merge this branch: bzr merge lp:~rockstar/launchpad/bug-520446
Reviewer Review Type Date Requested Status
Graham Binns (community) code Approve
Review via email: mp+21025@code.launchpad.net

Description of the change

This branch fixes bug #520446. The exception being raised by
IBranch.createMergeProposal through the rest API was inconsistent with the rest
of Launchpad. All I did was catch the exception and re-raise it as a
ValueError.

To post a comment you must log in.
Revision history for this message
Graham Binns (gmb) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/code/errors.py'
--- lib/lp/code/errors.py 2010-02-24 02:43:52 +0000
+++ lib/lp/code/errors.py 2010-03-10 19:00:50 +0000
@@ -17,6 +17,8 @@
17 'WrongBranchMergeProposal',17 'WrongBranchMergeProposal',
18]18]
1919
20from lazr.restful.declarations import webservice_error
21
2022
21class BadBranchMergeProposalSearchContext(Exception):23class BadBranchMergeProposalSearchContext(Exception):
22 """The context is not valid for a branch merge proposal search."""24 """The context is not valid for a branch merge proposal search."""
@@ -39,6 +41,7 @@
3941
40class BranchMergeProposalExists(InvalidBranchMergeProposal):42class BranchMergeProposalExists(InvalidBranchMergeProposal):
41 """Raised if there is already a matching BranchMergeProposal."""43 """Raised if there is already a matching BranchMergeProposal."""
44 webservice_error(400) #Bad request.
4245
4346
44class ReviewNotPending(Exception):47class ReviewNotPending(Exception):
4548
=== modified file 'lib/lp/code/stories/webservice/xx-branchmergeproposal.txt'
--- lib/lp/code/stories/webservice/xx-branchmergeproposal.txt 2010-03-09 17:30:18 +0000
+++ lib/lp/code/stories/webservice/xx-branchmergeproposal.txt 2010-03-10 19:00:50 +0000
@@ -76,6 +76,18 @@
76 votes_collection_link:76 votes_collection_link:
77 u'http://api.launchpad.dev/devel/~.../+merge/.../votes'77 u'http://api.launchpad.dev/devel/~.../+merge/.../votes'
7878
79If we try and create the merge proposal again, we should get a ValueError.
80
81 >>> print registrant_webservice.named_post(
82 ... source_url, 'createMergeProposal', target_branch=target_url,
83 ... prerequisite_branch=prerequisite_url,
84 ... initial_comment='Merge\nit!', needs_review=True,
85 ... commit_message='It was merged!\n', reviewers=[reviewer_url],
86 ... review_types=['green'])
87 HTTP/1.1 500 Internal Server Error ...
88 BranchMergeProposalExists: There is already a branch merge proposal
89 registered for branch ... to land on ... that is still active.
90
79Our review request is listed in the votes collection.91Our review request is listed in the votes collection.
8092
81 >>> votes = webservice.get(93 >>> votes = webservice.get(