GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - fuyasing/pygit2: Python bindings for libgit2

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

105 Commits
105 Commits

Folders and files

NameName
Last commit message
Last commit date
test
test
 
 
.gitignore
.gitignore
 
 
COPYING
COPYING
 
 
README.md
README.md
 
 
pygit2.c
pygit2.c
 
 
setup.py
setup.py
 
 

Repository files navigation

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']          # git 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

  • David Borowitz [email protected]
  • J. David Ibáñez [email protected]

LICENSE

GPLv2 with linking exception. See COPYING for more details.

About

Python bindings for libgit2

Resources

Readme
License
Activity

Stars

1 star

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.