Commit 69151939 authored by Raphaël Gomès's avatar Raphaël Gomès
Browse files

Add test for semi-linear history merge strategy

parent 5c72c706aa97
Pipeline #17800 passed with stage
in 23 minutes and 19 seconds
......@@ -582,6 +582,65 @@ def test_mergerequest_api_fast_forward_required(test_project, tmpdir):
assert log.splitlines() == ['2:whale:draft', '1::public', '0::public']
def test_mergerequest_api_semi_linear(test_project, tmpdir):
"""Accepting a MR configured for semi-linear workflow.
"""
repo = hg.LocalRepo.init(tmpdir.join('repo'),
default_url=test_project.owner_basic_auth_url)
test_project.webdriver_update_merge_request_settings(
merge_method='rebase_merge',
)
topic = prepare_topic(repo, needing_rebase=False)
mr_id = create_mr(test_project, topic=topic)
api_accept_merge_request(test_project, mr_id)
repo.hg('pull')
log = repo.hg('log', '-T', '{rev}:{phase}\n')
# unchanged revnos proves that Heptapod didn't do anything funky
assert log.splitlines() == ['2:public', '1:public', '0:public']
merge_desc = "Merge branch 'topic/default/antelope' into 'branch/default'"
test_project.wait_assert_api_branches(
lambda branches: extract_gitlab_branch_titles(branches) == {
'branch/default': merge_desc
})
# now let's make a new changeset that would be a fast-forward for
# Git at first sight (DAG is linear) but wouldn't be for Mercurial
# because it has a different named branch
repo.hg('topic', 'whale')
repo.hg('branch', 'sea')
repo.path.join('whale').write("A lion would be puzzled to see a whale")
repo.hg('commit', '-Am', "Whale")
repo.hg('push')
assert test_project.api_branch_titles() == {
'branch/default': merge_desc,
'topic/sea/whale': 'Whale',
}
mr_id = test_project.api_create_merge_request(source='topic/sea/whale',
target='branch/default')
api_accept_merge_request(test_project, mr_id, check_merged=False)
# Ideally we should have had an error, but that's not the case as of
# this writing. In the meanwhile, nothing has changed
assert test_project.api_branch_titles() == {
'branch/default': merge_desc,
'topic/sea/whale': 'Whale',
}
repo.hg('pull')
log = repo.hg('log', '-T', '{rev}:{topic}:{phase}\n')
# unchanged revnos proves that Heptapod didn't do anything funky
assert log.splitlines() == [
'3:whale:draft',
'2::public',
'1::public',
'0::public',
]
def test_mergerequest_api_fast_forward_refusal_rebase(test_project, tmpdir):
"""Accepting the MR via API with rebase scenario.
......
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