Skip to content
Snippets Groups Projects
Commit e2b640ed authored by Georges Racinet's avatar Georges Racinet
Browse files

command: hg hpd-ensure-gitlab-branches

This command will be useful for direct calls from the Rails
application (backups code is the first use case).

Closes #8
parent 2086b455
No related branches found
No related tags found
No related merge requests found
Pipeline #16864 passed with warnings
......@@ -143,6 +143,18 @@
git.HeptapodGitHandler(repo, repo.ui).export_commits()
@command(b'hpd-ensure-gitlab-branches')
def ensure_gitlab_branches(ui, repo):
"""Ensure that GitLab branches state file is present.
If present, nothing happens.
If not, it is initalized from the auxiliary Git repository.
See py-heptapod#8
"""
git.HeptapodGitHandler(repo, ui).ensure_gitlab_branches()
@command(b'hpd-unique-successor',
[(b'r', b'rev', b'', _(b'specified revision'), _(b'REV')),
])
......
......@@ -21,6 +21,7 @@
from .. import (
versions as hpd_versions,
branch as hpd_branch,
)
......@@ -67,6 +68,13 @@
assert 'divergent' in exc_info.value.args[0]
def test_hpd_ensure_gitlab_branches(tmpdir):
# test almost trivial because all the logic is in HeptapodGitHandler
wrapper = RepoWrapper.init(tmpdir / 'repo', config=common_config())
wrapper.command('hpd-ensure-gitlab-branches')
assert hpd_branch.read_gitlab_branches(wrapper.repo) == {}
def test_hpd_unique_successor_missing_rev(tmpdir, monkeypatch):
repo_path = tmpdir.join('repo')
wrapper = RepoWrapper.init(repo_path, config=common_config())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment