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

git: translated functional test repushing on wild heads

This one uncovered a nasty bug in compare_exportable()
parent 16b10f95cd02
No related branches found
No related tags found
1 merge request!15Rewrapping of hg-git, writing directly in GitLab's Git repository
......@@ -256,6 +256,46 @@
assert git_repo.branch_titles() == {'branch/default': 'merging heads'}
def test_push_multiple_heads_switch_branch(tmpdir, monkeypatch):
notifs = []
monkeypatch.setattr(gitlab, 'Hook', recording_hook(notifs))
wrapper, base_ctx = make_main_repo(tmpdir.join('repo.hg'))
git_repo = GitRepo.init(tmpdir.join('repo.git'))
# second head on default branch (easy to merge for later test)
wrapper.write_commit('bar', message="default head 2",
parent=base_ctx.node())
default_heads_titles = {'default1', 'default head 2'}
wrapper.command('gitlab-mirror')
branch_titles = git_repo.branch_titles()
assert set(branch_titles.values()) == default_heads_titles
assert len(branch_titles) == 3
wrapper.write_commit('foo', message="other", branch='other')
wrapper.command('gitlab-mirror')
branch_titles = git_repo.branch_titles()
assert set(branch_titles.values()) == default_heads_titles | {'other', }
assert len(branch_titles) == 4
# now let's add a topic on top of one of those wild 'default' heads
wrapper.write_commit('foo', message="on topic",
topic='zetop',
parent=base_ctx.node())
wrapper.command('gitlab-mirror')
branch_titles = git_repo.branch_titles()
assert set(b for b in branch_titles if not b.startswith('wild/')) == {
'branch/default', 'branch/other', 'topic/default/zetop'}
assert set(title
for name, title in branch_titles.items()
if name.startswith('wild/')) == default_heads_titles
assert branch_titles['branch/default'] in default_heads_titles
assert branch_titles['branch/other'] == 'other'
assert branch_titles['topic/default/zetop'] == 'on topic'
def test_topic_pruned(tmpdir, monkeypatch):
notifs = []
monkeypatch.setattr(gitlab, 'Hook', recording_hook(notifs))
......
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