From patchwork Wed Jan 22 17:31:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 1227478 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4831R86Jmhz9sR1 for ; Thu, 23 Jan 2020 10:13:08 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4831R84NtQzDqTM for ; Thu, 23 Jan 2020 10:13:08 +1100 (AEDT) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=softfail (domain owner discourages use of this host) smtp.mailfrom=kaod.org (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=groug@kaod.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 482srg2LvczDqQb for ; Thu, 23 Jan 2020 04:31:11 +1100 (AEDT) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 00MHRN2H063261 for ; Wed, 22 Jan 2020 12:31:08 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2xp9459mnq-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 22 Jan 2020 12:31:08 -0500 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 22 Jan 2020 17:31:06 -0000 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 22 Jan 2020 17:31:04 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 00MHV4bF38273488 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 22 Jan 2020 17:31:04 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EFB24AE045; Wed, 22 Jan 2020 17:31:03 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CEC26AE055; Wed, 22 Jan 2020 17:31:03 +0000 (GMT) Received: from bahia.lan (unknown [9.145.182.163]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 22 Jan 2020 17:31:03 +0000 (GMT) Subject: [PATCH] pwclient: support 'git am -m' From: Greg Kurz To: patchwork@lists.ozlabs.org Date: Wed, 22 Jan 2020 18:31:03 +0100 User-Agent: StGit/unknown-version MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 20012217-0008-0000-0000-0000034BC855 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20012217-0009-0000-0000-00004A6C3207 Message-Id: <157971403528.598176.7190574914928843930.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-01-22_07:2020-01-22, 2020-01-22 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 impostorscore=0 mlxscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 mlxlogscore=999 suspectscore=0 clxscore=1034 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-2001220151 X-Mailman-Approved-At: Thu, 23 Jan 2020 10:12:59 +1100 X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" A new '--msgid' argument is added that causes pwclient to call 'git am -m' and thus add the Message-ID header to the commit message. This is a recommended practice in some projects like QEMU for example. This can also be controlled from the .pwclientrc file, like '--signoff' and '--3way'. Signed-off-by: Greg Kurz --- Hi, This is a patch against the master branch of pwclient repo at: https://github.com/getpatchwork/pwclient.git If it should be submitted some other way, please advice. Cheers, -- Greg docs/configuration.rst | 4 ++++ pwclient/parser.py | 3 +++ pwclient/shell.py | 11 +++++++++++ 3 files changed, 18 insertions(+) diff --git a/docs/configuration.rst b/docs/configuration.rst index 3d57208be846..4f56b91c8f06 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -32,6 +32,10 @@ The ``options`` section provides the following configuration options: Enable three-way merge when applying patches using the :command:`git-am` command. Defaults to ``False``. +``msgid`` + Add a ``Message-Id:`` line to commit messages when applying patches using + the :command:`git-am` command. Defaults to ``False``. + The names of the project sections must correspond to the project names in Patchwork, as reflected in the project's URL in Patchwork. Multiple projects can be defined, but no two projects can share the same name. Project sections diff --git a/pwclient/parser.py b/pwclient/parser.py index a1e27a4ffbb9..dc3934a89ed5 100644 --- a/pwclient/parser.py +++ b/pwclient/parser.py @@ -91,6 +91,9 @@ installed locales. git_am_parser.add_argument( '-3', '--3way', action='store_true', dest='three_way', help="pass '--3way' to 'git-am'") + git_am_parser.add_argument( + '-m', '--msgid', action='store_true', dest='msg_id', + help="pass '--message-id' to 'git-am'") git_am_parser.set_defaults(subcmd='git_am') get_parser = subparsers.add_parser( diff --git a/pwclient/shell.py b/pwclient/shell.py index 5ecaed32eabe..1f127ead9ebb 100644 --- a/pwclient/shell.py +++ b/pwclient/shell.py @@ -177,6 +177,17 @@ def main(argv=sys.argv[1:]): if do_three_way: cmd.append('-3') + do_msg_id = None + if args.msg_id: + do_msg_id = args.msg_id + elif config.has_option('options', 'msgid'): + do_msg_id = config.getboolean('options', 'msgid') + elif config.has_option(project_str, 'msgid'): + do_msg_id = config.getboolean(project_str, 'msgid') + + if do_msg_id: + cmd.append('-m') + for patch_id in patch_ids: ret = patches.action_apply(rpc, patch_id, cmd) if ret: