revert: Add support for git_revert_commit via Repository.revert_commit()#711
Merged
Merged
Conversation
Currently, Index.write_tree() relies on either the caller passing in a `repo=` arg or the underlying `git_index` being already bound to a `git_repository`. This ignores the case where the caller does not pass a `repo` argument to `Index.write_tree()` but the `Index._repo` property is populated on the index. This change modifies Index.write_tree() to use the passed-in `repo` argument, falls back to using `Index._repo` and then assumes that `git_index` must be bound to a `git_repository`. This change should make Index.write_tree() a little more robust in the most common use-case.
This change adds `Repository.revert_commit()` which wraps around `git_revert_commit` which will return an `Index` with the appropriate changes to revert the specified commit. Fixes libgit2#710
Contributor
Author
|
@jdavid This is ready for your review when you have a moment. |
Contributor
Author
|
Err.... @jdavid I don't think this failure is a result of my change. Do you have any thoughts? |
Member
|
It is unrelated. The Pypy3 version in Travis is too old. |
Member
|
Merged, Thanks! |
0-wiz-0
referenced
this pull request
in NetBSD/pkgsrc-wip
Aug 14, 2017
0.26.0 (2017-07-06) ------------------------- - Update to libgit2 v0.26 `#713 <https://github.com/libgit2/pygit2/pull/713>`_ - Drop support for Python 3.2, add support for cffi 1.10 `#706 <https://github.com/libgit2/pygit2/pull/706>`_ `#694 <https://github.com/libgit2/pygit2/issues/694>`_ - New ``Repository.revert_commit(...)`` `#711 <https://github.com/libgit2/pygit2/pull/711>`_ `#710 <https://github.com/libgit2/pygit2/issues/710>`_ - New ``Branch.is_checked_out()`` `#696 <https://github.com/libgit2/pygit2/pull/696>`_ - Various fixes `#706 <https://github.com/libgit2/pygit2/pull/706>`_ `#707 <https://github.com/libgit2/pygit2/pull/707>`_ `#708 <https://github.com/libgit2/pygit2/pull/708>`_ 0.25.1 (2017-04-25) ------------------------- - Add suport for Python 3.6 - New support for stash: repository methods ``stash``, ``stash_apply``, ``stash_drop`` and ``stash_pop`` `#695 <https://github.com/libgit2/pygit2/pull/695>`_ - Improved support for submodules: new repository methods ``init_submodules`` and ``update_submodules`` `#692 <https://github.com/libgit2/pygit2/pull/692>`_ - New friendlier API for branches & references: ``Repository.branches`` and ``Repository.references`` `#700 <https://github.com/libgit2/pygit2/pull/700>`_ `#701 <https://github.com/libgit2/pygit2/pull/701>`_ - New support for custom backends `#690 <https://github.com/libgit2/pygit2/pull/690>`_ - Fix ``init_repository`` crash on None input `#688 <https://github.com/libgit2/pygit2/issues/688>`_ `#697 <https://github.com/libgit2/pygit2/pull/697>`_ - Fix checkout with an orphan master branch `#669 <https://github.com/libgit2/pygit2/issues/669>`_ `#685 <https://github.com/libgit2/pygit2/pull/685>`_ - Better error messages for opening repositories `#645 <https://github.com/libgit2/pygit2/issues/645>`_ `#698 <https://github.com/libgit2/pygit2/pull/698>`_
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change adds
Repository.revert_commit()which wraps aroundgit_revert_commitwhich will return anIndexwith the appropriate changes to revert the specified commit.Fixes #710