Commit 8fe038be4c7 by Georges Racinet

Tests for allowance of inner Git force pushes

In other words, for heptapod#129
parent 0b486d3c71d
Pipeline #2337 passed with stage
in 13 seconds
......@@ -555,3 +555,38 @@ def test_topic_branch_change(test_project, tmpdir):
'branch/other': 'Commit 1',
'topic/default/zetop': 'Commit 2',
def test_internal_force_push_default_branch(test_project, tmpdir):
Although protected, but still accept internal Git force-pushes.
See heptapod#129
repo_path = tmpdir.join('repo1')
url = test_project.owner_basic_auth_url
# internal force pushes occur upon amending of drafts without topics.
"topic.publish-bare-branch = no",
repo = LocalRepo.init(repo_path)
in_repo = repo_path.join('foo')
repo.hg('commit', '-Am', "Commit 0")
repo.hg('phase', '-p', ".")
repo.hg('commit', '-Am', "Commit 1")
repo.hg('push', url)
assert test_project.api_default_branch() == 'branch/default'
assert test_project.api_branch_titles() == {'branch/default': 'Commit 1'}
repo.hg('amend', '-m', "Amended")
repo.hg('push', url)
assert test_project.api_branch_titles() == {'branch/default': 'Amended'}
clone = LocalRepo.clone(url, tmpdir.join('repo2'))
log = clone.hg('log', '-T', '{desc}:{phase}\n')
assert log.splitlines() == ['Amended:draft', 'Commit 0:public']
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