Message ID | 20250311165708.963372-1-christophe.lyon@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7BF2D385783B for <patchwork@sourceware.org>; Tue, 11 Mar 2025 16:58:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7BF2D385783B Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=hCRyni+N X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-oa1-x2c.google.com (mail-oa1-x2c.google.com [IPv6:2001:4860:4864:20::2c]) by sourceware.org (Postfix) with ESMTPS id 9D3073857BA7 for <gcc-patches@gcc.gnu.org>; Tue, 11 Mar 2025 16:57:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9D3073857BA7 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9D3073857BA7 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4860:4864:20::2c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1741712233; cv=none; b=trmaEP/I62I5tIzFujPeGxxvm26TlOlxDTW5sVZCVnyeLoX4Aah/ZEp7Dc/fXtoTDOqIXCJtXoEt0MHo78fejCC+KiX/V3Z9DHXdYUFHUxFuRkVaTuKbbkZQ6j0WIoOnv4BsEdfr5FbNg8ktYBY/r7EHfcDxLCINjneFutIFmu8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1741712233; c=relaxed/simple; bh=WmgFFjZDI/H7AR+znXHTGzJMl6HiZ5paLl5LGiXJW2U=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=UpTTsLz1wgqZBUOrzMnSVeeNCu8wf8WUeH3bQJkQ61paW21CsJu0VbTj3WBOiNGI6hVqueFQd1jlZ3nwS593v6ADBohAji+i5eXiJoOdMU2qOhj3wL4xuB/cKhPLvtvCrjoEvcnHneLuujjzSLdePcnPQXHitFSU7UgRwxl+whY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9D3073857BA7 Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-2c118155de0so1758746fac.3 for <gcc-patches@gcc.gnu.org>; Tue, 11 Mar 2025 09:57:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741712232; x=1742317032; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=QPzemuVXCanARMw0xCsxQY2iRwH0kOw0+lYYRtwotHM=; b=hCRyni+Nv0ck3z8ytQ+6lfDSoOaHR3yR6L2HuX8J+8ca366VpnypbXJLhWmg9vlmBU 7ui9o3JbF+mvOduhv4AMGas8Xj2yFRIxkJAccD3s75/3AQlptLwjqWYcWZ3pZMnsLNcA PKAs/+j1v/NevVZgxwzw4RREGJp+P4V/WPA1huN0ty8mBIYiYCGhfn1ffrwvjcTFvhl6 Bs1MUkSbrUujCefAF935QC24CKsNvDsoFo1OirGIDnCZxNS4nT6QOYQ7/9di/nQgd89s Hbb+W0v6TA8Dag1jXI6ma1yHujFbcRey0OBf84kYTmROaGl3vf8RfrCTe4B2+QE7S4zk InKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741712232; x=1742317032; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QPzemuVXCanARMw0xCsxQY2iRwH0kOw0+lYYRtwotHM=; b=wD7uAvGiY45CY9I1BUVKc6lbRjR+UaVPBGRS0gPlJVeWWPkIuJcs77ookJoKO2+4Uz qjvH3XOE7JIqbbb3Jrx9MMA3QGom0AbLwrHmjezv3jvGIOwMVgRZr5nEOYlBIghc6/AQ OqDdqkRcyES1fGEmYUclAWqYl01o+WlCGLY9Kd6604R1vRmmg9n48eUi8Hk3U3UTBkcU h7eloPsGNj4uEpyuxdrF8h/43xkWmWAQ4qpPOeuPh9Lj34PfA7VI+HOsNm+p/6UAsQdz O4F/whwyjBch+GueTwsPM70fgBsagpxzWOt9feVgzZIu0PjB8JulTCPwHvZh4d3k5gm2 rOrQ== X-Gm-Message-State: AOJu0Ywgoomjkk3jDm270cFeKuH8RcLS3eqdzGY4p6cO0qUkn/XZ0++y tmYTD1075gzOTG4a4ShrjTLfm5nxOS06189w03WZEFlzR2Dschy9d1Yc1h8ABJyMxvH6fULYJPy ivw0lbA== X-Gm-Gg: ASbGnctwEiXygXnVNmJ3ApcZnm58RCmwiFtJJ5E0hbqOyO2bN+5Ormkife+JDQMuCB+ 4y4Yh/ostVGProa+3F2AWogbCBs3+oOmJXAKwiKHJMPFTrlIrzFv1eYNS/jBdiRNTi0LkA4kUqZ w5hXq6JNic4mCUm8a5zWr8bQBlx7vvmvU3pF5aqgr6t54me64EcrDk0xx9JhYfHQmc9hRQFIW2a RRHojGvwj6dBXnW9Tlrcudj+cs+yzt+VnkMivFq1eReblQtYjxwTzwB4RhaDe9dUDjnufEqsobi XnIepSNqVT71aBVyR/O1xfzzfSvHDSp+jxIH6ewdv7ltXU5iHhxkXgugxePl0c/5Xis= X-Google-Smtp-Source: AGHT+IGx+ULS+jAlnEbMRAd/Uc3i2qu859CE1n+L2M74LFMqJz+qsZe8xvHgvOq5TIHd3guK3rH+0g== X-Received: by 2002:a05:6870:ce8e:b0:29e:76d1:db3b with SMTP id 586e51a60fabf-2c260f9356dmr10753620fac.5.1741712232212; Tue, 11 Mar 2025 09:57:12 -0700 (PDT) Received: from localhost.localdomain ([139.178.84.207]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2c248831c65sm2671047fac.9.2025.03.11.09.57.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 09:57:11 -0700 (PDT) From: Christophe Lyon <christophe.lyon@linaro.org> To: gcc-patches@gcc.gnu.org Cc: jakub@redhat.com, jwakely@redhat.com, tburnus@baylibre.com, Christophe Lyon <christophe.lyon@linaro.org> Subject: [PATCH] contrib/gcc-changelog: Accept only [PRnnnn] in subject Date: Tue, 11 Mar 2025 16:57:08 +0000 Message-Id: <20250311165708.963372-1-christophe.lyon@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org |
Series |
contrib/gcc-changelog: Accept only [PRnnnn] in subject
|
|
Commit Message
Christophe Lyon
March 11, 2025, 4:57 p.m. UTC
In https://gcc.gnu.org/contribute.html#patches we ask to use [PRnnnn] without the Bugzilla component identifier and with no space between 'PR' and the number, but git_check_commit.py accepts all forms. The patch enforces what we document. Note that this would reject a few of the recent commits. contrib/ChangeLog: * gcc-changelog/git_commit.py (subject_pr_regex): Rename into subject_pr_component_regex. (subject_pr_space_regex): New. (subject_pr_paren_regex): New. (subject_pr2_regex): Remove matching parentheses and rename into subject_pr_regex. (GitCommit): Add checks for new regexps. --- contrib/gcc-changelog/git_commit.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
Comments
On Tue, 11 Mar 2025 at 16:57, Christophe Lyon <christophe.lyon@linaro.org> wrote: > > In https://gcc.gnu.org/contribute.html#patches we ask to use [PRnnnn] > without the Bugzilla component identifier and with no space between > 'PR' and the number, but git_check_commit.py accepts all forms. The > patch enforces what we document. > > Note that this would reject a few of the recent commits. > > contrib/ChangeLog: > > * gcc-changelog/git_commit.py (subject_pr_regex): Rename into > subject_pr_component_regex. > (subject_pr_space_regex): New. > (subject_pr_paren_regex): New. > (subject_pr2_regex): Remove matching parentheses and rename into > subject_pr_regex. > (GitCommit): Add checks for new regexps. > --- > contrib/gcc-changelog/git_commit.py | 20 ++++++++++++-------- > 1 file changed, 12 insertions(+), 8 deletions(-) > > diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py > index 5c0596c2627..245c8496553 100755 > --- a/contrib/gcc-changelog/git_commit.py > +++ b/contrib/gcc-changelog/git_commit.py > @@ -167,8 +167,10 @@ author_line_regex = \ > re.compile(r'^(?P<datetime>\d{4}-\d{2}-\d{2})\ {2}(?P<name>.* <.*>)') > additional_author_regex = re.compile(r'^\t(?P<spaces>\ *)?(?P<name>.* <.*>)') > changelog_regex = re.compile(r'^(?:[fF]or +)?([a-z0-9+-/]*)ChangeLog:?') > -subject_pr_regex = re.compile(r'(^|\W)PR\s+(?P<component>[a-zA-Z0-9+-]+)/(?P<pr>\d{4,7})') > -subject_pr2_regex = re.compile(r'[(\[]PR\s*(?P<pr>\d{4,7})[)\]]') > +subject_pr_regex = re.compile(r'\[PR(?P<pr>\d{4,7})\]') # [PRnnnn] > +subject_pr_space_regex = re.compile(r'\[PR\s+(?P<pr>\d{4,7})\]') # [PR nnnn] > +subject_pr_paren_regex = re.compile(r'\(PR\s*(?P<pr>\d{4,7})\)') # (PRnnnn) / (PR nnnn) > +subject_pr_component_regex = re.compile(r'(^|\W)PR\s*(?P<component>[a-zA-Z0-9+-]+)/(?P<pr>\d{4,7})') # PRcomponent/nnnn or PR component/nnnn > pr_regex = re.compile(r'\tPR (?P<component>[a-z0-9+-]+\/)?(?P<pr>[0-9]+)$') > dr_regex = re.compile(r'\tDR ([0-9]+)$') > star_prefix_regex = re.compile(r'\t\*(?P<spaces>\ *)(?P<content>.*)') > @@ -346,13 +348,15 @@ class GitCommit: > self.check_commit_email() > > # Extract PR numbers form the subject line > - # Match either [PRnnnn] / (PRnnnn) or PR component/nnnn > + # Reject [PR nnnn] / (PR nnnn) or PR component/nnnn > if self.info.lines and not self.revert_commit: > - self.subject_prs = {m.group('pr') for m in subject_pr2_regex.finditer(info.lines[0])} > - for m in subject_pr_regex.finditer(info.lines[0]): > - if not m.group('component') in bug_components: > - self.errors.append(Error('invalid PR component in subject', info.lines[0])) > - self.subject_prs.add(m.group('pr')) > + self.subject_prs = {m.group('pr') for m in subject_pr_regex.finditer(info.lines[0])} > + for m in subject_pr_space_regex.finditer(info.lines[0]): > + self.errors.append(Error('Use [PRnnn] in subject, not [PR nnn]', info.lines[0])) > + for m in subject_pr_paren_regex.finditer(info.lines[0]): > + self.errors.append(Error('Use [PRnnn] in subject, not (PRnnn)', info.lines[0])) > + for m in subject_pr_component_regex.finditer(info.lines[0]): > + self.errors.append(Error('Do not use PR component in subject', info.lines[0])) Maybe "Do not use PR component/nnn in subject" here? Otherwise I like the change and the patch looks correct (but I'm not an approver for contrib). > > # Allow complete deletion of ChangeLog files in a commit > project_files = [f for f in self.info.modified_files > -- > 2.34.1 >
On Tue, Mar 11, 2025 at 5:58 PM Christophe Lyon <christophe.lyon@linaro.org> wrote: > > In https://gcc.gnu.org/contribute.html#patches we ask to use [PRnnnn] > without the Bugzilla component identifier and with no space between > 'PR' and the number, but git_check_commit.py accepts all forms. The > patch enforces what we document. > > Note that this would reject a few of the recent commits. Why would we be this restrictive? I personally am using bugzilla-component/number - description IMO 'PR' is redundant and the component helps screening for area of maintenance. That said, I suppose my form wouldn't be rejected, so I'm happy. I just wonder why we should force something I don't remember we discussed at any point. Richard. > contrib/ChangeLog: > > * gcc-changelog/git_commit.py (subject_pr_regex): Rename into > subject_pr_component_regex. > (subject_pr_space_regex): New. > (subject_pr_paren_regex): New. > (subject_pr2_regex): Remove matching parentheses and rename into > subject_pr_regex. > (GitCommit): Add checks for new regexps. > --- > contrib/gcc-changelog/git_commit.py | 20 ++++++++++++-------- > 1 file changed, 12 insertions(+), 8 deletions(-) > > diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py > index 5c0596c2627..245c8496553 100755 > --- a/contrib/gcc-changelog/git_commit.py > +++ b/contrib/gcc-changelog/git_commit.py > @@ -167,8 +167,10 @@ author_line_regex = \ > re.compile(r'^(?P<datetime>\d{4}-\d{2}-\d{2})\ {2}(?P<name>.* <.*>)') > additional_author_regex = re.compile(r'^\t(?P<spaces>\ *)?(?P<name>.* <.*>)') > changelog_regex = re.compile(r'^(?:[fF]or +)?([a-z0-9+-/]*)ChangeLog:?') > -subject_pr_regex = re.compile(r'(^|\W)PR\s+(?P<component>[a-zA-Z0-9+-]+)/(?P<pr>\d{4,7})') > -subject_pr2_regex = re.compile(r'[(\[]PR\s*(?P<pr>\d{4,7})[)\]]') > +subject_pr_regex = re.compile(r'\[PR(?P<pr>\d{4,7})\]') # [PRnnnn] > +subject_pr_space_regex = re.compile(r'\[PR\s+(?P<pr>\d{4,7})\]') # [PR nnnn] > +subject_pr_paren_regex = re.compile(r'\(PR\s*(?P<pr>\d{4,7})\)') # (PRnnnn) / (PR nnnn) > +subject_pr_component_regex = re.compile(r'(^|\W)PR\s*(?P<component>[a-zA-Z0-9+-]+)/(?P<pr>\d{4,7})') # PRcomponent/nnnn or PR component/nnnn > pr_regex = re.compile(r'\tPR (?P<component>[a-z0-9+-]+\/)?(?P<pr>[0-9]+)$') > dr_regex = re.compile(r'\tDR ([0-9]+)$') > star_prefix_regex = re.compile(r'\t\*(?P<spaces>\ *)(?P<content>.*)') > @@ -346,13 +348,15 @@ class GitCommit: > self.check_commit_email() > > # Extract PR numbers form the subject line > - # Match either [PRnnnn] / (PRnnnn) or PR component/nnnn > + # Reject [PR nnnn] / (PR nnnn) or PR component/nnnn > if self.info.lines and not self.revert_commit: > - self.subject_prs = {m.group('pr') for m in subject_pr2_regex.finditer(info.lines[0])} > - for m in subject_pr_regex.finditer(info.lines[0]): > - if not m.group('component') in bug_components: > - self.errors.append(Error('invalid PR component in subject', info.lines[0])) > - self.subject_prs.add(m.group('pr')) > + self.subject_prs = {m.group('pr') for m in subject_pr_regex.finditer(info.lines[0])} > + for m in subject_pr_space_regex.finditer(info.lines[0]): > + self.errors.append(Error('Use [PRnnn] in subject, not [PR nnn]', info.lines[0])) > + for m in subject_pr_paren_regex.finditer(info.lines[0]): > + self.errors.append(Error('Use [PRnnn] in subject, not (PRnnn)', info.lines[0])) > + for m in subject_pr_component_regex.finditer(info.lines[0]): > + self.errors.append(Error('Do not use PR component in subject', info.lines[0])) > > # Allow complete deletion of ChangeLog files in a commit > project_files = [f for f in self.info.modified_files > -- > 2.34.1 >
On Wed, 12 Mar 2025 at 08:05, Richard Biener <richard.guenther@gmail.com> wrote: > > On Tue, Mar 11, 2025 at 5:58 PM Christophe Lyon > <christophe.lyon@linaro.org> wrote: > > > > In https://gcc.gnu.org/contribute.html#patches we ask to use [PRnnnn] > > without the Bugzilla component identifier and with no space between > > 'PR' and the number, but git_check_commit.py accepts all forms. The > > patch enforces what we document. > > > > Note that this would reject a few of the recent commits. > > Why would we be this restrictive? I personally am using Well, someone made me realize that I should have used [PRnnnn] rather than (PR nnnn) in a recent commit, as documented in "Contributing to GCC". Since I use gcc-verify, I looked at why I missed that, and hence proposed this patch, so that our tools match what we document.... > > bugzilla-component/number - description > > IMO 'PR' is redundant and the component helps screening for area of > maintenance. > > That said, I suppose my form wouldn't be rejected, so I'm happy. I just > wonder why we should force something I don't remember we discussed > at any point. > .... so another alternative is to change our document, to match the actual practice and what the tools do? Thanks, Christophe > Richard. > > > contrib/ChangeLog: > > > > * gcc-changelog/git_commit.py (subject_pr_regex): Rename into > > subject_pr_component_regex. > > (subject_pr_space_regex): New. > > (subject_pr_paren_regex): New. > > (subject_pr2_regex): Remove matching parentheses and rename into > > subject_pr_regex. > > (GitCommit): Add checks for new regexps. > > --- > > contrib/gcc-changelog/git_commit.py | 20 ++++++++++++-------- > > 1 file changed, 12 insertions(+), 8 deletions(-) > > > > diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py > > index 5c0596c2627..245c8496553 100755 > > --- a/contrib/gcc-changelog/git_commit.py > > +++ b/contrib/gcc-changelog/git_commit.py > > @@ -167,8 +167,10 @@ author_line_regex = \ > > re.compile(r'^(?P<datetime>\d{4}-\d{2}-\d{2})\ {2}(?P<name>.* <.*>)') > > additional_author_regex = re.compile(r'^\t(?P<spaces>\ *)?(?P<name>.* <.*>)') > > changelog_regex = re.compile(r'^(?:[fF]or +)?([a-z0-9+-/]*)ChangeLog:?') > > -subject_pr_regex = re.compile(r'(^|\W)PR\s+(?P<component>[a-zA-Z0-9+-]+)/(?P<pr>\d{4,7})') > > -subject_pr2_regex = re.compile(r'[(\[]PR\s*(?P<pr>\d{4,7})[)\]]') > > +subject_pr_regex = re.compile(r'\[PR(?P<pr>\d{4,7})\]') # [PRnnnn] > > +subject_pr_space_regex = re.compile(r'\[PR\s+(?P<pr>\d{4,7})\]') # [PR nnnn] > > +subject_pr_paren_regex = re.compile(r'\(PR\s*(?P<pr>\d{4,7})\)') # (PRnnnn) / (PR nnnn) > > +subject_pr_component_regex = re.compile(r'(^|\W)PR\s*(?P<component>[a-zA-Z0-9+-]+)/(?P<pr>\d{4,7})') # PRcomponent/nnnn or PR component/nnnn > > pr_regex = re.compile(r'\tPR (?P<component>[a-z0-9+-]+\/)?(?P<pr>[0-9]+)$') > > dr_regex = re.compile(r'\tDR ([0-9]+)$') > > star_prefix_regex = re.compile(r'\t\*(?P<spaces>\ *)(?P<content>.*)') > > @@ -346,13 +348,15 @@ class GitCommit: > > self.check_commit_email() > > > > # Extract PR numbers form the subject line > > - # Match either [PRnnnn] / (PRnnnn) or PR component/nnnn > > + # Reject [PR nnnn] / (PR nnnn) or PR component/nnnn > > if self.info.lines and not self.revert_commit: > > - self.subject_prs = {m.group('pr') for m in subject_pr2_regex.finditer(info.lines[0])} > > - for m in subject_pr_regex.finditer(info.lines[0]): > > - if not m.group('component') in bug_components: > > - self.errors.append(Error('invalid PR component in subject', info.lines[0])) > > - self.subject_prs.add(m.group('pr')) > > + self.subject_prs = {m.group('pr') for m in subject_pr_regex.finditer(info.lines[0])} > > + for m in subject_pr_space_regex.finditer(info.lines[0]): > > + self.errors.append(Error('Use [PRnnn] in subject, not [PR nnn]', info.lines[0])) > > + for m in subject_pr_paren_regex.finditer(info.lines[0]): > > + self.errors.append(Error('Use [PRnnn] in subject, not (PRnnn)', info.lines[0])) > > + for m in subject_pr_component_regex.finditer(info.lines[0]): > > + self.errors.append(Error('Do not use PR component in subject', info.lines[0])) > > > > # Allow complete deletion of ChangeLog files in a commit > > project_files = [f for f in self.info.modified_files > > -- > > 2.34.1 > >
On Wed, Mar 12, 2025 at 10:49:58AM +0100, Christophe Lyon wrote: > On Wed, 12 Mar 2025 at 08:05, Richard Biener <richard.guenther@gmail.com> wrote: > > > > On Tue, Mar 11, 2025 at 5:58 PM Christophe Lyon > > <christophe.lyon@linaro.org> wrote: > > > > > > In https://gcc.gnu.org/contribute.html#patches we ask to use [PRnnnn] > > > without the Bugzilla component identifier and with no space between > > > 'PR' and the number, but git_check_commit.py accepts all forms. The > > > patch enforces what we document. > > > > > > Note that this would reject a few of the recent commits. > > > > Why would we be this restrictive? I personally am using > > Well, someone made me realize that I should have used [PRnnnn] rather > than (PR nnnn) in a recent commit, as documented in "Contributing to > GCC". > > Since I use gcc-verify, I looked at why I missed that, and hence > proposed this patch, so that our tools match what we document.... > > > > > bugzilla-component/number - description > > > > IMO 'PR' is redundant and the component helps screening for area of > > maintenance. The documented style is bugzilla-component: description [PRnumber] (it doesn't need to be exactly bugzilla-component, though sometimes the component and bugzilla-component are the same thing). I believe it has been discussed on the mailing lists before it was added to contribute.html. Jakub
On Wed, 12 Mar 2025 at 09:55, Jakub Jelinek <jakub@redhat.com> wrote: > > On Wed, Mar 12, 2025 at 10:49:58AM +0100, Christophe Lyon wrote: > > On Wed, 12 Mar 2025 at 08:05, Richard Biener <richard.guenther@gmail.com> wrote: > > > > > > On Tue, Mar 11, 2025 at 5:58 PM Christophe Lyon > > > <christophe.lyon@linaro.org> wrote: > > > > > > > > In https://gcc.gnu.org/contribute.html#patches we ask to use [PRnnnn] > > > > without the Bugzilla component identifier and with no space between > > > > 'PR' and the number, but git_check_commit.py accepts all forms. The > > > > patch enforces what we document. > > > > > > > > Note that this would reject a few of the recent commits. > > > > > > Why would we be this restrictive? I personally am using > > > > Well, someone made me realize that I should have used [PRnnnn] rather > > than (PR nnnn) in a recent commit, as documented in "Contributing to > > GCC". > > > > Since I use gcc-verify, I looked at why I missed that, and hence > > proposed this patch, so that our tools match what we document.... > > > > > > > > bugzilla-component/number - description > > > > > > IMO 'PR' is redundant and the component helps screening for area of > > > maintenance. > > The documented style is > bugzilla-component: description [PRnumber] And so I do think we should reject (PR nnn) at the end, for example. Maybe the other checks don't need to be so strict, I don't feel strongly about that. > (it doesn't need to be exactly bugzilla-component, though sometimes the > component and bugzilla-component are the same thing). > I believe it has been discussed on the mailing lists before it was > added to contribute.html. > > Jakub >
On Wed, Mar 12, 2025 at 11:02 AM Jonathan Wakely <jwakely@redhat.com> wrote: > > On Wed, 12 Mar 2025 at 09:55, Jakub Jelinek <jakub@redhat.com> wrote: > > > > On Wed, Mar 12, 2025 at 10:49:58AM +0100, Christophe Lyon wrote: > > > On Wed, 12 Mar 2025 at 08:05, Richard Biener <richard.guenther@gmail.com> wrote: > > > > > > > > On Tue, Mar 11, 2025 at 5:58 PM Christophe Lyon > > > > <christophe.lyon@linaro.org> wrote: > > > > > > > > > > In https://gcc.gnu.org/contribute.html#patches we ask to use [PRnnnn] > > > > > without the Bugzilla component identifier and with no space between > > > > > 'PR' and the number, but git_check_commit.py accepts all forms. The > > > > > patch enforces what we document. > > > > > > > > > > Note that this would reject a few of the recent commits. > > > > > > > > Why would we be this restrictive? I personally am using > > > > > > Well, someone made me realize that I should have used [PRnnnn] rather > > > than (PR nnnn) in a recent commit, as documented in "Contributing to > > > GCC". > > > > > > Since I use gcc-verify, I looked at why I missed that, and hence > > > proposed this patch, so that our tools match what we document.... > > > > > > > > > > > bugzilla-component/number - description > > > > > > > > IMO 'PR' is redundant and the component helps screening for area of > > > > maintenance. > > > > The documented style is > > bugzilla-component: description [PRnumber] > > And so I do think we should reject (PR nnn) at the end, for example. > > Maybe the other checks don't need to be so strict, I don't feel > strongly about that. The question is whether there's good heuristic to detect this is a fix for a PR - such heuristic should look at the bugzilla relevant line before the ChangeLog (though rejecting otherwise heuristically identified PR fixes with that missing would be nice as well) Richard. > > > (it doesn't need to be exactly bugzilla-component, though sometimes the > > component and bugzilla-component are the same thing). > > I believe it has been discussed on the mailing lists before it was > > added to contribute.html. > > > > Jakub > > >
diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py index 5c0596c2627..245c8496553 100755 --- a/contrib/gcc-changelog/git_commit.py +++ b/contrib/gcc-changelog/git_commit.py @@ -167,8 +167,10 @@ author_line_regex = \ re.compile(r'^(?P<datetime>\d{4}-\d{2}-\d{2})\ {2}(?P<name>.* <.*>)') additional_author_regex = re.compile(r'^\t(?P<spaces>\ *)?(?P<name>.* <.*>)') changelog_regex = re.compile(r'^(?:[fF]or +)?([a-z0-9+-/]*)ChangeLog:?') -subject_pr_regex = re.compile(r'(^|\W)PR\s+(?P<component>[a-zA-Z0-9+-]+)/(?P<pr>\d{4,7})') -subject_pr2_regex = re.compile(r'[(\[]PR\s*(?P<pr>\d{4,7})[)\]]') +subject_pr_regex = re.compile(r'\[PR(?P<pr>\d{4,7})\]') # [PRnnnn] +subject_pr_space_regex = re.compile(r'\[PR\s+(?P<pr>\d{4,7})\]') # [PR nnnn] +subject_pr_paren_regex = re.compile(r'\(PR\s*(?P<pr>\d{4,7})\)') # (PRnnnn) / (PR nnnn) +subject_pr_component_regex = re.compile(r'(^|\W)PR\s*(?P<component>[a-zA-Z0-9+-]+)/(?P<pr>\d{4,7})') # PRcomponent/nnnn or PR component/nnnn pr_regex = re.compile(r'\tPR (?P<component>[a-z0-9+-]+\/)?(?P<pr>[0-9]+)$') dr_regex = re.compile(r'\tDR ([0-9]+)$') star_prefix_regex = re.compile(r'\t\*(?P<spaces>\ *)(?P<content>.*)') @@ -346,13 +348,15 @@ class GitCommit: self.check_commit_email() # Extract PR numbers form the subject line - # Match either [PRnnnn] / (PRnnnn) or PR component/nnnn + # Reject [PR nnnn] / (PR nnnn) or PR component/nnnn if self.info.lines and not self.revert_commit: - self.subject_prs = {m.group('pr') for m in subject_pr2_regex.finditer(info.lines[0])} - for m in subject_pr_regex.finditer(info.lines[0]): - if not m.group('component') in bug_components: - self.errors.append(Error('invalid PR component in subject', info.lines[0])) - self.subject_prs.add(m.group('pr')) + self.subject_prs = {m.group('pr') for m in subject_pr_regex.finditer(info.lines[0])} + for m in subject_pr_space_regex.finditer(info.lines[0]): + self.errors.append(Error('Use [PRnnn] in subject, not [PR nnn]', info.lines[0])) + for m in subject_pr_paren_regex.finditer(info.lines[0]): + self.errors.append(Error('Use [PRnnn] in subject, not (PRnnn)', info.lines[0])) + for m in subject_pr_component_regex.finditer(info.lines[0]): + self.errors.append(Error('Do not use PR component in subject', info.lines[0])) # Allow complete deletion of ChangeLog files in a commit project_files = [f for f in self.info.modified_files