diff --git a/create_stripped_cached_repos.py b/create_stripped_cached_repos.py index 09765fb952a4864282f2018fbbc4e375892fd040_Y3JlYXRlX3N0cmlwcGVkX2NhY2hlZF9yZXBvcy5weQ==..d8148c04d494bc0dbb918c97117e97e20c506352_Y3JlYXRlX3N0cmlwcGVkX2NhY2hlZF9yZXBvcy5weQ== 100644 --- a/create_stripped_cached_repos.py +++ b/create_stripped_cached_repos.py @@ -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") diff --git a/partial-sets.yaml b/partial-sets.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d8148c04d494bc0dbb918c97117e97e20c506352_cGFydGlhbC1zZXRzLnlhbWw= --- /dev/null +++ b/partial-sets.yaml @@ -0,0 +1,8 @@ +partial-sets: + same: + last-ten: + remove: "last(all(), 10)" + last-hundred: + remove: "last(all(), 100)" + last-thousand: + remove: "last(all(), 1000)"