From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 2473E3858CD1 for ; Mon, 6 May 2024 16:20:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2473E3858CD1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2473E3858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715012407; cv=none; b=hvf2pPx3LOAY/lqvdbIjnOtVC7V3dF41BBrbMX+bIFBH3WToIwMo/xSuP2mCA79RpPYywzGhUL6T7YU4V60yqCTpbcEDA0Uz4heuokwnzFw+jeG3gcDxSMvZAuq+Y/aJVaU9KHBlkoSJOIk41l6mIp9h75kzeYG/44iBZxQaSwY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715012407; c=relaxed/simple; bh=/qdIt+JFg1PfwqOeBtY2WF6RxIYf1EMLdBDnCDBxja4=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=G68V4ht4tl/cK/eVX+gmlJapQt4U2NDcfdHc2zIVqno1h0xyRQXDxh6PogLNuHEdJOCWAMtvznSjex1LXsBIB7KaaI9G/cE3BR1A1CTSOqNDQz64Q9OUEgmTh2SqZ0B43W028riocSxVhkQyNofh3djH+QlGYKZ0evuNk+eDW58= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715012404; h=from:from:reply-to:subject:subject: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=MYgrESjaOBqscLul2ts7RRGbvpGJ6j+GP27T71H87q4=; b=EMjr93/KXR8bsFyPGmpe9hfdFKyZLR4DYWV+x6/VUanYM6xx8q8K56tQvMLLOVAd71pYBX mFaE9rPRuYU1RZ4p5NyMiuPIMinWuZwDIMasGS2yhgq7l32Zq/nQZcq/5bulLu6cnl0PyD Ej5gq59D0U44Z3+zzNy5RM1aESeRYyg= Received: from mail-ot1-f70.google.com (mail-ot1-f70.google.com [209.85.210.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-612-uX9TnDERNzuO9N-BrgpWXw-1; Mon, 06 May 2024 12:20:03 -0400 X-MC-Unique: uX9TnDERNzuO9N-BrgpWXw-1 Received: by mail-ot1-f70.google.com with SMTP id 46e09a7af769-6f03ff303feso2190565a34.0 for ; Mon, 06 May 2024 09:20:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715012402; x=1715617202; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MYgrESjaOBqscLul2ts7RRGbvpGJ6j+GP27T71H87q4=; b=VHttCJbyXqVRBRnHv3KJlPAbQv4XzGbAdG6Jn4/Ki1w1pj2EFIbRqJaOhjQtVmpjxW 8tTgEhWs5OcxUa9JdS13dMj1r7OFPQBsKjMT32fXku/mgDVLimSjeL8oXWm7o5cGNZfn PrHPgvyUj0d7LB2AKG/nrZrfY0HxdqzgmQwVsiVS+/y2Z/IvLkiyFmFdyGXoL9Hj6nBz nAs4FDFcBXfsdkaGFWN7TMqmDgDR8RrNNvppZeEaeKV9AGzIumuluyd+AS57fzAZXa4d BUgvoUQ6EKqz0MJ6cCqez4zN1cOBp94vmI+TnHzFDYqlNm25vEqEnFu0gt/J2ToJbFke l8TA== X-Forwarded-Encrypted: i=1; AJvYcCWeQ/iV1nh2FbEerlCM/KmqzEWSEEMA/g0nnQFW4yzQ1Va7+QJCB4c+NNcp0GnZTeOAqm/9hVxFop1xQTw1IDxN6JNsY4zukA== X-Gm-Message-State: AOJu0YxxFDLrGPz2S2G0270gSB/mq86f+x8xDXJ0WaALh6nTtSiuT4j6 OisnlxaSCdcMjKBgcz7gAjD0O4ulndLZEvb8n1pUZVkXbxuA6Xd6qQR1Ug7RZPmdR9BsYa3gb2X YbvwfFTsr5/joAsOOm4X9z70erOFkssOG/ei2nNY/fM+4OlsG3lv8ox8= X-Received: by 2002:a05:6830:1e4c:b0:6f0:478b:3e08 with SMTP id e12-20020a0568301e4c00b006f0478b3e08mr4369619otj.34.1715012402572; Mon, 06 May 2024 09:20:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGiiVPRqpPrw142FKwR6o9PVzvTlXxu1h3yhA+xBhKfUFh//WmgEdjUXMj0kTyNgpYkbImomQ== X-Received: by 2002:a05:6830:1e4c:b0:6f0:478b:3e08 with SMTP id e12-20020a0568301e4c00b006f0478b3e08mr4369601otj.34.1715012402122; Mon, 06 May 2024 09:20:02 -0700 (PDT) Received: from [192.168.1.130] (130-44-146-16.s12558.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.146.16]) by smtp.gmail.com with ESMTPSA id qr3-20020a05620a390300b00790789db3cbsm4006050qkn.29.2024.05.06.09.20.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 May 2024 09:20:01 -0700 (PDT) Message-ID: Date: Mon, 6 May 2024 12:20:00 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] contrib/gcc-changelog/git_check_commit.py: Implement --num-commits To: Ken Matsui , gcc-patches@gcc.gnu.org Cc: Ken Matsui References: <20240228210954.693154-1-kmatsui@gcc.gnu.org> <8d06dede-7a9b-afd0-8bcd-6e0bdc497463@idea> From: Jason Merrill In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,RCVD_IN_SORBS_WEB,SPF_HELO_NONE,SPF_NONE,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 List-Id: On 5/6/24 09:25, Ken Matsui wrote: > On Thu, Mar 14, 2024 at 12:57 AM Ken Matsui wrote: >> >> On Fri, Mar 8, 2024 at 8:42 AM Patrick Palka wrote: >>> >>> On Wed, 28 Feb 2024, Ken Matsui wrote: >>> >>>> This patch implements a --num-commits (-n) flag for shorthand for >>>> the range of hash~N..hash commits. >> >> Ping. > > Ping. Ok for trunk? OK. >>>> >>>> contrib/ChangeLog: >>>> >>>> * gcc-changelog/git_check_commit.py: Implement --num-commits. >>> >>> LGTM >>> >>>> >>>> Signed-off-by: Ken Matsui >>>> --- >>>> contrib/gcc-changelog/git_check_commit.py | 15 +++++++++++++++ >>>> 1 file changed, 15 insertions(+) >>>> >>>> diff --git a/contrib/gcc-changelog/git_check_commit.py b/contrib/gcc-changelog/git_check_commit.py >>>> index 8cca9f439a5..22e032e8b38 100755 >>>> --- a/contrib/gcc-changelog/git_check_commit.py >>>> +++ b/contrib/gcc-changelog/git_check_commit.py >>>> @@ -22,6 +22,12 @@ import argparse >>>> >>>> from git_repository import parse_git_revisions >>>> >>>> +def nonzero_uint(value): >>>> + ivalue = int(value) >>>> + if ivalue <= 0: >>>> + raise argparse.ArgumentTypeError('%s is not a non-zero positive integer' % value) >>>> + return ivalue >>>> + >>>> parser = argparse.ArgumentParser(description='Check git ChangeLog format ' >>>> 'of a commit') >>>> parser.add_argument('revisions', default='HEAD', nargs='?', >>>> @@ -33,8 +39,17 @@ parser.add_argument('-p', '--print-changelog', action='store_true', >>>> help='Print final changelog entires') >>>> parser.add_argument('-v', '--verbose', action='store_true', >>>> help='Print verbose information') >>>> +parser.add_argument('-n', '--num-commits', type=nonzero_uint, default=1, >>>> + help='Number of commits to check (i.e. shorthand for ' >>>> + 'hash~N..hash)') >>>> args = parser.parse_args() >>>> >>>> +if args.num_commits > 1: >>>> + if '..' in args.revisions: >>>> + print('ERR: --num-commits and range of revisions are mutually exclusive') >>>> + exit(1) >>>> + args.revisions = '{0}~{1}..{0}'.format(args.revisions, args.num_commits) >>>> + >>>> retval = 0 >>>> for git_commit in parse_git_revisions(args.git_path, args.revisions): >>>> res = 'OK' if git_commit.success else 'FAILED' >>>> -- >>>> 2.44.0 >>>> >>>> >>> >