Merge lp:~jcsackett/launchpad/branch-delete-api-702620 into lp:launchpad
Status: | Merged |
---|---|
Approved by: | j.c.sackett |
Approved revision: | no longer in the source branch. |
Merged at revision: | 12297 |
Proposed branch: | lp:~jcsackett/launchpad/branch-delete-api-702620 |
Merge into: | lp:launchpad |
Diff against target: |
136 lines (+72/-8) 4 files modified
lib/lp/code/errors.py (+3/-0) lib/lp/code/model/branch.py (+7/-1) lib/lp/code/tests/test_branch.py (+1/-7) lib/lp/code/tests/test_branch_webservice.py (+61/-0) |
To merge this branch: | bzr merge lp:~jcsackett/launchpad/branch-delete-api-702620 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Leonard Richardson (community) | Approve | ||
Review via email: mp+47449@code.launchpad.net |
Commit message
[r=leonardr][bug=702620] Expose CannotDeleteBranch exception for the webservice on DELETE
Description of the change
Summary
=======
Calling a DELETE across the webservice on a branch leads to an OOPS when the branch has linked artifacts (e.g. stacked branches) that cause CannotDeleteBranch to be raised. CannotDeleteBranch should be raised over the webservice instead of the server error.
Preimplementation
=================
Spoke with Curtis Hovey about the reasons for the DELETE failing, and if we should have the DELETE just whack the linked objects. Not having the DELETE hit the linked objects (and providing no way to do so) was a conscious decision, so just exposing the error is correct.
Spoke with Leonard Richardson about various oddities in exposing this particular error, as the exception is raised in such a way that just adding webservice_error was not sufficient.
Proposed Fix
============
Add webservice_error to CannotDeleteBranch.
Implementation
==============
lib/lp/
-------
Add webservice_error to CannotDeleteBranch
lib/lp/
-------
In deleteSelfBreak
lib/lp/
-------
Drive by fix; unittest and testsuite boilerplate removed, b/c it's no longer needed.
lib/lp/
-------
Test case added for branch deletion over webservice.
Tests
=====
bin/test -t TestBranchDeletes
Demo & QA
=========
Attempt to delete a branch with branches stacked on it via launchpadlib. You should get a 400, rather than a 500 error.
Lint
====
make lint output:
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/
lib/lp/
lib/lp/
lib/lp/
So this will solve 1/2 the bug: it won't oops. However it won't let
scripts that want to delete branches do so - some of the artifacts
cannot be deleted from the web API or UI except by deleting the branch
in the web UI.
I realise it was a conscious decision, but what was the rationale? Why
does it still make sense?
-Rob