summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuK1337 <priv.luk@gmail.com>2018-05-13 15:21:14 +0200
committerPaul Keith <javelinanddart@gmail.com>2018-05-13 15:33:21 +0200
commit2e187ce924bdda397632f51c4eb16fde766f5f56 (patch)
tree361cc098fcf9a56f73c1cb456ad79834d5f3b929
parent4cc9064951d3b038f18036f9d4e1da562b787c11 (diff)
downloadscripts-2e187ce924bdda397632f51c4eb16fde766f5f56.tar.gz
scripts-2e187ce924bdda397632f51c4eb16fde766f5f56.tar.bz2
scripts-2e187ce924bdda397632f51c4eb16fde766f5f56.zip
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
-rwxr-xr-xlineage-push/lineage-push.py31
1 files 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(' ')))