From patchwork Fri May 7 09:28:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 1475413 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (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 4Fc4rB2jr5z9ssP for ; Fri, 7 May 2021 19:28:24 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9B0BE3886C74; Fri, 7 May 2021 09:28:22 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 8923A3835815 for ; Fri, 7 May 2021 09:28:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8923A3835815 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Tobias_Burnus@mentor.com IronPort-SDR: 40ctqJaaA1GjWnRwM+EqyxKBDPVAgeVRAEFXlnvTfXdzkUtuaW62k/PzYDUBJ3MYcfGXRY2gkl V+63VE6qfBUpFATTUcuvIFzQxgDvjxsjbXVSj26URpu4Va50ILWMeqPG4j1rlX/xHu74aPhzhR PYL/haZq/hoK+Z887LOOD2+2VJsp073fwhEUq5UF6Zlr2y5iCzh0k3jvdy96ICMdgzuxB4oi0q j7bYLUJXJcrvje12I1IM5SJFJT+S8O/CCeLLYg5jEUQcM8NffLN+AaUzY1tN2/bgOEZJEzErk2 pFY= X-IronPort-AV: E=Sophos;i="5.82,280,1613462400"; d="diff'?scan'208";a="63344536" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 07 May 2021 01:28:17 -0800 IronPort-SDR: WLNfw69Bfmfjm2WwKLJqhoU3zTU5XfpYky9S5i4NZ4uYSO3fUevqNv30hJiSTFNMEA1tkuCSdH Ua9Ez8go0ScFjyP71GB4D5Klds87Ci0xLF1kbZc4peqdxx5+SmEvXLRkrSd2BE5O05PO8zR0oV ZYzAP6p6mGMOJmC+57wabcyR9ICCeKO6Il3elAoN+g4kpi6RGc6B9PvjmJGUe3lJ2PcbMwJY4h kpxSiZ6ZwewxT+SH/lLaQx/CMiWksi10FXAUtEIswVUbmxwTzsIwI8p8v6uK35pCNX1njCA7M9 SCI= To: gcc-patches , =?utf-8?q?Martin_Li=C5=A1ka?= From: Tobias Burnus Subject: [Patch] contrib/gcc-changelog: Add/improve --help Message-ID: <37d20c3a-340a-6d8b-7ab4-95e98fcf377c@codesourcery.com> Date: Fri, 7 May 2021 11:28:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 Content-Language: en-US X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, 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-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi all, hi Martin, when running the scripts manually, I tend to get confused which one is which. --help helps a bit :-) OK? Tobias ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf contrib/gcc-changelog: Add/improve --help contrib/ChangeLog: * gcc-changelog/git_check_commit.py (__Main__): State in --help the default value for 'revisions'. * gcc-changelog/git_email.py (show_help): Add. (__main__): Handle -h and --help. diff --git a/contrib/gcc-changelog/git_check_commit.py b/contrib/gcc-changelog/git_check_commit.py index 935425ef813..246e9735c1d 100755 --- a/contrib/gcc-changelog/git_check_commit.py +++ b/contrib/gcc-changelog/git_check_commit.py @@ -23,7 +23,8 @@ from git_repository import parse_git_revisions parser = argparse.ArgumentParser(description='Check git ChangeLog format ' 'of a commit') parser.add_argument('revisions', default='HEAD', nargs='?', - help='Git revisions (e.g. hash~5..hash or just hash)') + help='Git revisions (e.g. hash~5..hash or just hash) - ' + 'if not specified: HEAD') parser.add_argument('-g', '--git-path', default='.', help='Path to git repository') parser.add_argument('-p', '--print-changelog', action='store_true', diff --git a/contrib/gcc-changelog/git_email.py b/contrib/gcc-changelog/git_email.py index b0547b363aa..a79d2c7ba86 100755 --- a/contrib/gcc-changelog/git_email.py +++ b/contrib/gcc-changelog/git_email.py @@ -72,10 +72,23 @@ class GitEmail(GitCommit): commit_to_info_hook=lambda x: None) -# With zero arguments, process every patch file in the ./patches directory. -# With one argument, process the named patch file. -# Patch files must be in 'git format-patch' format. +def show_help(): + print("usage: git_email.py [--help] [patch file ...]\n" + "\n" + "Check git ChangeLog format of a patch\n" + "\n" + "With zero arguments, process every patch file in the " + "./patches directory.\n" + "With one argument, process the named patch file.\n" + "\n" + "Patch files must be in 'git format-patch' format.\n\n") + sys.exit(0) + + if __name__ == '__main__': + if len(sys.argv) == 2 and (sys.argv[1] == '-h' or sys.argv[1] == '--help'): + show_help() + if len(sys.argv) == 1: allfiles = [] for root, _dirs, files in os.walk('patches'):