From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id C2D8D3858D35; Fri, 14 Jan 2022 15:26:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C2D8D3858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass 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-out1.suse.de (Postfix) with ESMTPS id 9B6A421997; Fri, 14 Jan 2022 15:26:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1642173965; 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=ugVnWWWwkB727E57TDDdQOJI9HMnTE5DO2Dj5HRbYvQ=; b=W8dTngbQw8svPZ8qwYXjjMJqdZfQSURCvBdYJBRf3DjvkDHY9+m1sPphiSthcuB00Ymw9k PXw0bVqgY0GqdLCst0RTA6yfmQqFSFoopiLVqGKzwl0cBAuJh0AJO47fVCb7H6nElFsoqY J/sSciKDD5JG8nnKs9BDVdIq01lpsqk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1642173965; 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=ugVnWWWwkB727E57TDDdQOJI9HMnTE5DO2Dj5HRbYvQ=; b=D6oktF3DcSf1tqVHIvspoG4jLb6I6ygme+uGBTZlfCM7U/Fe4931oucvJpnGOvr18HI6oM b7g5HPfekVOkz7Dw== 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 69BE913C0F; Fri, 14 Jan 2022 15:26:05 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id K+RVGA2W4WGZUAAAMHmgww (envelope-from ); Fri, 14 Jan 2022 15:26:05 +0000 Message-ID: <96b660fc-0397-4ed5-a8ed-9e8b3aee3fd6@suse.cz> Date: Fri, 14 Jan 2022 16:26:04 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH] git-backport: support renamed .cc files in commit message. Content-Language: en-US To: Bernhard Reutner-Fischer Cc: Jakub Jelinek , GCC Mailing List , Martin Jambor , GCC Patches , gfortran References: <57564370-7184-ef62-039e-60b150058fd8@suse.cz> <68946bf6-4b2f-b8f3-20b3-5cf3f2fd611c@moene.org> <713a96b5-b82e-ffd7-d03b-7e05a4dede9e@suse.cz> <20220111155657.GA2646553@tucnak> <8a3f6503-7380-13bb-5731-18ff5474f68a@suse.cz> <20220111161636.GB2646553@tucnak> <78c91bbb-34d7-36f6-0d69-d8a4e7f446f5@suse.cz> <486de71c-d1fc-5ca7-4036-59462a75f116@suse.cz> <20220114084418.3779aea1@nbbrfq> From: =?UTF-8?Q?Martin_Li=c5=a1ka?= In-Reply-To: <20220114084418.3779aea1@nbbrfq> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jan 2022 15:26:08 -0000 On 1/14/22 08:44, Bernhard Reutner-Fischer wrote: > On Wed, 12 Jan 2022 16:54:46 +0100 > Martin Liška wrote: > >> +def replace_file_in_changelog(lines, filename): >> + if not filename.endswith('.cc'): >> + return >> + >> + # consider all componenets of a path: gcc/ipa-icf.cc >> + while filename: >> + for i, line in enumerate(lines): >> + if filename in line: >> + line = line.replace(filename, filename[:-1]) >> + lines[i] = line >> + return >> + parts = filename.split('/') >> + if len(parts) == 1: >> + return >> + filename = '/'.join(parts[1:]) >> + > > I think you mean os.sep instead of the hardcoded slash. > But i'd use os.path.split and os.path.join Hello. Well, these are all paths from a git commit message. And we require unix-style of paths for all ChangeLog entries. So it should be correct. Martin > > thanks,