diff options
author | Guido Günther <agx@sigxcpu.org> | 2011-07-29 12:14:18 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2011-07-29 12:28:34 +0200 |
commit | a6927452ac04a570b8bc5fcfb5490312616eeb66 (patch) | |
tree | 3297eb0a5ecbe3713122160e002c907239f0e80a | |
parent | d34e82e7e67a6769bef4f676f8018a5605979ed0 (diff) |
Report errors reading the patch file
instead of throwing an exception.
Closes: #635872
-rwxr-xr-x | gbp-pq | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -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 |