diff --git a/lineage-push/README.md b/lineage-push/README.md index 1f9682e..f0a88aa 100644 --- a/lineage-push/README.md +++ b/lineage-push/README.md @@ -1,8 +1,8 @@ # LineageOS Push Script ``` -usage: lineage-push.py [-h] [-b] [-d] [-e] [-f] [-l LABEL] [-p [PRIVATE]] - [-r REF] [-s] [-t TOPIC] [-w [WIP]] +usage: lineage-push.py [-h] [-b] [-d] [-e] [-f] [-l LABEL] [-m [MESSAGE]] + [-p [PRIVATE]] [-r REF] [-s] [-t TOPIC] [-w [WIP]] branch Pushes a local git repository's changes to Gerrit for code review @@ -18,6 +18,8 @@ optional arguments: -f, --force force push -l LABEL, --label LABEL assign label + -m [MESSAGE], --message [MESSAGE] + add message to change -p [PRIVATE], --private [PRIVATE] upload change as private -r REF, --ref REF push to specified ref diff --git a/lineage-push/lineage-push.py b/lineage-push/lineage-push.py index 94146c6..0635116 100755 --- a/lineage-push/lineage-push.py +++ b/lineage-push/lineage-push.py @@ -7,6 +7,10 @@ import subprocess import sys from argparse import ArgumentParser, ArgumentTypeError +try: + from urllib.parse import quote_plus +except ImportError: + from urllib import quote_plus def push(args): command = 'git push' @@ -61,6 +65,9 @@ def push(args): elif args.wip == False: command += '%ready' + if args.message: + command += '%m={}'.format(quote_plus(args.message)) + sys.exit(subprocess.call(command, shell=True)) @@ -86,6 +93,8 @@ def parse_cmdline(): parser.add_argument( '-f', '--force', action='store_true', help='force push') 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='?', const=True, help='upload change as private') parser.add_argument(