Questions tagged [pygit2]

Pygit2 is a set of Python bindings to the libgit2 shared library.

Pygit2 is a set of Python bindings to the libgit2 shared library, libgit2 implements the core of Git. Pygit2 works with Python 2.6, 2.7, 3.1, 3.2 and 3.3

Pygit2 links:

82 questions
3
votes
4 answers

Installing pygit2/libgit2 in Python virtualenv on a Mac

I think I'm about to lose my mind. I'm trying to simply install pygit2 in my python virtualenv on my macbook air so I can get to work. However this is not budging and I have been trying to set it up all day. I'm supposed follow these instructions :…
Emil Davtyan
  • 13,808
  • 5
  • 44
  • 66
2
votes
1 answer

How to make an initial commit using pygit2?

Using the pygit2 package how do you create an initial commit on a new repository? I keep getting an error message that "refs/heads/master" isn't found.
Connor Fuhrman
  • 781
  • 6
  • 15
2
votes
1 answer

How to get lines changed for each file in a diff in pygit2

Using, pygit2, I can get the total number of files changed, total insertions, total deletions, and the relative path of the files. See below code. However, I can't find a way to get the stats on lines changed for each modified files like git diff…
Nasif Imtiaz Ohi
  • 1,563
  • 5
  • 24
  • 45
2
votes
2 answers

how to use git pull with GitPython?

I am trying to pull filesfrom git using python but it's not working. Below is the code I was using: import git git.cmd.Git().pull('https://github.com/User/repo','master') it asks for authentication and after that terminates. Could someone please…
ZZ3111
  • 67
  • 2
  • 7
2
votes
1 answer

How to import pygit2 library into AWS lambda python3.8 runtime

I am facing an issue with AWS lambda function. I am unable to import pygit2 library into my function. I tried it on 4 different runtime environments and each gives a different error, which makes me think that there is something wrong within the…
Lukas
  • 33
  • 4
2
votes
1 answer

Pygit2: Need help on how to walk on all commits in all repo's branches

I'd need to walk on entire repo's branches commits. I have tried this but with no success. : for branch_name in list(repo.branches.remote): try: branch = repo.lookup_branch(branch_name) ref = repo.lookup_reference(branch.name) …
user2326167
  • 107
  • 1
  • 6
2
votes
1 answer

pip requirement based on available OS library version

I am developing a python package based on pygit2. pygit2 depends on libgit2. Ubuntu 18.04 has version libgit2-2.6 Ubuntu 18.10 has version libgit2-2.7 In my requirements.txt/Pipfile, if I have "pygit2" = "==0.26.4", it works in 18.04 (after doing…
balki
  • 26,394
  • 30
  • 105
  • 151
2
votes
0 answers

Install pygit2 with pip in the same version as libgit2

I have a project that depends on the pygit2 library. The pygit2 library in turn depends on the locally installed libgit2 and both have to match the minor-version: https://www.pygit2.org/install.html#version-numbers In my requirements.txt I've…
white_gecko
  • 4,808
  • 4
  • 55
  • 76
2
votes
0 answers

pygit2 appears to return the wrong flags for repo.status()

I'm running repo.status().items() in a pre-commit hook using the -a flag (git commit -a -m "Test"), and I get a result that looks like this: [('config/git_hooks/pre-commit', 256), ('bin/run_flake8', 256)] If I run git status in that same process, I…
Chris B.
  • 85,731
  • 25
  • 98
  • 139
2
votes
2 answers

Installing libgit2 and pygit2 on Debian Docker

I have been trying to install pygit2 and libgit2 using a Debian:Jessie docker file. I was able to compile the package with almost the same packages with ubuntu, but not with debian. Below is the Dockerfile I used and output error sample FROM…
Mo J. Mughrabi
  • 6,747
  • 16
  • 85
  • 143
2
votes
1 answer

Unusual behavior of jinja2 template_filter decorator in flask application

I have a filters.py file in my flask application and its content is: # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals, print_function import arrow from fresque import APP @APP.template_filter('short') def…
Rahul
  • 2,056
  • 1
  • 21
  • 37
2
votes
1 answer

How to print the contents of a pygit object in python

I am trying to print the "diff" object as shown below. I am expecting an output similar to git show , but I am not getting the same. How do I achieve this? Thanks. import…
Zack
  • 2,078
  • 10
  • 33
  • 58
2
votes
1 answer

pulling and integrating remote changes with pygit2

I do have the following problem. I'm writing a script which searches a folder for repositories, looks up the remotes on the net and pulls all new data into the repository, notifying me about new changes. The main idea is clear. I'm using python 2.7…
Toni Barth
  • 53
  • 9
2
votes
0 answers

Sublime Text 2/3 - How to embed python module (pygit2) with cross-platform (debian & windows) support

I want to use pygit2's libgit2 bindings inside a Sublime Text plugin. Q: Is it possible to embed a functional version of pygit2 and libgit2 that ST can import for both Windows 32bit/64bit and Debian 32bit/64bit? Q: Is a python virtualenv something I…
ThorSummoner
  • 16,657
  • 15
  • 135
  • 147
2
votes
0 answers

Pygit2: How to unstage a file?

In pygit2, if I stage the adding or removing of a file, how can I unstage them like I'd do with git reset? I need to use pygit2 to accomplish the following git actions: git reset HEAD git checkout . I can checkout with repo =…
pistacchio
  • 56,889
  • 107
  • 278
  • 420