From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id C3A633855018; Tue, 22 Jun 2021 07:30:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C3A633855018 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 imap.suse.de (imap-alt.suse-dmz.suse.de [192.168.254.47]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 7B2151FD45; Tue, 22 Jun 2021 07:30:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1624347021; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=x1wI8f5Fxm71KgjimlMBF1oQWLVVskftJ/0R1/Z8Ybg=; b=1JntJfTroAofa19RI4T82AXn5MKhDh+e6qoTBImW3wRerInlF+xz+Qqn3vJqj74ForNmj/ NFTFWtSSP693hIpd7iIXxzdwq9udKkeqEpFE+L36DI8zuCMQVeBoaT9AH0g00H9zuwPMWS G1r26kOv8vYqLq/+2YyrGpL1IQ2wIqk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1624347021; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=x1wI8f5Fxm71KgjimlMBF1oQWLVVskftJ/0R1/Z8Ybg=; b=1dCb2jrH3UH+kSQaw2gUfp9qsd2pTtPVW6DTlEW2I4noS3Z1+I9WO3GCINNQxNehTda7v0 ZEcqMIA5wq+t9sBg== Received: from imap3-int (imap-alt.suse-dmz.suse.de [192.168.254.47]) by imap.suse.de (Postfix) with ESMTP id 553C8118DD; Tue, 22 Jun 2021 07:30:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1624347021; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=x1wI8f5Fxm71KgjimlMBF1oQWLVVskftJ/0R1/Z8Ybg=; b=1JntJfTroAofa19RI4T82AXn5MKhDh+e6qoTBImW3wRerInlF+xz+Qqn3vJqj74ForNmj/ NFTFWtSSP693hIpd7iIXxzdwq9udKkeqEpFE+L36DI8zuCMQVeBoaT9AH0g00H9zuwPMWS G1r26kOv8vYqLq/+2YyrGpL1IQ2wIqk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1624347021; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=x1wI8f5Fxm71KgjimlMBF1oQWLVVskftJ/0R1/Z8Ybg=; b=1dCb2jrH3UH+kSQaw2gUfp9qsd2pTtPVW6DTlEW2I4noS3Z1+I9WO3GCINNQxNehTda7v0 ZEcqMIA5wq+t9sBg== Received: from director2.suse.de ([192.168.254.72]) by imap3-int with ESMTPSA id Ol2/E42R0WCfagAALh3uQQ (envelope-from ); Tue, 22 Jun 2021 07:30:21 +0000 Subject: [RFC][PATCH] contrib: add git-commit-mklog wrapper To: Tobias Burnus , Martin Sebor , Jason Merrill Cc: Jakub Jelinek , gcc Mailing List , Jonathan Wakely , gcc-patches References: <58b63929-01f5-038c-931c-9ff8349d9f95@gmail.com> <71b4a023-efb2-6c6a-9ced-93cce7c96540@gmail.com> <3c66efd4-eb5e-f2bb-6138-4126b5909c9c@codesourcery.com> <80fee54a-c007-a62b-20e2-41bb54a2bd00@suse.cz> <870491ea-a0bf-3ac3-14d3-1aec951a356c@codesourcery.com> <0e604906-df5a-455b-9a26-4c5519e261b6@suse.cz> <26c6e47d-38e3-83c2-36ce-1786510e00ed@codesourcery.com> From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Message-ID: Date: Tue, 22 Jun 2021 09:30:21 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <26c6e47d-38e3-83c2-36ce-1786510e00ed@codesourcery.com> Content-Type: multipart/mixed; boundary="------------8429E00045EF782E2C7D882C" Content-Language: en-US X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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@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: Tue, 22 Jun 2021 07:30:24 -0000 This is a multi-part message in MIME format. --------------8429E00045EF782E2C7D882C Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hello. There's a patch candidate that comes up with a wrapper for 'git commit-mklog' alias. Using my patch, one can do: $ git commit-mklog -a -b 12345,4444 Thoughts? Can one do that without the wrapper script and passing data through env. variable? Martin --------------8429E00045EF782E2C7D882C Content-Type: text/x-patch; charset=UTF-8; name="0001-contrib-add-git-commit-mklog-wrapper.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-contrib-add-git-commit-mklog-wrapper.patch" >From 6b63718e2836c1a5a63e476ea981ba65084ba867 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Tue, 22 Jun 2021 09:19:45 +0200 Subject: [PATCH] contrib: add git-commit-mklog wrapper contrib/ChangeLog: * gcc-git-customization.sh: Use the new wrapper. * git-commit-mklog.py: New file. * prepare-commit-msg: Support GCC_MKLOG_ARGS. --- contrib/gcc-git-customization.sh | 2 +- contrib/git-commit-mklog.py | 44 ++++++++++++++++++++++++++++++++ contrib/prepare-commit-msg | 2 +- 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100755 contrib/git-commit-mklog.py diff --git a/contrib/gcc-git-customization.sh b/contrib/gcc-git-customization.sh index e7e66623786..6f8f23deebf 100755 --- a/contrib/gcc-git-customization.sh +++ b/contrib/gcc-git-customization.sh @@ -28,7 +28,7 @@ git config alias.gcc-undescr \!"f() { o=\$(git config --get gcc-config.upstream) git config alias.gcc-verify '!f() { "`git rev-parse --show-toplevel`/contrib/gcc-changelog/git_check_commit.py" $@; } ; f' git config alias.gcc-backport '!f() { "`git rev-parse --show-toplevel`/contrib/git-backport.py" $@; } ; f' git config alias.gcc-mklog '!f() { "`git rev-parse --show-toplevel`/contrib/mklog.py" $@; } ; f' -git config alias.gcc-commit-mklog '!f() { GCC_FORCE_MKLOG=1 git commit "$@"; }; f' +git config alias.gcc-commit-mklog '!f() { "`git rev-parse --show-toplevel`/contrib/git-commit-mklog.py" $@; }; f' # Make diff on MD files use "(define" as a function marker. # Use this in conjunction with a .gitattributes file containing diff --git a/contrib/git-commit-mklog.py b/contrib/git-commit-mklog.py new file mode 100755 index 00000000000..f1ef0dfa86b --- /dev/null +++ b/contrib/git-commit-mklog.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 + +# Copyright (C) 2020 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# The script is wrapper for git commit-mklog alias where it parses +# -b/--pr-numbers argument and passes it via environment variable +# to mklog.py script. + +import argparse +import os +import subprocess + +if __name__ == '__main__': + children_args = [] + myenv = os.environ.copy() + + parser = argparse.ArgumentParser(description='git-commit-mklog wrapped') + parser.add_argument('-b', '--pr-numbers', action='store', + type=lambda arg: arg.split(','), nargs='?', + help='Add the specified PRs (comma separated)') + args, unknown_args = parser.parse_known_args() + + myenv['GCC_FORCE_MKLOG'] = '1' + if args.pr_numbers: + myenv['GCC_MKLOG_ARGS'] = f'-b {",".join(args.pr_numbers)}' + commit_args = ' '.join(unknown_args) + subprocess.run(f'git commit {commit_args}', shell=True, env=myenv) diff --git a/contrib/prepare-commit-msg b/contrib/prepare-commit-msg index 969847df6f4..5da878458cd 100755 --- a/contrib/prepare-commit-msg +++ b/contrib/prepare-commit-msg @@ -78,4 +78,4 @@ else tee="cat" fi -git $cmd | $tee | git gcc-mklog -c "$COMMIT_MSG_FILE" +git $cmd | $tee | git gcc-mklog $GCC_MKLOG_ARGS -c "$COMMIT_MSG_FILE" -- 2.32.0 --------------8429E00045EF782E2C7D882C--