From patchwork Fri Nov 27 12:44:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 1407187 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CjDps5Jgpz9s0b for ; Fri, 27 Nov 2020 23:44:36 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 21C403971C75; Fri, 27 Nov 2020 12:44:31 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id F35353857031 for ; Fri, 27 Nov 2020 12:44:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F35353857031 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mliska@suse.cz X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id CADF1ABD7 for ; Fri, 27 Nov 2020 12:44:26 +0000 (UTC) From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH][pushed] changelog: allow flexible "cherry picked" format. To: gcc-patches@gcc.gnu.org Message-ID: <8b26b356-7903-352e-c0c0-51fe1e7b6c35@suse.cz> Date: Fri, 27 Nov 2020 13:44:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 Content-Language: en-US X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" It handles the following: (cherry picked from commit c0c7270cc4efd896fe99f8ad5409dbef089a407f (testsuite changes only)) contrib/ChangeLog: * gcc-changelog/git_commit.py: Use regex for cherry pick prefix. * gcc-changelog/test_email.py: Test it. * gcc-changelog/test_patches.txt: Likewise. --- contrib/gcc-changelog/git_commit.py | 20 +++++++++++--------- contrib/gcc-changelog/test_email.py | 2 ++ contrib/gcc-changelog/test_patches.txt | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py index 5f856660bb3..d0ac23c22aa 100755 --- a/contrib/gcc-changelog/git_commit.py +++ b/contrib/gcc-changelog/git_commit.py @@ -158,11 +158,11 @@ end_of_location_regex = re.compile(r'[\[<(:]') item_empty_regex = re.compile(r'\t(\* \S+ )?\(\S+\):\s*$') item_parenthesis_regex = re.compile(r'\t(\*|\(\S+\):)') revert_regex = re.compile(r'This reverts commit (?P\w+).$') +cherry_pick_regex = re.compile(r'cherry picked from commit (?P\w+)') LINE_LIMIT = 100 TAB_WIDTH = 8 CO_AUTHORED_BY_PREFIX = 'co-authored-by: ' -CHERRY_PICK_PREFIX = '(cherry picked from commit ' REVIEW_PREFIXES = ('reviewed-by: ', 'reviewed-on: ', 'signed-off-by: ', 'acked-by: ', 'tested-by: ', 'reported-by: ', @@ -422,14 +422,16 @@ class GitCommit: continue elif lowered_line.startswith(REVIEW_PREFIXES): continue - elif line.startswith(CHERRY_PICK_PREFIX): - commit = line[len(CHERRY_PICK_PREFIX):].rstrip(')') - if self.cherry_pick_commit: - self.errors.append(Error('multiple cherry pick lines', - line)) - else: - self.cherry_pick_commit = commit - continue + else: + m = cherry_pick_regex.search(line) + if m: + commit = m.group('hash') + if self.cherry_pick_commit: + msg = 'multiple cherry pick lines' + self.errors.append(Error(msg, line)) + else: + self.cherry_pick_commit = commit + continue # ChangeLog name will be deduced later if not last_entry: diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py index e38c3e52158..579194cdc24 100755 --- a/contrib/gcc-changelog/test_email.py +++ b/contrib/gcc-changelog/test_email.py @@ -355,6 +355,8 @@ class TestGccChangelog(unittest.TestCase): def test_backport(self): email = self.from_patch_glob('0001-asan-fix-RTX-emission.patch') assert not email.errors + expected_hash = '8cff672cb9a132d3d3158c2edfc9a64b55292b80' + assert email.cherry_pick_commit == expected_hash assert len(email.changelog_entries) == 1 entry = list(email.to_changelog_entries())[0][1] assert entry.startswith('2020-06-11 Martin Liska ') diff --git a/contrib/gcc-changelog/test_patches.txt b/contrib/gcc-changelog/test_patches.txt index 37f49c851ec..9e9c5cd893f 100644 --- a/contrib/gcc-changelog/test_patches.txt +++ b/contrib/gcc-changelog/test_patches.txt @@ -3145,7 +3145,7 @@ gcc/ChangeLog: by using Pmode instead of ptr_mode. Co-Authored-By: Jakub Jelinek -(cherry picked from commit 8cff672cb9a132d3d3158c2edfc9a64b55292b80) +(cherry picked from commit 8cff672cb9a132d3d3158c2edfc9a64b55292b80 (only part)) --- gcc/asan.c | 1 + 1 file changed, 1 insertion(+)