| 494 | |
| 495 | |
| 496 | class ConflictCollection: |
| 497 | def __init__(self, index): |
| 498 | self._index = index |
| 499 | |
| 500 | def __getitem__(self, path): |
| 501 | cancestor = ffi.new('git_index_entry **') |
| 502 | cours = ffi.new('git_index_entry **') |
| 503 | ctheirs = ffi.new('git_index_entry **') |
| 504 | |
| 505 | err = C.git_index_conflict_get( |
| 506 | cancestor, cours, ctheirs, self._index._index, to_bytes(path) |
| 507 | ) |
| 508 | check_error(err) |
| 509 | |
| 510 | ancestor = IndexEntry._from_c(cancestor[0]) |
| 511 | ours = IndexEntry._from_c(cours[0]) |
| 512 | theirs = IndexEntry._from_c(ctheirs[0]) |
| 513 | |
| 514 | return ancestor, ours, theirs |
| 515 | |
| 516 | def __delitem__(self, path): |
| 517 | err = C.git_index_conflict_remove(self._index._index, to_bytes(path)) |
| 518 | check_error(err) |
| 519 | |
| 520 | def __iter__(self): |
| 521 | return ConflictIterator(self._index) |
| 522 | |
| 523 | def __contains__(self, path): |
| 524 | cancestor = ffi.new('git_index_entry **') |
| 525 | cours = ffi.new('git_index_entry **') |
| 526 | ctheirs = ffi.new('git_index_entry **') |
| 527 | |
| 528 | err = C.git_index_conflict_get( |
| 529 | cancestor, cours, ctheirs, self._index._index, to_bytes(path) |
| 530 | ) |
| 531 | if err == C.GIT_ENOTFOUND: |
| 532 | return False |
| 533 | |
| 534 | check_error(err) |
| 535 | return True |
| 536 | |
| 537 | |
| 538 | class ConflictIterator: |
no outgoing calls
no test coverage detected
searching dependent graphs…