aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2010-01-31 18:24:01 +0100
committerGuido Günther <agx@sigxcpu.org>2010-01-31 18:34:13 +0100
commit07d54efbe86b1d93805a1a3a78eca45c32bc5734 (patch)
tree371c7f7eb6eea0e027b76219a210e094111f23ef /examples
parent2392a3a9aae169f0630a7d6b36a7229fccf5668f (diff)
gbp-add-patch: Strip path from patchname
and handle missing files gracefully.
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/gbp-add-patch8
1 files changed, 6 insertions, 2 deletions
diff --git a/examples/gbp-add-patch b/examples/gbp-add-patch
index 905831d8..357e31cf 100755
--- a/examples/gbp-add-patch
+++ b/examples/gbp-add-patch
@@ -54,7 +54,10 @@ class PatchInfo(object):
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
self.name = patch
- f = file(patch)
+ try:
+ f = file(patch)
+ except IOError, msg:
+ raise GbpError, msg
out, dummy = popen.communicate(f.read())
f.close()
self.header = email.message_from_string(out)
@@ -100,11 +103,12 @@ def build_commit_msg(repo, patch, options):
if bts_closes.match(line):
closes += line + '\n'
+ patch_name = os.path.basename(patch.name)
msg="""New patch %s
%s
%s
-%s""" % (patch.name, patch.summary(), thanks, closes)
+%s""" % (patch_name, patch.summary(), thanks, closes)
return msg