Skip to content
Snippets Groups Projects
Commit d8148c04d494 authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

partial-repos: get set to remove from a config file

Hardcoding stuff creates various issues. Lets move to something more flexible.
parent 09765fb952a4
No related branches found
No related tags found
No related merge requests found
......@@ -7,17 +7,8 @@
import yaml
import urllib
# changesets stripped in partial clones
PARTIAL_REVSET = (
"same",
"last(all(), 10)",
"last(all(), 100)",
"last(all(), 1000)",
)
def read_configuration(config_path):
with open(config_path) as config_file:
return yaml.load(config_file.read())
......@@ -19,9 +10,9 @@
def read_configuration(config_path):
with open(config_path) as config_file:
return yaml.load(config_file.read())
def clone_repositories(config, repos_dir):
def clone_repositories(config, partial_revset, repos_dir):
cachedir = join(repos_dir, ".cache")
try:
os.makedirs(cachedir)
......@@ -30,7 +21,9 @@
raise
for repo_name, repo in config["repos"].items():
clonedir = join(repos_dir, repo_name)
for revset in PARTIAL_REVSET:
print partial_revset
for pset, setconfig in partial_revset.items():
revset = setconfig.get('remove')
repo_suffix = urllib.quote_plus(revset)
partialdir = join(cachedir, "partial-{}-{}".format(repo_name, repo_suffix))
if not isdir(partialdir):
......@@ -46,7 +39,7 @@
subprocess.check_call(
["hg", "clone", "--noupdate", clonedir, partialdir]
)
if revset != "same":
if revset is not None:
subprocess.check_call(
[
"hg",
......@@ -64,5 +57,7 @@
["hg", "--cwd", partialdir, "debugupdatecache"]
)
partial_revset = read_configuration("partial-sets.yaml")
config = read_configuration("config.yaml")
......@@ -67,3 +62,3 @@
config = read_configuration("config.yaml")
clone_repositories(config, "repos")
clone_repositories(config, partial_revset['partial-sets'], "repos")
partial-sets:
same:
last-ten:
remove: "last(all(), 10)"
last-hundred:
remove: "last(all(), 100)"
last-thousand:
remove: "last(all(), 1000)"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment