From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.100; helo=mga07.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 03A3521A143EF for ; Thu, 2 Aug 2018 16:21:09 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Aug 2018 16:21:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,437,1526367600"; d="scan'208";a="80058590" Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga002.jf.intel.com with ESMTP; 02 Aug 2018 16:21:09 -0700 From: Jaben Carsey To: edk2-devel@lists.01.org Cc: Liming Gao , Yonghong Zhu Date: Thu, 2 Aug 2018 16:21:06 -0700 Message-Id: <35db4208c876291862f2d0a62d7064793ce08331.1533252046.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: Subject: [PATCH v1 1/1] PatchCheck - add error message for invalid parameter X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Aug 2018 23:21:10 -0000 Currently if an invalid parameter is passed, it gives a stack trace. This changes it to an error message. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Scripts/PatchCheck.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py index 7b7fba8b7044..96b3cdf1fd8a 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -1,7 +1,7 @@ ## @file # Check a patch for various format issues # -# Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
# # This program and the accompanying materials are licensed and made # available under the terms and conditions of the BSD License which @@ -528,6 +528,8 @@ class CheckGitCommits: print('Checking git commit:', commit) patch = self.read_patch_from_git(commit) self.ok &= CheckOnePatch(commit, patch).ok + if not commits: + print("Couldn't find commit matching: '{}'".format(rev_spec)) def read_commit_list_from_git(self, rev_spec, max_count): # Run git to get the commit patch @@ -536,7 +538,7 @@ class CheckGitCommits: cmd.append('--max-count=' + str(max_count)) cmd.append(rev_spec) out = self.run_git(*cmd) - return out.split() + return out.split() if out else [] def read_patch_from_git(self, commit): # Run git to get the commit patch @@ -548,7 +550,8 @@ class CheckGitCommits: p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - return p.communicate()[0].decode('utf-8', 'ignore') + Result = p.communicate() + return Result[0].decode('utf-8', 'ignore') if Result[0] and Result[0].find("fatal")!=0 else None class CheckOnePatchFile: """Performs a patch check for a single file. -- 2.16.2.windows.1