From 2e187ce924bdda397632f51c4eb16fde766f5f56 Mon Sep 17 00:00:00 2001 From: LuK1337 Date: Sun, 13 May 2018 15:21:14 +0200 Subject: [PATCH] lineage-push: Improve parsing parameters * Gerrit doesn't support chained commands by bluntly appending (%command1%command2%...), but rather by comma separating them (%command1,command2,...) Change-Id: I58cf5db3c1ba79788b7e26a483e0b01aef65104b --- lineage-push/lineage-push.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/lineage-push/lineage-push.py b/lineage-push/lineage-push.py index 425c938..480a51b 100755 --- a/lineage-push/lineage-push.py +++ b/lineage-push/lineage-push.py @@ -15,6 +15,8 @@ except ImportError: def push(args): command = 'git push' + parameters = [] + if args.force: command += ' -f' @@ -44,37 +46,36 @@ def push(args): command += args.branch if args.label: - labels = args.label.split(',') - command += '%' - for count, label in enumerate(labels): - command += 'l={}'.format(label) - if count != len(labels) - 1: - command += ',' + for label in args.label.split(','): + parameters.append('l={}'.format(label)) if args.edit: - command += '%edit' + parameters.append('edit') if args.topic: - command += '%topic={}'.format(args.topic) + parameters.append('topic={}'.format(args.topic)) if args.hashtag: - command += '%hashtag={}'.format(args.hashtag) + parameters.append('hashtag={}'.format(args.hashtag)) if args.submit: - command += '%submit' + parameters.append('submit') if args.private == True: - command += '%private' + parameters.append('private') elif args.private == False: - command += '%remove-private' + parameters.append('remove-private') if args.wip == True: - command += '%wip' + parameters.append('wip') elif args.wip == False: - command += '%ready' + parameters.append('ready') if args.message: - command += '%m={}'.format(quote_plus(args.message)) + parameters.append('m={}'.format(quote_plus(args.message))) + + if len(parameters) > 0: + command += "%" + ','.join(parameters) sys.exit(subprocess.call(command.split(' ')))