Skip to content
Snippets Groups Projects
Commit 2153b0f38f38 authored by Georges Racinet's avatar Georges Racinet :squid:
Browse files

Moving Git repos out of reach of Gitaly: subdirectory fixes

The move command did not create all intermediate directories,
hence was failing on the typical GitLab hashed storage structure.
In the unit tests, the repositories are at the root of the
storage, missing this.

Also fixing a minor typo in the sanity check error raising, that
would not lead to breakage but was not the intent.
parent da05c3180c16
No related branches found
No related tags found
1 merge request!109Moving Git repos fixes
Pipeline #93802 passed
......@@ -183,11 +183,11 @@
def move_hg_git_repo_out_of_gitaly_reach(ui, repo):
"""Export changesets as Git commits in the GitLab repository."""
if ui.configbool(b'heptapod', b'no-git'):
raise error.Abort(b"This should not be run on a native repository ",
"without Git conversion")
raise error.Abort(b"This should not be run on a native repository "
b"without Git conversion")
if not ui.configbool(b'heptapod', b'native'):
raise error.Abort(b"This should not be run on a repository based "
b"on hg-git: the point is to expose them to Gitaly")
git.HeptapodGitHandler(repo, repo.ui) # instantiation is enough
......@@ -188,9 +188,10 @@
if not ui.configbool(b'heptapod', b'native'):
raise error.Abort(b"This should not be run on a repository based "
b"on hg-git: the point is to expose them to Gitaly")
git.HeptapodGitHandler(repo, repo.ui) # instantiation is enough
return 0
@command(b'hpd-ensure-gitlab-branches')
......
......@@ -65,5 +65,8 @@
old_gitdir = re.sub(br'\.hg$', b'', main_repo.root) + b'.git'
storages_root = self.repo.ui.config(b'heptapod', b'repositories-root')
git_repos_root = os.path.join(storages_root,
b'+hgitaly', b'hg-git')
os.makedirs(git_repos_root, mode=0o700, exist_ok=True)
if self.repo.ui.configbool(b'heptapod', b'native'):
rel_path = os.path.relpath(old_gitdir, storages_root)
......@@ -68,6 +71,3 @@
if self.repo.ui.configbool(b'heptapod', b'native'):
rel_path = os.path.relpath(old_gitdir, storages_root)
git_repos_root = os.path.join(storages_root,
b'+hgitaly', b'hg-git')
os.makedirs(git_repos_root, mode=0o700, exist_ok=True)
self.gitdir = os.path.join(git_repos_root, rel_path)
......@@ -73,4 +73,7 @@
self.gitdir = os.path.join(git_repos_root, rel_path)
os.makedirs(os.path.dirname(self.gitdir),
mode=0o700,
exist_ok=True)
if (
os.path.exists(old_gitdir)
and not os.path.exists(self.gitdir)
......
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