Allow space in git commit-mklog args

contrib/ChangeLog:

	* git-commit-mklog.py: Do not parse -b argument.
	Pass mklog_args as json environment variable.
	* mklog.py: Parse GCC_MKLOG_ARGS and append it to sys.argv.
	* prepare-commit-msg: Do not append GCC_MKLOG_ARGS to args.
This commit is contained in:
Martin Liska
2022-07-22 11:26:08 +02:00
parent 786e51648b
commit 18ef76d3a1
3 changed files with 11 additions and 5 deletions

View File

@@ -24,6 +24,7 @@
# to mklog.py script.
import argparse
import json
import os
import subprocess
@@ -32,8 +33,7 @@ if __name__ == '__main__':
myenv = os.environ.copy()
parser = argparse.ArgumentParser(description='git-commit-mklog wrapped')
parser.add_argument('-b', '--pr-numbers', action='store',
type=lambda arg: arg.split(','), nargs='?',
parser.add_argument('-b', '--pr-numbers',
help='Add the specified PRs (comma separated)')
parser.add_argument('-p', '--fill-up-bug-titles', action='store_true',
help='Download title of mentioned PRs')
@@ -44,12 +44,13 @@ if __name__ == '__main__':
myenv['GCC_FORCE_MKLOG'] = '1'
mklog_args = []
if args.pr_numbers:
mklog_args.append(f'-b {",".join(args.pr_numbers)}')
mklog_args += ['-b', args.pr_numbers]
if args.fill_up_bug_titles:
mklog_args.append('-p')
if mklog_args:
myenv['GCC_MKLOG_ARGS'] = ' '.join(mklog_args)
# wrap mklog arguments with JSON
myenv['GCC_MKLOG_ARGS'] = json.dumps(mklog_args)
if args.co:
for author in args.co.split(','):

View File

@@ -28,6 +28,7 @@
import argparse
import datetime
import json
import os
import re
import subprocess
@@ -332,6 +333,10 @@ def skip_line_in_changelog(line):
if __name__ == '__main__':
extra_args = os.getenv('GCC_MKLOG_ARGS')
if extra_args:
sys.argv += json.loads(extra_args)
parser = argparse.ArgumentParser(description=help_message)
parser.add_argument('input', nargs='?',
help='Patch file (or missing, read standard input)')

View File

@@ -78,4 +78,4 @@ else
tee="cat"
fi
git $cmd | $tee | git gcc-mklog $GCC_MKLOG_ARGS -c "$COMMIT_MSG_FILE"
git $cmd | $tee | git gcc-mklog -c "$COMMIT_MSG_FILE"