From patchwork Fri Dec 16 11:23:32 2022 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: 33940 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp906501wrn; Fri, 16 Dec 2022 03:24:06 -0800 (PST) X-Google-Smtp-Source: AA0mqf4aWoxWQ1OOuyZCC3xMW6vPl40Mk1mTdO7tlokU18eBO6ByIxKgMF5uKiqrZZy9/sozyckB X-Received: by 2002:a17:906:3810:b0:7bc:bf29:c58 with SMTP id v16-20020a170906381000b007bcbf290c58mr26508370ejc.2.1671189846047; Fri, 16 Dec 2022 03:24:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671189846; cv=none; d=google.com; s=arc-20160816; b=YO7xgfz1ogX66U8cEkIsnkO+qAqSmWhlZ/FwPa2dxIw8cffhcIlytq7pnJGgD4OkxF YACwG50SYkMA1zGr8zAot8RtJn1W/p+OeHXsRe3y3sBoAcmihL4ikTb6lfTkD09yiuMc HNgSeXc7vocYwcnUV9UkZMhiyOqvo0Tu/kei5vjuLhPtvP33SNHkQNtDMSIS3vN3pQhD yarvs5XCVWKPlpY3Dbr7+13lVg3BPUkKmEb7t34CRaBo5byyhKSnBjLz/jJgKKBzY/20 nxRCiaBQiAeZvuMjB83qp6pyZkI18Tks/LRTdeNx08pCdlK/MQPPaGey7GaSXOgj1tNR 7NiQ== 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:content-transfer-encoding :in-reply-to:cc:content-language:references:to:subject:from :user-agent:mime-version:date:message-id:dkim-signature :dkim-signature:dmarc-filter:delivered-to; bh=e/ZkNPcAmHlCLIfV1Yxqpo3QCKbhN+Kpl+VsJYNPGvo=; b=iSRJm47KucQ8d5q7xaeB7WLu+GYakvLaWRJa8i4/WMazYJD/NmzGyw9SVp/HaN+tD/ 8Uo4By92zFLdYxV4xRYSyWRyOMz7I1jSziRWo7MX/DdqzHwWxYI1r12KuOkvELNrrPse QoK1ggHzeDi6soEQAyE4Xi9l8m7up/qKiGzcX0KIG+/BOdL25NcWNr41tvOYYSACeV3I ZkwZbLge3Xi6mEvau7LzXRYb8f2lxmLFytUc68adXmU1/4+0ywz/vos/5zc1F7yXNXi0 3ng0ZGQ2Op16ylzmDONnrg2CC3Op3t5C3qZ3icbF4diWxrvHwOLTJhluA90yjz74chJB zzdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=kCOwxBF6; dkim=neutral (no key) header.i=@gcc.gnu.org; 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 t18-20020a1709063e5200b0078d2a99972fsi1686846eji.316.2022.12.16.03.24.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Dec 2022 03:24:06 -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; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=kCOwxBF6; dkim=neutral (no key) header.i=@gcc.gnu.org; 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 E170C3883029 for ; Fri, 16 Dec 2022 11:23:57 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id B1AC23877222 for ; Fri, 16 Dec 2022 11:23:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B1AC23877222 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A7F925CD53; Fri, 16 Dec 2022 11:23:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1671189812; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e/ZkNPcAmHlCLIfV1Yxqpo3QCKbhN+Kpl+VsJYNPGvo=; b=kCOwxBF6ltW5k1H2JId3hnltqzeRmG5g9a/Auq4zpsPxzi6CZsZYQuBF8iLJxY2FJrkQHO N66G7gbV2x5QZ/Stfrh0C+2wnwQLAy3HPn16fVwLudh9kpCFwPkhDwGWhaKLLUgn84ZzJN BkSNbXlfk4R0gmJn+IH3tQ1PrJ2VRIc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1671189812; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e/ZkNPcAmHlCLIfV1Yxqpo3QCKbhN+Kpl+VsJYNPGvo=; b=WMQeuIJ89mlb0gtwxeQB/XKySMdJUH7cUU9oDXoMoGd7NpEgBuJtdInWOU8W+1r6wnJPfC vXwDSkIa/tycQfAw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 96A73138F0; Fri, 16 Dec 2022 11:23:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id yX/yIzRVnGOrCgAAMHmgww (envelope-from ); Fri, 16 Dec 2022 11:23:32 +0000 Message-ID: <8535eafd-58cc-5454-a92c-6aaf242b686b@suse.cz> Date: Fri, 16 Dec 2022 12:23:32 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH (pushed)] gcc-changelog: do not use PatchSet.from_filename To: gcc-patches@gcc.gnu.org References: <39aa0988-2d5c-183d-4c5a-4cfd3b061836@suse.cz> Content-Language: en-US Cc: Tobias Burnus In-Reply-To: <39aa0988-2d5c-183d-4c5a-4cfd3b061836@suse.cz> X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_SOFTFAIL, 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?1752369563977772981?= X-GMAIL-MSGID: =?utf-8?q?1752369563977772981?= Use rather PatchSet constructor where we can pass properly opened file with newline='\n'. contrib/ChangeLog: * gcc-changelog/git_email.py: Use PatchSet constructor as newline argument is not supported with older unidiff library. --- contrib/gcc-changelog/git_email.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/contrib/gcc-changelog/git_email.py b/contrib/gcc-changelog/git_email.py index 093c887ba4c..f3773f178ea 100755 --- a/contrib/gcc-changelog/git_email.py +++ b/contrib/gcc-changelog/git_email.py @@ -39,18 +39,15 @@ unidiff_supports_renaming = hasattr(PatchedFile(), 'is_rename') class GitEmail(GitCommit): def __init__(self, filename): self.filename = filename - 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 = '' subject_last = False - with open(self.filename, 'r') as f: - lines = f.read().splitlines() + with open(self.filename, newline='\n') as f: + data = f.read() + diff = PatchSet(data) + lines = data.splitlines() lines = list(takewhile(lambda line: line != '---', lines)) for line in lines: if line.startswith(DATE_PREFIX):