git config alias.gcc-verify '!f() { "`git rev-parse --show-toplevel`/contrib/gcc-changelog/git_check_commit.py" $@; } ; f'
git config alias.gcc-backport '!f() { "`git rev-parse --show-toplevel`/contrib/git-backport.py" $@; } ; f'
git config alias.gcc-mklog '!f() { "`git rev-parse --show-toplevel`/contrib/mklog.py" $@; } ; f'
-git config alias.gcc-commit-mklog '!f() { "`git rev-parse --show-toplevel`/contrib/git-commit-mklog.py" $@; }; f'
+git config alias.gcc-commit-mklog '!f() { "`git rev-parse --show-toplevel`/contrib/git-commit-mklog.py" "$@"; }; f'
# Make diff on MD files use "(define" as a function marker.
# Use this in conjunction with a .gitattributes file containing
help='Add the specified PRs (comma separated)')
parser.add_argument('-p', '--fill-up-bug-titles', action='store_true',
help='Download title of mentioned PRs')
+ parser.add_argument('--co',
+ help='Add Co-Authored-By trailer (comma separated)')
args, unknown_args = parser.parse_known_args()
myenv['GCC_FORCE_MKLOG'] = '1'
if mklog_args:
myenv['GCC_MKLOG_ARGS'] = ' '.join(mklog_args)
+ if args.co:
+ for author in args.co.split(','):
+ unknown_args.append(f'--trailer "Co-Authored-By: {author}"')
+
commit_args = ' '.join(unknown_args)
subprocess.run(f'git commit {commit_args}', shell=True, env=myenv)
LINE_LIMIT = 100
TAB_WIDTH = 8
+CO_AUTHORED_BY_PREFIX = 'co-authored-by: '
pr_regex = re.compile(r'(\/(\/|\*)|[Cc*!])\s+(?P<pr>PR [a-z+-]+\/[0-9]+)')
prnum_regex = re.compile(r'PR (?P<comp>[a-z+-]+)/(?P<num>[0-9]+)')
f.write(content)
+def skip_line_in_changelog(line):
+ if line.lower().startswith(CO_AUTHORED_BY_PREFIX) or line.startswith('#'):
+ return False
+ return True
+
+
if __name__ == '__main__':
parser = argparse.ArgumentParser(description=help_message)
parser.add_argument('input', nargs='?',
args.fill_up_bug_titles, args.pr_numbers)
if args.changelog:
lines = open(args.changelog).read().split('\n')
- start = list(takewhile(lambda l: not l.startswith('#'), lines))
+ start = list(takewhile(skip_line_in_changelog, lines))
end = lines[len(start):]
with open(args.changelog, 'w') as f:
if not start or not start[0]: