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

Method add_conflict

pygit2/index.py:230–267  ·  view source on GitHub ↗

Add or update index entries to represent a conflict. Any staged entries that exist at the given paths will be removed. Parameters: ancestor ancestor of the conflict ours ours side of the conflict theirs their side

(
        self, ancestor: 'IndexEntry', ours: 'IndexEntry', theirs: 'IndexEntry | None'
    )

Source from the content-addressed store, hash-verified

228 check_error(err, io=True)
229
230 def add_conflict(
231 self, ancestor: 'IndexEntry', ours: 'IndexEntry', theirs: 'IndexEntry | None'
232 ) -> None:
233 """
234 Add or update index entries to represent a conflict. Any staged entries that
235 exist at the given paths will be removed.
236
237 Parameters:
238
239 ancestor
240 ancestor of the conflict
241 ours
242 ours side of the conflict
243 theirs
244 their side of the conflict
245 """
246
247 if ancestor and not isinstance(ancestor, IndexEntry):
248 raise TypeError('ancestor has to be an instance of IndexEntry or None')
249 if ours and not isinstance(ours, IndexEntry):
250 raise TypeError('ours has to be an instance of IndexEntry or None')
251 if theirs and not isinstance(theirs, IndexEntry):
252 raise TypeError('theirs has to be an instance of IndexEntry or None')
253
254 centry_ancestor: ffi.NULL_TYPE | ffi.GitIndexEntryC = ffi.NULL
255 centry_ours: ffi.NULL_TYPE | ffi.GitIndexEntryC = ffi.NULL
256 centry_theirs: ffi.NULL_TYPE | ffi.GitIndexEntryC = ffi.NULL
257 if ancestor is not None:
258 centry_ancestor, path_ancestor = ancestor._to_c()
259 if ours is not None:
260 centry_ours, path_ours = ours._to_c()
261 if theirs is not None:
262 centry_theirs, path_theirs = theirs._to_c()
263 err = C.git_index_conflict_add(
264 self._index, centry_ancestor, centry_ours, centry_theirs
265 )
266
267 check_error(err, io=True)
268
269 def diff_to_workdir(
270 self,

Callers 1

test_add_conflictFunction · 0.95

Calls 2

check_errorFunction · 0.85
_to_cMethod · 0.80

Tested by 1

test_add_conflictFunction · 0.76