summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-07-29 12:14:18 +0200
committerGuido Günther <agx@sigxcpu.org>2011-07-29 12:28:34 +0200
commita6927452ac04a570b8bc5fcfb5490312616eeb66 (patch)
tree3297eb0a5ecbe3713122160e002c907239f0e80a
parentd34e82e7e67a6769bef4f676f8018a5605979ed0 (diff)
Report errors reading the patch file
instead of throwing an exception. Closes: #635872
-rwxr-xr-xgbp-pq13
1 files changed, 8 insertions, 5 deletions
diff --git a/gbp-pq b/gbp-pq
index fffed6fa..d7560e4b 100755
--- a/gbp-pq
+++ b/gbp-pq
@@ -207,7 +207,7 @@ def get_mailinfo(patch):
info = {}
body = os.path.join('.git', 'gbp_patchinfo')
- pipe = subprocess.Popen("git mailinfo % s /dev/null < %s" % (body, patch),
+ pipe = subprocess.Popen("git mailinfo %s /dev/null < %s" % (body, patch),
shell=True, stdout=subprocess.PIPE).stdout
for line in pipe:
if ':' in line:
@@ -215,10 +215,13 @@ def get_mailinfo(patch):
header = rfc_header[:-1].lower()
info[header] = value.strip()
- f = file(body)
- commit_msg = "".join([ line for line in f ])
- f.close()
- os.unlink(body)
+ try:
+ f = file(body)
+ commit_msg = "".join([ line for line in f ])
+ f.close()
+ os.unlink(body)
+ except IOError, msg:
+ raise GbpError, "Failed to read patch header of '%s': %s" % (patch, msg)
return info, commit_msg