From patchwork Mon Nov 30 16:21:22 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: 1408390 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 (server2.sourceware.org [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 4Cl9Tj2ykTz9sT6 for ; Tue, 1 Dec 2020 03:21:29 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DFED83896809; Mon, 30 Nov 2020 16:21:26 +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 125CE385802D for ; Mon, 30 Nov 2020 16:21:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 125CE385802D 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 D4932AE42 for ; Mon, 30 Nov 2020 16:21:22 +0000 (UTC) From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH] changelog: add hint for a file mismatch To: gcc-patches@gcc.gnu.org Message-ID: Date: Mon, 30 Nov 2020 17:21:22 +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, KAM_SHORT, 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" Pushed to master. It's supposed to provide a hint, e.g. ERR: unchanged file mentioned in a ChangeLog (did you mean "gcc/testsuite/gfortran.dg/goacc-gomp/free-1.f90"?):"gcc/testsuite/gfortran.dg/goacc-gomp/free-1.f" Martin contrib/ChangeLog: * gcc-changelog/git_commit.py: Suggest close file for 'unchanged file mentioned in a ChangeLog' error. * gcc-changelog/test_email.py: Test it. --- contrib/gcc-changelog/git_commit.py | 4 ++++ contrib/gcc-changelog/test_email.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py index 57fba756d32..0c438165516 100755 --- a/contrib/gcc-changelog/git_commit.py +++ b/contrib/gcc-changelog/git_commit.py @@ -16,6 +16,7 @@ # along with GCC; see the file COPYING3. If not see # . */ +import difflib import os import re @@ -576,6 +577,9 @@ class GitCommit: changed_files = set(cand) for file in sorted(mentioned_files - changed_files): msg = 'unchanged file mentioned in a ChangeLog' + candidates = difflib.get_close_matches(file, changed_files, 1) + if candidates: + msg += f' (did you mean "{candidates[0]}"?)' self.errors.append(Error(msg, file)) for file in sorted(changed_files - mentioned_files): if not self.in_ignored_location(file): diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py index 48ecc1ee6a6..8f5129edb12 100755 --- a/contrib/gcc-changelog/test_email.py +++ b/contrib/gcc-changelog/test_email.py @@ -113,7 +113,9 @@ class TestGccChangelog(unittest.TestCase): email = self.from_patch_glob('0096') assert email.errors err = email.errors[0] - assert err.message == 'unchanged file mentioned in a ChangeLog' + assert err.message == 'unchanged file mentioned in a ChangeLog (did ' \ + 'you mean "gcc/testsuite/gcc.target/aarch64/' \ + 'advsimd-intrinsics/vdot-3-1.c"?)' assert err.line == 'gcc/testsuite/gcc.target/aarch64/' \ 'advsimd-intrinsics/vdot-compile-3-1.c'