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):
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(' ')))