J. David Ibáñez 6f2b864619 Change API to create Git objects
Do not allow to create commits, trees, blobs and tags directly from the
constructor. For instance, now calling "Commit(...)" raises an error.
Instead use the create methods of the repository object:

  Before                         Now
  -----------------------------  -----------------------------
  commit = Commit(repo, ...)     sha = repo.create_commit(...)
  tag = Tag(repo, ...)           sha = repo.create_tag(...)

Most often you won't need to get the object just created, but if you
do just call "repo[sha]" afterwards. (Methods to create blobs and trees
are still missing, just like before.)

Similarly the method that creates a tree object from the index file does
not return the tree object anymore, but just its SHA:

  Before                         Now
  -----------------------------  -----------------------------
  tree = index.create_tree()     sha = index.create_tree()
2011-04-11 18:44:49 +02:00
2011-04-11 18:44:49 +02:00
2011-02-07 12:37:47 +01:00
2011-04-11 18:44:49 +02:00
2011-03-08 19:02:50 +01:00
2011-02-10 11:40:20 +01:00

pygit2 - libgit2 bindings in Python

pygit2 is a set of Python 2.5+ bindings to the libgit2 linkable C Git library.

INSTALLING AND RUNNING

First you need to install the latest version of libgit2. You can find platform-specific instructions to build the library in the libgit2 website:

http://libgit2.github.com

Next, make sure you have the required library dependencies for pygit2: OpenSSL and ZLib. For instance, in Debian-based systems run:

$ sudo apt-get install zlib1g-dev libssl-dev

Also, make sure you have Python 2.5+ installed together with the Python development headers.

When those are installed, you can install pygit2:

$ git clone git://github.com/libgit2/pygit2.git 
$ cd pygit2
$ python setup.py install
$ python setup.py test

USING

Initialize a Git repository:

>>> from pygit2 import init_repository
>>> bare = False
>>> repo = init_repository('test', bare)

Open a repository:

>>> from pygit2 import Repository
>>> repo = Repository('test/.git')

Index read:

>>> index = repo.index
>>> index.read()
>>> sha = index['path/to/file'].sha    # from path to sha
>>> blob = repo[sha]                   # from sha to blob

Iterate over all entries of the index:

>>> for i in range(0, len(index)):
...     entry = index[i]
...     print entry.path, entry.sha

Index write:

>>> index.add('path/to/file')          # git add
>>> del index['path/to/file']          # gig rm
>>> index.write()                      # don't forget to save the changes

Revision walking:

>>> from pygit2 import GIT_SORT_TIME
>>> for commit in repo.walk(sha, GIT_SORT_TIME):
...     print commit.sha

CONTRIBUTING

Fork libgit2/pygit2 on GitHub, make it awesomer (preferably in a branch named for the topic), send a pull request.

AUTHORS

LICENSE

GPLv2 with linking exception. See COPYING for more details.

Description
RETIRED, further work has moved to Debian project infrastructure
Readme 2 MiB
Languages
C 50.5%
Python 49.5%