summaryrefslogtreecommitdiffstats
path: root/apps/patchwork/bin
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2014-11-22 20:38:46 -0800
committerJeremy Kerr <jk@ozlabs.org>2015-03-22 21:08:30 +0800
commit52ef32ce109ac96b6dc63a66997e39c83ad23d59 (patch)
treeeae8cb2d3e10e4f6a9e68dfa00398af0c0ea7af4 /apps/patchwork/bin
parent7e072a3308fb43fba06e94e9b30d8c9f1638a77b (diff)
downloadpatchwork-52ef32ce109ac96b6dc63a66997e39c83ad23d59.tar.bz2
patchwork-52ef32ce109ac96b6dc63a66997e39c83ad23d59.tar.xz
pwclient: exit on first patch which fails to apply
When run with more than one patch ID, the 'apply' and 'git-am' commands should not continue to process other patches if an earlier one failed. We should stop so the user can address the situation. Future work: it'd be nice to just pipe all the patches at once to git-am, so that git's nice handling of fixup-and-continue workflow can be used. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'apps/patchwork/bin')
-rwxr-xr-xapps/patchwork/bin/pwclient11
1 files changed, 9 insertions, 2 deletions
diff --git a/apps/patchwork/bin/pwclient b/apps/patchwork/bin/pwclient
index 483330e..38d604e 100755
--- a/apps/patchwork/bin/pwclient
+++ b/apps/patchwork/bin/pwclient
@@ -269,6 +269,7 @@ def action_apply(rpc, patch_id, apply_cmd=None):
if len(s) > 0:
proc = subprocess.Popen(apply_cmd, stdin = subprocess.PIPE)
proc.communicate(unicode(s).encode('utf-8'))
+ return proc.returncode
else:
sys.stderr.write("Error: No patch content found\n")
sys.exit(1)
@@ -684,14 +685,20 @@ def main():
elif action == 'apply':
for patch_id in non_empty(h, patch_ids):
- action_apply(rpc, patch_id)
+ ret = action_apply(rpc, patch_id)
+ if ret:
+ sys.stderr.write("Apply failed with exit status %d\n" % ret)
+ sys.exit(1)
elif action == 'git_am':
cmd = ['git', 'am']
if do_signoff:
cmd.append('-s')
for patch_id in non_empty(h, patch_ids):
- action_apply(rpc, patch_id, cmd)
+ ret = action_apply(rpc, patch_id, cmd)
+ if ret:
+ sys.stderr.write("'git am' failed with exit status %d\n" % ret)
+ sys.exit(1)
elif action == 'update':
for patch_id in non_empty(h, patch_ids):