MCPcopy Create free account
hub / github.com/libgit2/pygit2 / test_merge_no_fastforward_conflicts

Function test_merge_no_fastforward_conflicts

test/test_merge.py:113–145  ·  view source on GitHub ↗
(mergerepo: Repository)

Source from the content-addressed store, hash-verified

111
112
113def test_merge_no_fastforward_conflicts(mergerepo: Repository) -> None:
114 branch_head_hex = '1b2bae55ac95a4be3f8983b86cd579226d0eb247'
115 branch_id = mergerepo[branch_head_hex].id
116
117 analysis, preference = mergerepo.merge_analysis(branch_id)
118 assert not analysis & MergeAnalysis.UP_TO_DATE
119 assert not analysis & MergeAnalysis.FASTFORWARD
120
121 mergerepo.merge(branch_id)
122 assert mergerepo.index.conflicts is not None
123 with pytest.raises(KeyError):
124 mergerepo.index.conflicts.__getitem__('some-file')
125 assert 'some-file' not in mergerepo.index.conflicts
126 assert '.gitignore' in mergerepo.index.conflicts
127
128 status = FileStatus.CONFLICTED
129 # Asking twice to assure the reference counting is correct
130 assert {'.gitignore': status} == mergerepo.status()
131 assert {'.gitignore': status} == mergerepo.status()
132
133 ancestor, ours, theirs = mergerepo.index.conflicts['.gitignore']
134 assert ancestor is None
135 assert ours is not None
136 assert theirs is not None
137 assert '.gitignore' == ours.path
138 assert '.gitignore' == theirs.path
139 assert 1 == len(list(mergerepo.index.conflicts))
140
141 # Checking the index works as expected
142 mergerepo.index.add('.gitignore')
143 mergerepo.index.write()
144 assert mergerepo.index.conflicts is None
145 assert {'.gitignore': FileStatus.INDEX_MODIFIED} == mergerepo.status()
146
147
148def test_merge_remove_conflicts(mergerepo: Repository) -> None:

Callers

nothing calls this directly

Calls 5

mergeMethod · 0.80
statusMethod · 0.80
__getitem__Method · 0.45
addMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…