diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2014-09-08 17:24:24 +0200 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2014-11-10 20:13:11 +0800 |
commit | 9517d2c5c0e164e67db2b02bca552fc1c6b2fb3e (patch) | |
tree | 798e33227376473cd9d56ca2458c9c75e0d1ca1e | |
parent | 0d115b8dee323e41bd23cc16f8119e9f8ad9293a (diff) | |
download | patchwork-9517d2c5c0e164e67db2b02bca552fc1c6b2fb3e.tar.bz2 patchwork-9517d2c5c0e164e67db2b02bca552fc1c6b2fb3e.tar.xz |
pwclient: Rephrase patch_ids iterator
Don't generate an empty array, use for-loop instead
as noticed by Jacob E. Keller
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
-rwxr-xr-x | apps/patchwork/bin/pwclient | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/apps/patchwork/bin/pwclient b/apps/patchwork/bin/pwclient index b12e816..b86949c 100755 --- a/apps/patchwork/bin/pwclient +++ b/apps/patchwork/bin/pwclient @@ -646,26 +646,30 @@ def main(): if len(s) > 0: print unicode(s).encode("utf-8") - elif action in ('get', 'save', 'info'): - if action == 'info': - [action_info(rpc, patch_id) for patch_id in non_empty(h, patch_ids)] - else: - [action_get(rpc, patch_id) for patch_id in non_empty(h, patch_ids)] + elif action == 'info': + for patch_id in non_empty(h, patch_ids): + action_info(rpc, patch_id) + + elif action in ('get', 'save'): + for patch_id in non_empty(h, patch_ids): + action_get(rpc, patch_id) elif action == 'apply': - [action_apply(rpc, patch_id) for patch_id in non_empty(h, patch_ids)] + for patch_id in non_empty(h, patch_ids): + action_apply(rpc, patch_id) elif action == 'git_am': cmd = ['git', 'am'] if do_signoff: cmd.append('-s') - [action_apply(rpc, patch_id, cmd) for patch_id in - non_empty(h, patch_ids)] + for patch_id in non_empty(h, patch_ids): + action_apply(rpc, patch_id, cmd) elif action == 'update': - [action_update_patch(rpc, patch_id, state = state_str, + for patch_id in non_empty(h, patch_ids): + action_update_patch(rpc, patch_id, state = state_str, commit = commit_str - ) for patch_id in non_empty(h, patch_ids)] + ) else: sys.stderr.write("Unknown action '%s'\n" % action) |