summaryrefslogtreecommitdiff
path: root/contrib/mklog.py
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2021-08-17 14:57:40 +0200
committerMartin Liska <mliska@suse.cz>2021-08-18 10:36:35 +0200
commit0684c8d3effab2c9c1b29938f5e56c77106af564 (patch)
treeabf1088f6a04e30c0d637a3eecccf019871fc1ca /contrib/mklog.py
parent1bf976a5de69ecd9b1e10eb7515357b98e78faf7 (diff)
downloadgcc-0684c8d3effab2c9c1b29938f5e56c77106af564.tar.gz
commit-mklog: Add --co argument.
The argument can be used for addition of Co-Authored-By lines with --trailer='Co-Authored-By=Mona Lisa Octocat <mona@github.com>'. contrib/ChangeLog: * gcc-git-customization.sh: Wrap $@ in quotes. * git-commit-mklog.py: Add new argument --co. * mklog.py: Skip the Co-Authored-By lines.
Diffstat (limited to 'contrib/mklog.py')
-rwxr-xr-xcontrib/mklog.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/contrib/mklog.py b/contrib/mklog.py
index d2aea85c7cc..d362be5ab10 100755
--- a/contrib/mklog.py
+++ b/contrib/mklog.py
@@ -40,6 +40,7 @@ from unidiff import PatchSet
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]+)')
@@ -317,6 +318,12 @@ def update_copyright(data):
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='?',
@@ -350,7 +357,7 @@ if __name__ == '__main__':
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]: