From patchwork Fri Dec 16 09:18:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 1716427 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NYNnp15pFz23yr for ; Fri, 16 Dec 2022 20:18:54 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B2F83382FAD6 for ; Fri, 16 Dec 2022 09:18:51 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id B6643382FCAD for ; Fri, 16 Dec 2022 09:18:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B6643382FCAD Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.96,249,1665475200"; d="diff'?scan'208";a="93160313" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 16 Dec 2022 01:18:16 -0800 IronPort-SDR: OOCNEkC4Byqti+Z2N4tn5n9/5GS+BCBHV9hb1iQ2IbyNBSAuVAsg4piqVe+lwVuJy63jmmRtI9 4B8dkFlDj8Upzm5yQzpyt0X/mCaNQdcV4LYslbX3s7m6jtAL8FY4cvUko6ePZ6vJp18gRjckaY lKTbso5+NxFOF1AJKRuCpxG86r0MZMHpcv2CutQX9rVOpOmnvg7SQaqgA4ocPEWsfaGCqMDyQ8 39+ZkYMjEoeYDLdsCcJtajHsmDit2yhfegnQzqwx0PtPFs7+qXdgdCKYs+sdKcJaqbQtaCpbfy DX4= Message-ID: <780f0808-44d4-9d95-c1a9-d408f1475741@codesourcery.com> Date: Fri, 16 Dec 2022 10:18:11 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Content-Language: en-US To: gcc-patches , =?utf-8?q?Martin_Li=C5=A1ka?= From: Tobias Burnus Subject: [Patch] gcc-changelog/git_email.py: Support older unidiff.PatchSet X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) To svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Another backward compatibility issue - failed here on Ubuntu 20.04 which is old but not ancient. OK for mainline? Tobias ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 gcc-changelog/git_email.py: Support older unidiff.PatchSet Commit "unidiff: use newline='\n' argument", r13-4603-gb045179973161115c7ea029b2788f5156fc55cda, added support CR on a line, but that broke support for older unidiff.PatchSet. This patch uses a fallback for git_email.py (drop argument) if not available (TypeError exception) but keeps using it in test_email.py unconditionally. contrib/ChangeLog: * gcc-changelog/git_email.py (GitEmail:__init__): Support older unidiff.PatchSet that do not have a newline= argument of from_filename. diff --git a/contrib/gcc-changelog/git_email.py b/contrib/gcc-changelog/git_email.py index ef50ebfb7fd..093c887ba4c 100755 --- a/contrib/gcc-changelog/git_email.py +++ b/contrib/gcc-changelog/git_email.py @@ -39,7 +39,11 @@ unidiff_supports_renaming = hasattr(PatchedFile(), 'is_rename') class GitEmail(GitCommit): def __init__(self, filename): self.filename = filename - diff = PatchSet.from_filename(filename, newline='\n') + try: + diff = PatchSet.from_filename(filename, newline='\n') + except TypeError: + # Older versions don't have the newline argument + diff = PatchSet.from_filename(filename) date = None author = None subject = ''