This instance will be upgraded to the latest Heptapod 0.20rc on 2021-02-26 at 11:00 UTC+1

Commit 62b494f2 authored by Georges Racinet's avatar Georges Racinet 🦑

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 ac03d11b6b59
Pipeline #17081 passed with stages
in 1 minute and 9 seconds
......@@ -143,6 +143,18 @@ def gitlab_mirror(ui, repo):
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 .utils import common_config
from .. import (
versions as hpd_versions,
branch as hpd_branch,
)
......@@ -67,6 +68,13 @@ def test_hpd_unique_successor_divergence(tmpdir, monkeypatch):
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())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment