From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 89625C43334 for ; Thu, 30 Jun 2022 22:16:04 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5063983020; Fri, 1 Jul 2022 00:16:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="R6WCeGDU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DB44383A1F; Fri, 1 Jul 2022 00:15:59 +0200 (CEST) Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5A5D18209F for ; Fri, 1 Jul 2022 00:15:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=briannorris@chromium.org Received: by mail-pj1-x102b.google.com with SMTP id d14so795076pjs.3 for ; Thu, 30 Jun 2022 15:15:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=YwvXSsq2Dor1tKNP8oHzoUsH5Y4oWbbuTe0U3g2mAYo=; b=R6WCeGDU0FlGHKZI2mmBvFoXDRKcN3DNnuL2RWrSa+4LzA60aMGkjoCt8XXt08shjb qQWuRS1am4wfReLK6KoIev1spPjePLXXbvgnbmDQhyQ5R0+I86nC+u/FzFz3iiGT6/kO 7Uv+Pa2IHX0w2ALuyTp02MojIWvb3HmFejM0w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=YwvXSsq2Dor1tKNP8oHzoUsH5Y4oWbbuTe0U3g2mAYo=; b=yYIhT5R54og9bglo8pqx33loFp4gjK3+KmeYIaPueUZULOGM54geUZdpOC4pZ1BVo9 23hnI5nlkAlQNdHOMsHL0zp8th/jDuil7RfUleCt3/bEJgs76M0ZbPHU0cdNZs6pPnLw S2Q78lREubLLeikPWFcAlfUfSegbxKBkOoRAhBwD62NgA37rqnR2l7Pa4A5L9jw/hqY6 1NCBPbhz6e1GUHrWTEagA2O7bFVw+des4Q1J5eiZ2VHjsgc3qVmHl1A1X6vinTl68ldl lOEuZcqcpc0/rXVlUqXONxkot3Y+E1wl0hK40mUprQPcmSNHWCPt9i69SaPUtI5z2zX+ pWpQ== X-Gm-Message-State: AJIora+zmKUl1oAqZjGX9w1ayk5ht/4hS9+ZLo6bzdNb9+p3MrTJ/gf2 BQgOq7hozTAJ93Hcl6hnICyNTg== X-Google-Smtp-Source: AGRyM1txvdGqhf3KmLd4OgDVvTu0ODBrdgRduQQDmNKp7xu0usDvgEABT8kbZZ6k4OZsExNik4xW4g== X-Received: by 2002:a17:90a:f287:b0:1ef:17a4:428d with SMTP id fs7-20020a17090af28700b001ef17a4428dmr12219116pjb.101.1656627355583; Thu, 30 Jun 2022 15:15:55 -0700 (PDT) Received: from google.com ([2620:15c:202:201:1ae5:143d:6ad2:d52a]) by smtp.gmail.com with ESMTPSA id e9-20020a170902784900b001636d95fe59sm14049898pln.172.2022.06.30.15.15.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jun 2022 15:15:55 -0700 (PDT) Date: Thu, 30 Jun 2022 15:15:53 -0700 From: Brian Norris To: Douglas Anderson Cc: sjg@chromium.org, amstan@chromium.org, mka@chromium.org, u-boot@lists.denx.de Subject: Re: [PATCH 6/6] patman: Take project defaults into account for --help Message-ID: References: <20220630210809.2261698-1-dianders@chromium.org> <20220630140742.6.I79b8a2fc40f11af2ba8108f0f8166c574ae5ab47@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220630140742.6.I79b8a2fc40f11af2ba8108f0f8166c574ae5ab47@changeid> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean On Thu, Jun 30, 2022 at 02:08:09PM -0700, Doug Anderson wrote: > I'd like it so that when you do "patman send --help" and you're using > Linux that it show it the proper defaults for Linux. > > Signed-off-by: Douglas Anderson > --- > > tools/patman/main.py | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > > diff --git a/tools/patman/main.py b/tools/patman/main.py > index 1ee44feab192..a0b0ad3bad9d 100755 > --- a/tools/patman/main.py > +++ b/tools/patman/main.py > @@ -109,14 +109,19 @@ status.add_argument('-d', '--dest-branch', type=str, > status.add_argument('-f', '--force', action=BooleanOptionalAction, > help='Force overwriting an existing branch') > > -# Parse options twice: first to get the project and second to handle > -# defaults properly (which depends on project) > +# Parse options several times: > +# - first to get the project and second to handle defaults properly (which > +# depends on project). > +# - second to handle --help after we've accounted for project defaults. The previous bullet has a "second", and so does this one. Are those different meanings, or are we counting wrong? This might be a good place to say that this multiple passes on argparse is very confusing to me. That's not to say that you need to explain it for me, but just to say I'm probably not the best reviewer on this one. Brian > +# - finally after we have added an implicit command if necessary. > +# > # Use parse_known_args() in case 'cmd' is omitted > +argv = [arg for arg in sys.argv[1:] if arg not in ('-h', '--help')] > +args, _ = parser.parse_known_args(argv) > argv = sys.argv[1:] > -args, rest = parser.parse_known_args(argv) > if hasattr(args, 'project'): > settings.Setup(gitutil, parser, args.project, '') > - args, rest = parser.parse_known_args(argv) > +args, rest = parser.parse_known_args(argv) > > # If we have a command, it is safe to parse all arguments > if args.cmd: > -- > 2.37.0.rc0.161.g10f37bed90-goog >