Hi, this patch allows mklog.py to be called with a commit hash directly. So, instead of
git show <commit> | git gcc-mklog git gcc-mklog --commit <commit> can be used. When no <commit> is given but --commit is specified, HEAD is used instead. The behavior without --commit is the same as before. Is that useful/OK? I find that option a bit easier to work with. Regards Robin contrib/ChangeLog: * mklog.py: Add optional --commit <commit> argument. --- contrib/mklog.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/contrib/mklog.py b/contrib/mklog.py index 777212c98d7..25a3b6c0757 100755 --- a/contrib/mklog.py +++ b/contrib/mklog.py @@ -358,13 +358,23 @@ if __name__ == '__main__': 'file') parser.add_argument('--update-copyright', action='store_true', help='Update copyright in ChangeLog files') + parser.add_argument('--commit', const='HEAD', nargs='?', + help='Use a specific commit instead of a ' + 'patch file or stdin. (essentially git show ' + 'commit-id | git gcc-mklog)') args = parser.parse_args() if args.input == '-': args.input = None if args.directory: root = args.directory - data = open(args.input, newline='\n') if args.input else sys.stdin + if args.commit: + args.input = None + data = subprocess.check_output('git show {}'.format(args.commit), + shell=True, encoding='utf8').strip() + else: + data = open(args.input, newline='\n') if args.input else sys.stdin + if args.update_copyright: update_copyright(data) else: -- 2.40.0