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
This commit is contained in:
LuK1337
2018-05-13 15:21:14 +02:00
committed by Paul Keith
parent 4cc9064951
commit 2e187ce924

View File

@@ -15,6 +15,8 @@ except ImportError:
def push(args): def push(args):
command = 'git push' command = 'git push'
parameters = []
if args.force: if args.force:
command += ' -f' command += ' -f'
@@ -44,37 +46,36 @@ def push(args):
command += args.branch command += args.branch
if args.label: if args.label:
labels = args.label.split(',') for label in args.label.split(','):
command += '%' parameters.append('l={}'.format(label))
for count, label in enumerate(labels):
command += 'l={}'.format(label)
if count != len(labels) - 1:
command += ','
if args.edit: if args.edit:
command += '%edit' parameters.append('edit')
if args.topic: if args.topic:
command += '%topic={}'.format(args.topic) parameters.append('topic={}'.format(args.topic))
if args.hashtag: if args.hashtag:
command += '%hashtag={}'.format(args.hashtag) parameters.append('hashtag={}'.format(args.hashtag))
if args.submit: if args.submit:
command += '%submit' parameters.append('submit')
if args.private == True: if args.private == True:
command += '%private' parameters.append('private')
elif args.private == False: elif args.private == False:
command += '%remove-private' parameters.append('remove-private')
if args.wip == True: if args.wip == True:
command += '%wip' parameters.append('wip')
elif args.wip == False: elif args.wip == False:
command += '%ready' parameters.append('ready')
if args.message: 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(' '))) sys.exit(subprocess.call(command.split(' ')))