lineage-push: Add message support

Change-Id: Ia6a638ff6447ea59a34e288b299d2fa9143424a7
This commit is contained in:
Luca Stefani
2018-04-14 22:58:32 +02:00
parent 6e0ab73c74
commit 422d2a66b5
2 changed files with 13 additions and 2 deletions

View File

@@ -1,8 +1,8 @@
# LineageOS Push Script # LineageOS Push Script
``` ```
usage: lineage-push.py [-h] [-b] [-d] [-e] [-f] [-l LABEL] [-p [PRIVATE]] usage: lineage-push.py [-h] [-b] [-d] [-e] [-f] [-l LABEL] [-m [MESSAGE]]
[-r REF] [-s] [-t TOPIC] [-w [WIP]] [-p [PRIVATE]] [-r REF] [-s] [-t TOPIC] [-w [WIP]]
branch branch
Pushes a local git repository's changes to Gerrit for code review Pushes a local git repository's changes to Gerrit for code review
@@ -18,6 +18,8 @@ optional arguments:
-f, --force force push -f, --force force push
-l LABEL, --label LABEL -l LABEL, --label LABEL
assign label assign label
-m [MESSAGE], --message [MESSAGE]
add message to change
-p [PRIVATE], --private [PRIVATE] -p [PRIVATE], --private [PRIVATE]
upload change as private upload change as private
-r REF, --ref REF push to specified ref -r REF, --ref REF push to specified ref

View File

@@ -7,6 +7,10 @@ import subprocess
import sys import sys
from argparse import ArgumentParser, ArgumentTypeError from argparse import ArgumentParser, ArgumentTypeError
try:
from urllib.parse import quote_plus
except ImportError:
from urllib import quote_plus
def push(args): def push(args):
command = 'git push' command = 'git push'
@@ -61,6 +65,9 @@ def push(args):
elif args.wip == False: elif args.wip == False:
command += '%ready' command += '%ready'
if args.message:
command += '%m={}'.format(quote_plus(args.message))
sys.exit(subprocess.call(command, shell=True)) sys.exit(subprocess.call(command, shell=True))
@@ -86,6 +93,8 @@ def parse_cmdline():
parser.add_argument( parser.add_argument(
'-f', '--force', action='store_true', help='force push') '-f', '--force', action='store_true', help='force push')
parser.add_argument('-l', '--label', help='assign label') parser.add_argument('-l', '--label', help='assign label')
parser.add_argument('-m', '--message', nargs='?',
help='add message to change')
parser.add_argument('-p', '--private', type=str2bool, nargs='?', parser.add_argument('-p', '--private', type=str2bool, nargs='?',
const=True, help='upload change as private') const=True, help='upload change as private')
parser.add_argument( parser.add_argument(