Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom backends #690

Merged
merged 1 commit into from
Feb 9, 2017

Conversation

hishnash
Copy link
Contributor

@hishnash hishnash commented Feb 9, 2017

We use a Capsule to pass the git_repository struct through python.

This Capsule does not need a destructor since libgit will free the git_repository struct when it needs to.

this addresses some of the needs for #76

path_backend = init_file_backend(path)
super(Repository, self).__init__(backend=path_backend, *args, **kwargs)
self._common_init()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_common_init would be called twice, first from the super class, and then here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

src/pygit2.c Outdated
if (!PyArg_ParseTuple(args, "s", &path)) {
return NULL;
};

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you fix the indentation please? here and elsewhere in the C code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Signed-off-by: Matthaus Woolard <[email protected]>
@jdavid jdavid merged commit 4fbc1f1 into libgit2:master Feb 9, 2017
0-wiz-0 added a commit to NetBSD/pkgsrc-wip that referenced this pull request 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>`_
@xmo-odoo xmo-odoo mentioned this pull request May 11, 2018
@webknjaz
Copy link
Contributor

Hey @hishnash, is it possible to use this with non-file backends? like mysql or so

@hishnash
Copy link
Contributor Author

@webknjaz yes this was done to allow for https://github.com/luckymarmot/GitPagedArchiveBackend

here we are just using a custom backed for the ODB portion but you could use something very simlare to get a RefDB backend loaded as well.

@webknjaz
Copy link
Contributor

Thank you for the reference, I'll try that :)

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.

None yet

3 participants