summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Stefani <luca.stefani.ge1@gmail.com>2018-04-14 22:58:32 +0200
committerLuca Stefani <luca.stefani.ge1@gmail.com>2018-04-14 23:21:12 +0200
commit422d2a66b5b0804b67132c5ab64ee4183d2e3ab0 (patch)
tree87d8ff4357555fc356e1d371c0ca6729cea7ef4b
parent6e0ab73c747eaa299d17433ac49155a1c628b22e (diff)
downloadscripts-422d2a66b5b0804b67132c5ab64ee4183d2e3ab0.tar.gz
scripts-422d2a66b5b0804b67132c5ab64ee4183d2e3ab0.tar.bz2
scripts-422d2a66b5b0804b67132c5ab64ee4183d2e3ab0.zip
lineage-push: Add message support
Change-Id: Ia6a638ff6447ea59a34e288b299d2fa9143424a7
-rw-r--r--lineage-push/README.md6
-rwxr-xr-xlineage-push/lineage-push.py9
2 files changed, 13 insertions, 2 deletions
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(