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.129.124]) by sourceware.org (Postfix) with ESMTPS id BEBA63858D33 for ; Fri, 8 Mar 2024 16:42:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BEBA63858D33 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 BEBA63858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709916157; cv=none; b=TRDPbaIRBl2U0vZ11fV1swa+kqZh/WO1sRieR4pS4xVGEqRNimPt1ciKJeq/YRhj4fL2PEKS3Rnm/oZn+Y8QeyyOSd8e+vxHpjctVh969PtLy72oRj0LqyMX+bDKFK2LN1whsqudl2uQqvHFvIdPw9KhSx9J1muo6dmQZSF6nro= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709916157; c=relaxed/simple; bh=o4IYOGTHjSOygeWrqfQztIr6DLeVNirZOGfZx02JFZc=; h=DKIM-Signature:From:Date:To:Subject:Message-ID:MIME-Version; b=xNiv0ssf8aV/0fKNcNlI4RZ0Nc62E5+xr4hUIEAib0MKPBd3xJ5XWT5/jFugTo1emrZeoYWkGr+LE2rIxgmMMDGLJM6qhvPtwDe6OPjfxEYnhWUjL6Fe6+yt8k/IcxT/vLKP7PFDqoItRsdPhDLCnFiJ3Hd65Ze5GmTciWXAH4o= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709916155; 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: in-reply-to:in-reply-to:references:references; bh=FqvIcAWflrNZlhtw2rk7o9jv7TnM0xmRH0/Yonj8/wY=; b=fnAfh7/rUfZBjD00mT3jalIZt2ZD1xQS1DyfHC/2HyvyUBShR7Kp+eVM9Ojr1Sp3VPxMcn xMdJAv/SBjH/oPfn+H18uaAI4vZPJ4vU/YHCKTDSvTD/9LQuphSOa5nH3FzKY7zHVB3lwJ tlXGfhWDNHDHASP0P9hi1JqbTmHb9Hs= Received: from mail-oo1-f70.google.com (mail-oo1-f70.google.com [209.85.161.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-595-rdaa-x-cPcSV43-8m5-I4Q-1; Fri, 08 Mar 2024 11:42:34 -0500 X-MC-Unique: rdaa-x-cPcSV43-8m5-I4Q-1 Received: by mail-oo1-f70.google.com with SMTP id 006d021491bc7-59fa26aae1cso861193eaf.3 for ; Fri, 08 Mar 2024 08:42:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709916153; x=1710520953; h=mime-version:references:message-id:in-reply-to:subject:cc:to:date :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FqvIcAWflrNZlhtw2rk7o9jv7TnM0xmRH0/Yonj8/wY=; b=mWeqNi4hjZHY6ffoWZ6q3n3dFOa7LzQpEsFBfbiUcLBhPbMgc3Krqota3BM1wtWN19 I1J/b+3CVJl1aKSVI5SVM1G7junn04ErNwzY0HsBT0yydI6A+ph06K0bm+Wf333ghDEt dIB+tJWfDOZGMdxPeE72j76huQGXipT+ypenvp42r6FS2xlY19KAchS6hDD+Gcl1PDY0 VGrdziOKopuuG8pPuEtFER/ej/xBe3yYJEBdb+6Pnc7LQcYeqZqMLhtkKgkVLlSn1eB9 YoEbS9i/3Jlysw/wnw8K7bp8F1wrlOvO72sUxsJQqXy+Okai2ExeTW1aIDp5uEvjZtKy iIPA== X-Gm-Message-State: AOJu0YxysFodn5AXSwgWWic6zJIPx/oUjlHuJLRSqeGQycn0ml2grfWx 2Lb2lqsoTVeRQ0tzeo16KMJLkxPVWhD+GvlomjoJJ4BOCMyBn8mX4MtH+JU5aX0U0i2dYPWNZPT WX6TzMVmqMBmqXQfsyrv+PGYv4kiZOS7hpFk0eCtWUlnwKm68jVK52Fk= X-Received: by 2002:a05:6820:229b:b0:5a1:c935:2eca with SMTP id ck27-20020a056820229b00b005a1c9352ecamr2431066oob.6.1709916153344; Fri, 08 Mar 2024 08:42:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IEaF5M2mQGt6VYb+EW8x0XWeaOZ61mOPnLBoKO99y5DxBB0rR3+EA/MWFDCociWdaMPoS6EGQ== X-Received: by 2002:a05:6820:229b:b0:5a1:c935:2eca with SMTP id ck27-20020a056820229b00b005a1c9352ecamr2431046oob.6.1709916152962; Fri, 08 Mar 2024 08:42:32 -0800 (PST) Received: from [192.168.1.130] (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id vu17-20020a05620a561100b00788411e6b1dsm2669633qkn.131.2024.03.08.08.42.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 08:42:32 -0800 (PST) From: Patrick Palka X-Google-Original-From: Patrick Palka Date: Fri, 8 Mar 2024 11:42:31 -0500 (EST) To: Ken Matsui cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] contrib/gcc-changelog/git_check_commit.py: Implement --num-commits In-Reply-To: <20240228210954.693154-1-kmatsui@gcc.gnu.org> Message-ID: <8d06dede-7a9b-afd0-8bcd-6e0bdc497463@idea> References: <20240228210954.693154-1-kmatsui@gcc.gnu.org> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-14.0 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,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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 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. > > 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 > >