From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id 9C5DE383541A; Fri, 22 Jul 2022 11:19:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9C5DE383541A MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Martin Liska To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-1798] Allow space in git commit-mklog args X-Act-Checkin: gcc X-Git-Author: Martin Liska X-Git-Refname: refs/heads/master X-Git-Oldrev: 786e51648bd9a6880339329380751809fb97cd6d X-Git-Newrev: 18ef76d3a1701c4dd7ab38ebda5c374b6bc13041 Message-Id: <20220722111941.9C5DE383541A@sourceware.org> Date: Fri, 22 Jul 2022 11:19:41 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jul 2022 11:19:41 -0000 https://gcc.gnu.org/g:18ef76d3a1701c4dd7ab38ebda5c374b6bc13041 commit r13-1798-g18ef76d3a1701c4dd7ab38ebda5c374b6bc13041 Author: Martin Liska Date: Fri Jul 22 11:26:08 2022 +0200 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. Diff: --- contrib/git-commit-mklog.py | 9 +++++---- contrib/mklog.py | 5 +++++ contrib/prepare-commit-msg | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/contrib/git-commit-mklog.py b/contrib/git-commit-mklog.py index eda3fc4a892..c7e90c8262f 100755 --- a/contrib/git-commit-mklog.py +++ b/contrib/git-commit-mklog.py @@ -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(','): diff --git a/contrib/mklog.py b/contrib/mklog.py index 8693767a7f6..91c0dcd8864 100755 --- a/contrib/mklog.py +++ b/contrib/mklog.py @@ -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)') diff --git a/contrib/prepare-commit-msg b/contrib/prepare-commit-msg index 5da878458cd..969847df6f4 100755 --- a/contrib/prepare-commit-msg +++ b/contrib/prepare-commit-msg @@ -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"