mirror of https://github.com/acidanthera/audk.git
PatchCheck - add error message for invalid parameter
Currently if an invalid parameter is passed, it gives a stack trace. This changes it to an error message. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> Tested-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
parent
e5cbb98256
commit
5ac4548cdf
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# Check a patch for various format issues
|
# Check a patch for various format issues
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials are licensed and made
|
# This program and the accompanying materials are licensed and made
|
||||||
# available under the terms and conditions of the BSD License which
|
# available under the terms and conditions of the BSD License which
|
||||||
|
@ -528,6 +528,8 @@ class CheckGitCommits:
|
||||||
print('Checking git commit:', commit)
|
print('Checking git commit:', commit)
|
||||||
patch = self.read_patch_from_git(commit)
|
patch = self.read_patch_from_git(commit)
|
||||||
self.ok &= CheckOnePatch(commit, patch).ok
|
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):
|
def read_commit_list_from_git(self, rev_spec, max_count):
|
||||||
# Run git to get the commit patch
|
# Run git to get the commit patch
|
||||||
|
@ -536,7 +538,7 @@ class CheckGitCommits:
|
||||||
cmd.append('--max-count=' + str(max_count))
|
cmd.append('--max-count=' + str(max_count))
|
||||||
cmd.append(rev_spec)
|
cmd.append(rev_spec)
|
||||||
out = self.run_git(*cmd)
|
out = self.run_git(*cmd)
|
||||||
return out.split()
|
return out.split() if out else []
|
||||||
|
|
||||||
def read_patch_from_git(self, commit):
|
def read_patch_from_git(self, commit):
|
||||||
# Run git to get the commit patch
|
# Run git to get the commit patch
|
||||||
|
@ -548,7 +550,8 @@ class CheckGitCommits:
|
||||||
p = subprocess.Popen(cmd,
|
p = subprocess.Popen(cmd,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT)
|
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:
|
class CheckOnePatchFile:
|
||||||
"""Performs a patch check for a single file.
|
"""Performs a patch check for a single file.
|
||||||
|
|
Loading…
Reference in New Issue