From 7f34fb8f13cce5be52d5910ac86f81245e8d81d9 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Tue, 18 Nov 2008 22:31:12 -0500 Subject: Try to catch failure when attaching a patch If the response to attaching a patch doesn't have "Changes Submitted" as the, assume the attachment failed and dump out an error message and the response body. --- git-bz | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/git-bz b/git-bz index fd36d74..c1493ac 100755 --- a/git-bz +++ b/git-bz @@ -571,7 +571,14 @@ class Bug(object): response_data = response.read() if response.status != 200: - die ("Failed to attach bug: %d" % response.status) + die ("Failed to attach patch to bug: status=%d" % response.status) + + # We hope that this is constant across bugzilla versions for a + # successful attachment + m = re.search(r"\s*Changes\s+Submitted", response_data) + if not m: + print response_data + die ("Failed to attach patch to bug") print "Attached %s" % filename -- cgit v1.2.3