예제 #1
0
def test_merge_conflict(split_clang_head_in_monorepo: str,
                        merge_strategy: MergeStrategy):
    push_clang_commit = commit_file('file1', 'top of branch is here')
    branch_name = f'rebase-fail/split/clang/{merge_strategy}'
    git('checkout', '-b', branch_name, split_clang_head_in_monorepo)
    commit_file('file1', 'rebase this without conflict')

    graph = CommitGraph([push_clang_commit], [split_clang_head_in_monorepo])
    with pytest.raises(ImpossibleMergeError) as err:
        merge_commit_graph_with_top_of_branch(graph, 'clang', branch_name,
                                              merge_strategy)
    if merge_strategy == MergeStrategy.Rebase:
        assert err.value.operation == 'rebase'
    elif merge_strategy == MergeStrategy.RebaseOrMerge:
        assert err.value.operation == 'merge'
예제 #2
0
def test_fast_forward_commit_graph(split_clang_head_in_monorepo: str,
                                   merge_strategy: MergeStrategy):
    # We expect a fast-forward to work with all merge strategies.
    work_head = commit_file('file1', 'updated file1')
    commit = merge_commit_graph_with_top_of_branch(
        CommitGraph([work_head], [split_clang_head_in_monorepo]), 'clang',
        'split/clang/internal/master', merge_strategy)
    assert work_head == commit
 def doit() -> str:
     graph = CommitGraph([merge_commit, push_clang_commit], [up_clang_head, split_clang_head_in_monorepo])
     return merge_commit_graph_with_top_of_branch(graph,
                                                  'clang',
                                                  branch_name,
                                                  merge_strategy)
 def doit() -> str:
     return merge_commit_graph_with_top_of_branch(CommitGraph([work_head], [split_clang_head_in_monorepo]),
                                                  'clang',
                                                  branch_name,
                                                  merge_strategy)