From 07d54efbe86b1d93805a1a3a78eca45c32bc5734 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Sun, 31 Jan 2010 18:24:01 +0100 Subject: gbp-add-patch: Strip path from patchname and handle missing files gracefully. --- examples/gbp-add-patch | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/gbp-add-patch b/examples/gbp-add-patch index 905831d..357e31c 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 -- cgit v1.2.3