diff options
author | Christian Hammond <chipx86@chipx86.com> | 2009-11-03 01:33:50 -0800 |
---|---|---|
committer | Christian Hammond <chipx86@chipx86.com> | 2009-11-03 01:33:50 -0800 |
commit | 3bd73dda33fb0669627b642cec6bf1d26b966263 (patch) | |
tree | f5a6ec89db640248e055d4a404f370186ce0d8a5 | |
parent | 5985a3192e52832a5bfb05d7071cb00d93e17c63 (diff) |
Fix post-review error reporting when using --diff-only.
Running post-review --diff-only may throw exceptions when encountering
errors, instead of gracefully handlin them. A simple case of this is to
run with --diff-only without having a post-review login cookie, and instead
of a login prompt, post-review will crash with a KeyError.
This change fixes this reporting by not special-casing the --diff-only
parameter in the error reporting. We were only handling errors if that
option was not set.
Patch by Eric Huss.
Reviewed at http://reviews.reviewboard.org/r/1185/
-rwxr-xr-x | rbtools/postreview.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/rbtools/postreview.py b/rbtools/postreview.py index 863c835..567e891 100755 --- a/rbtools/postreview.py +++ b/rbtools/postreview.py @@ -379,14 +379,17 @@ class ReviewBoardServer(object): except APIError, e: rsp, = e.args - if not options.diff_only: - if rsp['err']['code'] == 204: # Change number in use + if rsp['err']['code'] == 204: # Change number in use + if options.diff_only: + # In this case, fall through and return to tempt_fate. + debug("Review request already exists.") + else: debug("Review request already exists. Updating it...") rsp = self.api_post( 'api/json/reviewrequests/%s/update_from_changenum/' % rsp['review_request']['id']) - else: - raise e + else: + raise e debug("Review request created") return rsp['review_request'] |