Skip to content

revert: Add support for git_revert_commit via Repository.revert_commit()#711

Merged
jdavid merged 2 commits into
libgit2:masterfrom
mark-adams:710-add-git-revert-commit
Jun 6, 2017
Merged

revert: Add support for git_revert_commit via Repository.revert_commit()#711
jdavid merged 2 commits into
libgit2:masterfrom
mark-adams:710-add-git-revert-commit

Conversation

@mark-adams

Copy link
Copy Markdown
Contributor

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 #710

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
@mark-adams

Copy link
Copy Markdown
Contributor Author

@jdavid This is ready for your review when you have a moment.

@mark-adams

Copy link
Copy Markdown
Contributor Author

Err.... @jdavid I don't think this failure is a result of my change. Do you have any thoughts?

@jdavid

jdavid commented Jun 6, 2017

Copy link
Copy Markdown
Member

It is unrelated. The Pypy3 version in Travis is too old.

@jdavid jdavid merged commit c6305a0 into libgit2:master Jun 6, 2017
@jdavid

jdavid commented Jun 6, 2017

Copy link
Copy Markdown
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>`_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants