summaryrefslogtreecommitdiffstats
path: root/hacking
diff options
context:
space:
mode:
authorMatt Martz <matt@sivel.net>2022-05-18 20:19:11 +0200
committerGitHub <noreply@github.com>2022-05-18 20:19:11 +0200
commita415697d70794f0e6e09135e1e107390c2f46435 (patch)
treeb6605f3f14156c8ff7a1ff8eda0713e61ee3e664 /hacking
parentdocs: Update porting guide for ansible 6.0.0a3 (#77842) (diff)
downloadansible-a415697d70794f0e6e09135e1e107390c2f46435.tar.xz
ansible-a415697d70794f0e6e09135e1e107390c2f46435.zip
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 10729299dd..87d4d213c9 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