@@ -223,6 +223,41 @@ def add(self, path_or_entry):
223
223
224
224
check_error (err , io = True )
225
225
226
+ def add_conflict (self , ancestor , ours , theirs ):
227
+ """
228
+ Add or update index entries to represent a conflict. Any staged entries that
229
+ exist at the given paths will be removed.
230
+
231
+ Parameters:
232
+
233
+ ancestor
234
+ ancestor of the conflict
235
+ ours
236
+ ours side of the conflict
237
+ theirs
238
+ their side of the conflict
239
+ """
240
+
241
+ if ancestor and not isinstance (ancestor , IndexEntry ):
242
+ raise TypeError ('ancestor has to be an instance of IndexEntry or None' )
243
+ if ours and not isinstance (ours , IndexEntry ):
244
+ raise TypeError ('ours has to be an instance of IndexEntry or None' )
245
+ if theirs and not isinstance (theirs , IndexEntry ):
246
+ raise TypeError ('theirs has to be an instance of IndexEntry or None' )
247
+
248
+ centry_ancestor = centry_ours = centry_theirs = ffi .NULL
249
+ if ancestor is not None :
250
+ centry_ancestor , _ = ancestor ._to_c ()
251
+ if ours is not None :
252
+ centry_ours , _ = ours ._to_c ()
253
+ if theirs is not None :
254
+ centry_theirs , _ = theirs ._to_c ()
255
+ err = C .git_index_conflict_add (
256
+ self ._index , centry_ancestor , centry_ours , centry_theirs
257
+ )
258
+
259
+ check_error (err , io = True )
260
+
226
261
def diff_to_workdir (
227
262
self ,
228
263
flags : DiffOption = DiffOption .NORMAL ,
0 commit comments