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: 33917 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp859882wrn; Fri, 16 Dec 2022 01:19:11 -0800 (PST) X-Google-Smtp-Source: AA0mqf6nvTv9DNFQwNyRyr2g66m3RvZtipFbgKUaYmS9pM4eUe6Z4gCRzsx4eCD4N5aSW5Rjqe0U X-Received: by 2002:a17:906:f106:b0:7c0:aea2:e910 with SMTP id gv6-20020a170906f10600b007c0aea2e910mr37544331ejb.3.1671182351231; Fri, 16 Dec 2022 01:19:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671182351; cv=none; d=google.com; s=arc-20160816; b=KxfoWjCy39RBoXphDs64UY1+Dqw13k/CfsAtH6BtP8NaSr8zOZ82l4cvsU7eBpb19R Ipt2qAVYJEcvVLpX9sJc0QNTgPbdSS8VB/rXO+Kv3HvbcQLNF9FbBZpO1bprErSeEkaG VtVOkPemWQaonLY6K3sc/xm4UtYNeOa0ey1+p2HM9D82fIchLU/OCeIEWndtYDfZjzSL UnntyqVE36nBR5zTxm9Kiopn9ONSsZ4cy1xjwaCgYUxiiC1u6Cx1YRv564hkwRAzusKb zdhYCD+IRUN0kxfLAME4tZN8YM9H20mgIvEDFPB6dvhFLIN3AJV1R45EdAUATA6r+0J8 SbOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:from:to :content-language:user-agent:mime-version:date:message-id :ironport-sdr:dmarc-filter:delivered-to; bh=Q6CPnIFP/VkcPCJfy1Huh5gMTlUHA1iRVPsJpmRSjTE=; b=I4ovje4b01Y9PLew5IfXjP69SJi7HkgoaSeZLYOBtgjjfG2qa/2wVz2nzjDSM1U+tU uGprvnsclNdYxgqrBJrdzbggGb1NwukMo3bUZh41VjG5s5Zc05HTnWiusqEu8uOYOKYw NoZLuj7l8oGTYxyou/r6vGqmTHmwwZzRxgPZPdqer8dpoTNKI3AVn6VtT1L9NdDSGzku /8/ucq8VZYHZb83k0imvxyKelcvFreL/pGdMfkgb9HQFWF0LxfhQ3q+mgN4D6MezoOQB Zs19yVCBYauOGTOxM4Qs04mznPxEN26nfNg/jIw+cSILif008A0GB2XFxhdJv/VcNJMc H2tg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id mb7-20020a170906eb0700b007ade4c97618si1629489ejb.930.2022.12.16.01.19.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Dec 2022 01:19:11 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C2B26382FAFA for ; Fri, 16 Dec 2022 09:19:04 +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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752361704751804802?= X-GMAIL-MSGID: =?utf-8?q?1752361704751804802?= 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 = ''