diff --git a/.hg-format-source b/.hg-format-source new file mode 100644 index 0000000000000000000000000000000000000000..59e042a75849f47bc15e71ed4cc63fd288edc720_LmhnLWZvcm1hdC1zb3VyY2U= --- /dev/null +++ b/.hg-format-source @@ -0,0 +1,5 @@ +{"configpaths": ["pyproject.toml"], "pattern": "glob:lib/scmperf_lib/*.py", "tool": "black"} +{"configpaths": ["pyproject.toml"], "pattern": "repo-scripts/rename-reference-directories", "tool": "black"} +{"configpaths": ["pyproject.toml"], "pattern": "repo-scripts/update-benchrepo", "tool": "black"} +{"configpaths": ["pyproject.toml"], "pattern": "repo-scripts/make-reference", "tool": "black"} +{"configpaths": ["pyproject.toml"], "pattern": "repo-scripts/make-partial-repos", "tool": "black"} diff --git a/repo-scripts/make-partial-repos b/repo-scripts/make-partial-repos index f5fe59139f11920cbda87d785248d8970abd4306_cmVwby1zY3JpcHRzL21ha2UtcGFydGlhbC1yZXBvcw==..59e042a75849f47bc15e71ed4cc63fd288edc720_cmVwby1zY3JpcHRzL21ha2UtcGFydGlhbC1yZXBvcw== 100755 --- a/repo-scripts/make-partial-repos +++ b/repo-scripts/make-partial-repos @@ -27,7 +27,8 @@ with open(config_path) as config_file: return yaml.load(config_file.read()) + def clone_repositories(partial_revset, paths): for refpath in paths: refdir = os.path.dirname(refpath) @@ -30,7 +31,7 @@ def clone_repositories(partial_revset, paths): for refpath in paths: refdir = os.path.dirname(refpath) - refconfig = read_configuration(refpath)['reference-repo'] - repo_name = refconfig['id'] + refconfig = read_configuration(refpath)["reference-repo"] + repo_name = refconfig["id"] @@ -36,5 +37,5 @@ - if not refconfig['enabled']: + if not refconfig["enabled"]: print("skipping disabled reference repository:", repo_name) continue @@ -43,6 +44,6 @@ for pset, setconfig in sorted(partial_revset.items()): revset = None if setconfig is not None: - revset = setconfig.get('remove') + revset = setconfig.get("remove") repo_suffix = pset partial_name = "{}-partial-{}".format(repo_prefix, repo_suffix) @@ -47,6 +48,6 @@ repo_suffix = pset partial_name = "{}-partial-{}".format(repo_prefix, repo_suffix) - partialdir = join('.', partial_name) + partialdir = join(".", partial_name) if not isdir(partialdir): print( "Cloning %s (%s%s) into %s (for exchange benchmarks)" @@ -74,6 +75,16 @@ ) # Write the expected tip rev and node to check with the verify script later - subprocess.check_call( - ["hg", "--cwd", partialdir, "debugupdatecache"] + subprocess.check_call(["hg", "--cwd", partialdir, "debugupdatecache"]) + tip_rev_hash = subprocess.check_output( + [ + "hg", + "--cwd", + partialdir, + "log", + "-r", + "tip", + "-T", + "{rev} {node}", + ] ) @@ -79,5 +90,4 @@ ) - tip_rev_hash = subprocess.check_output(["hg", "--cwd", partialdir, "log", "-r", "tip", "-T", "{rev} {node}"]) tip_file_path = join(partialdir, ".hg", "ASV_EXPECTED_TIP_REV_HASH") with open(tip_file_path, "w") as f: @@ -85,9 +95,10 @@ subprocess.check_call(["tar", "cf", "%s.tar" % partial_name, partialdir]) + USAGE = "usage: make-partials-repo CONFIG REFERENCE.yaml+" if len(sys.argv) < 3: print(USAGE, file=sys.stderr) sys.exit(64) partials_path = sys.argv[1] @@ -88,10 +99,10 @@ USAGE = "usage: make-partials-repo CONFIG REFERENCE.yaml+" if len(sys.argv) < 3: print(USAGE, file=sys.stderr) sys.exit(64) partials_path = sys.argv[1] -partials_config = read_configuration(partials_path)['partial-sets'] +partials_config = read_configuration(partials_path)["partial-sets"] paths = sys.argv[2:] diff --git a/repo-scripts/make-reference b/repo-scripts/make-reference index f5fe59139f11920cbda87d785248d8970abd4306_cmVwby1zY3JpcHRzL21ha2UtcmVmZXJlbmNl..59e042a75849f47bc15e71ed4cc63fd288edc720_cmVwby1zY3JpcHRzL21ha2UtcmVmZXJlbmNl 100755 --- a/repo-scripts/make-reference +++ b/repo-scripts/make-reference @@ -18,7 +18,7 @@ gather_repo_stats, shell_exec, check_format_data, - get_reference_hash + get_reference_hash, ) # isort:skip @@ -59,11 +59,7 @@ with open(args.hgrc, "rb") as hgrc_file: hgrc_file.read(1) except (IOError, OSError): - print( - "Given hgrc {0!r} is not readable by current user".format( - args.hgrc - ) - ) + print("Given hgrc {0!r} is not readable by current user".format(args.hgrc)) sys.exit(1) ### initial clone @@ -136,7 +132,6 @@ with open(repo_details, "w") as repo_details_file: repo_details_file.write(yaml.dump(data, default_flow_style=False)) - # Rename the repo prior to archiving os.rename(repo_main, repo_main_with_hash) diff --git a/repo-scripts/rename-reference-directories b/repo-scripts/rename-reference-directories index f5fe59139f11920cbda87d785248d8970abd4306_cmVwby1zY3JpcHRzL3JlbmFtZS1yZWZlcmVuY2UtZGlyZWN0b3JpZXM=..59e042a75849f47bc15e71ed4cc63fd288edc720_cmVwby1zY3JpcHRzL3JlbmFtZS1yZWZlcmVuY2UtZGlyZWN0b3JpZXM= 100755 --- a/repo-scripts/rename-reference-directories +++ b/repo-scripts/rename-reference-directories @@ -5,6 +5,7 @@ SUFFIX = "-reference" + def main(repo_dir): for file in sorted(os.listdir(repo_dir)): file_path = os.path.join(repo_dir, file) @@ -14,7 +15,7 @@ if not file_path.endswith(SUFFIX): continue - new_dir_path = file_path[:-len(SUFFIX)] + new_dir_path = file_path[: -len(SUFFIX)] print("Renaming %s into %s" % (file_path, new_dir_path)) os.rename(file_path, new_dir_path) diff --git a/repo-scripts/update-benchrepo b/repo-scripts/update-benchrepo index f5fe59139f11920cbda87d785248d8970abd4306_cmVwby1zY3JpcHRzL3VwZGF0ZS1iZW5jaHJlcG8=..59e042a75849f47bc15e71ed4cc63fd288edc720_cmVwby1zY3JpcHRzL3VwZGF0ZS1iZW5jaHJlcG8= 100755 --- a/repo-scripts/update-benchrepo +++ b/repo-scripts/update-benchrepo @@ -68,9 +68,7 @@ # And write it with open(benchrepo_path, "w") as new_benchrepo_file: - new_benchrepo_file.write( - yaml.dump(new_benchrepo, default_flow_style=False) - ) + new_benchrepo_file.write(yaml.dump(new_benchrepo, default_flow_style=False)) # Write the new stats in the tar print("Archiving the new benchrepo file.")