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

benchmark: factor a `repo_path_from_id` function

The function gather existing code to compute a partial repository path for a
given partial version of the main repository. This will be useful later for a
more flexible access to partials during discovery.
parent 136e20815c5e
No related branches found
No related tags found
No related merge requests found
......@@ -302,6 +302,15 @@
super(BaseExchangeTimeSuite, self).setup(repo, **kwargs)
self._setup_repo_type(repo_type)
self._setup_revset(revset)
repo_suffix = urllib.quote_plus(self.partial_key)
self.clone_path = self.repo_path_from_id(self.partial_key)
def repo_path_from_id(self, partial_id):
"""Return the absolute path for a given partial
"reference" is a special value that means the original repository.
"""
if partial_id == 'reference':
return self.repo_path
suffix = urllib.quote_plus(partial_id)
# We need to use the repo name here because the repo doesn't contains
# the hash
......@@ -306,7 +315,7 @@
# We need to use the repo name here because the repo doesn't contains
# the hash
self.clone_path = os.path.join(REPOS_DIR, 'partial-references', '{}-partial-{}'.format(
self.repo_name, repo_suffix))
partial_name = '{}-partial-{}'.format(self.repo_name, suffix)
return os.path.join(REPOS_DIR, 'partial-references', partial_name)
def teardown(self, *args, **kwargs):
self._teardown_repo_type()
......
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