Revert the given Commit against the given "our" Commit, producing an Index that reflects the result of the revert. Returns: an Index with the result of the revert. Parameters: revert_commit The Commit to revert. our_commit
(
self, revert_commit: Commit, our_commit: Commit, mainline: int = 0
)
| 1612 | check_error(err) |
| 1613 | |
| 1614 | def revert_commit( |
| 1615 | self, revert_commit: Commit, our_commit: Commit, mainline: int = 0 |
| 1616 | ) -> Index: |
| 1617 | """ |
| 1618 | Revert the given Commit against the given "our" Commit, producing an |
| 1619 | Index that reflects the result of the revert. |
| 1620 | |
| 1621 | Returns: an Index with the result of the revert. |
| 1622 | |
| 1623 | Parameters: |
| 1624 | |
| 1625 | revert_commit |
| 1626 | The Commit to revert. |
| 1627 | |
| 1628 | our_commit |
| 1629 | The Commit to revert against (eg, HEAD). |
| 1630 | |
| 1631 | mainline |
| 1632 | The parent of the revert Commit, if it is a merge (i.e. 1, 2). |
| 1633 | """ |
| 1634 | cindex = ffi.new('git_index **') |
| 1635 | revert_commit_ptr = ffi.new('git_commit **') |
| 1636 | our_commit_ptr = ffi.new('git_commit **') |
| 1637 | |
| 1638 | ffi.buffer(revert_commit_ptr)[:] = revert_commit._pointer[:] |
| 1639 | ffi.buffer(our_commit_ptr)[:] = our_commit._pointer[:] |
| 1640 | |
| 1641 | opts = ffi.new('git_merge_options *') |
| 1642 | err = C.git_merge_options_init(opts, C.GIT_MERGE_OPTIONS_VERSION) |
| 1643 | check_error(err) |
| 1644 | |
| 1645 | err = C.git_revert_commit( |
| 1646 | cindex, self._repo, revert_commit_ptr[0], our_commit_ptr[0], mainline, opts |
| 1647 | ) |
| 1648 | check_error(err) |
| 1649 | |
| 1650 | return Index.from_c(self, cindex) |
| 1651 | |
| 1652 | # |
| 1653 | # Amend commit |