Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ansible/ansible.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Martz <matt@sivel.net>2022-05-18 21:19:11 +0300
committerGitHub <noreply@github.com>2022-05-18 21:19:11 +0300
commita415697d70794f0e6e09135e1e107390c2f46435 (patch)
treeb6605f3f14156c8ff7a1ff8eda0713e61ee3e664 /hacking
parent66e92a3aff89802148e3e4867219c0c5a723cfbf (diff)
Allow result sha to be overriden with local sha (#77832)
Diffstat (limited to 'hacking')
-rwxr-xr-xhacking/azp/incidental.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/hacking/azp/incidental.py b/hacking/azp/incidental.py
index 10729299dd4..87d4d213c94 100755
--- a/hacking/azp/incidental.py
+++ b/hacking/azp/incidental.py
@@ -86,6 +86,10 @@ def parse_args():
action='store_true',
help='increase verbosity')
+ parser.add_argument('--result-sha',
+ default=None,
+ help='Override the result sha')
+
targets = parser.add_mutually_exclusive_group()
targets.add_argument('--targets',
@@ -131,11 +135,13 @@ def incidental_report(args):
git = Git(os.path.abspath(args.source))
coverage_data = CoverageData(os.path.abspath(args.result))
+ result_sha = args.result_sha or coverage_data.result_sha
+
try:
- git.show([coverage_data.result_sha, '--'])
+ git.show([result_sha, '--'])
except subprocess.CalledProcessError:
raise ApplicationError('%s: commit not found: %s\n'
- 'make sure your source repository is up-to-date' % (git.path, coverage_data.result_sha))
+ 'make sure your source repository is up-to-date' % (git.path, result_sha))
if coverage_data.result != "succeeded":
check_failed(args, 'results indicate tests did not pass (result: %s)\n'
@@ -225,7 +231,7 @@ def incidental_report(args):
cached(source_expanded_target_path, args.use_cache, args.verbose,
lambda: ct.expand(source_target_path, source_expanded_target_path))
- summary[target_name] = sources = collect_sources(source_expanded_target_path, git, coverage_data)
+ summary[target_name] = sources = collect_sources(source_expanded_target_path, git, coverage_data, result_sha)
txt_report_path = os.path.join(reports_path, '%s.txt' % cache_name)
cached(txt_report_path, args.use_cache, args.verbose,
@@ -364,7 +370,7 @@ class SourceFile:
self.covered_lines = set(abs(p[0]) for p in self.covered_points) | set(abs(p[1]) for p in self.covered_points)
-def collect_sources(data_path, git, coverage_data):
+def collect_sources(data_path, git, coverage_data, result_sha):
with open(data_path) as data_file:
data = json.load(data_file)
@@ -372,7 +378,7 @@ def collect_sources(data_path, git, coverage_data):
for path_coverage in data.values():
for path, path_data in path_coverage.items():
- sources.append(SourceFile(path, git.show(['%s:%s' % (coverage_data.result_sha, path)]), coverage_data, path_data))
+ sources.append(SourceFile(path, git.show(['%s:%s' % (result_sha, path)]), coverage_data, path_data))
return sources