> Quite interesting idea! Are you willing to prepare a patch for it? This works.
diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py index bd8c1ff7af2..58aad8b7f26 100755 --- a/contrib/gcc-changelog/git_commit.py +++ b/contrib/gcc-changelog/git_commit.py @@ -157,6 +157,7 @@ author_line_regex = \ additional_author_regex = re.compile(r'^\t(?P<spaces>\ *)?(?P<name>.* <.*>)') changelog_regex = re.compile(r'^(?:[fF]or +)?([a-z0-9+-/]*)ChangeLog:?') pr_regex = re.compile(r'\tPR (?P<component>[a-z+-]+\/)?([0-9]+)$') +title_pr_regex = re.compile(r' \[PR ?[0-9]+]$') dr_regex = re.compile(r'\tDR ([0-9]+)$') star_prefix_regex = re.compile(r'\t\*(?P<spaces>\ *)(?P<content>.*)') end_of_location_regex = re.compile(r'[\[<(:]') @@ -343,6 +344,7 @@ class GitCommit: self.check_for_broken_parentheses() self.deduce_changelog_locations() self.check_file_patterns() + self.check_pr_consistent() if not self.errors: self.check_mentioned_files() self.check_for_correct_changelog() @@ -568,6 +570,17 @@ class GitCommit: msg = 'unsupported wildcard prefix' self.errors.append(Error(msg, name)) + def check_pr_consistent(self): + """Check that a 'PR component/nnn' line is present if the first + line ends with a bug number like [PRnnn] or [PR nnn].""" + m = title_pr_regex.search(self.info.lines[0]) + if m: + for line in self.changes: + if pr_regex.match(line): + return + msg = 'summary contains "%s" but no PR in changelog' + self.errors.append(Error(msg % m.group())) + def check_for_empty_description(self): for entry in self.changelog_entries: for i, line in enumerate(entry.lines):