def merge_tree(repository, ours, theirs): theirs = repository.revparse_single(theirs) theirs_tree = theirs.tree ours = repository.revparse_single(ours) ours_tree = ours.tree merge_base = repository.merge_base(theirs.hex, ours.hex) merge_base_tree = repository.get(merge_base.hex).tree index = ours_tree.merge(theirs_tree, merge_base_tree) return format_index(index)
def merge_tree(repository, ours, theirs): theirs = repository.revparse_single(theirs) theirs_tree = theirs.tree ours = repository.revparse_single(ours) ours_tree = ours.tree merge_base_oid = repository.merge_base(str(theirs.id), str(ours.id)) merge_base_tree = repository.get(str(merge_base_oid)).tree \ if merge_base_oid else ours_tree index = ours_tree.merge(theirs_tree, merge_base_tree) return format_index(index)
def merge_commits(repository, ours, theirs): theirs = repository.revparse_single(theirs) ours = repository.revparse_single(ours) merge_index = repository.merge_commits(ours, theirs) return format_index(merge_index)