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
1
vote
1 answer

Getting full indexes of a patch using libgit2 / git2go

git2go's git.Patch or libgit2's git_patch returns a String value of the following format: "diff": "diff --git a/test b/test index 9daeafb..dced80a 100644 --- a/test +++ b/test @@ -1 +1,3 @@ test …
1
vote
1 answer

Error while installing pygit2

I have to install pygit2 library on my ubuntu machine. I get the below error when I try "pip install pygit2". cffi.ffiplatform.VerificationError: CompileError: command 'x86_64-linux-gnu-gcc' failed with exit status 1 Cleaning up... Command python…
Zack
  • 2,078
  • 10
  • 33
  • 58
1
vote
1 answer

Does Repository.walk traverse all commits

In pygit2, Repository.walk can be used to traverse commits starting from a commit. However the docs do not explictly say whether all commits in the repository will be traversed, including dangling commits, or just the parents and children of the…
simonzack
  • 19,729
  • 13
  • 73
  • 118
1
vote
1 answer

Git porcelain commands via pygit2?

Pygit2 is a set of Python bindings to the libgit2 shared library, which implements the Git core methods. Unfortunately, it only seems to provide an API towards plumbing commands. Is there any python library built on the top of pygit2 which provides…
Roberto Aloi
  • 30,570
  • 21
  • 75
  • 112
1
vote
1 answer

Pygit2 - Merging a branch with no fast forward

I am essentially trying to do a "git merge --no-ff branch" to merge my branch back in. Looking at the Pygit2 documentation, I am not entierly sure what the correct way to do this is. The direct thought would be to do something like…
Stephen Lu
  • 314
  • 1
  • 9
1
vote
1 answer

Steps for pulling from remote using pygit2

While using the pygit2 library a simple repo.fetch() fetches all the diffs. The answer here describes the steps viz 1. Remote.fetch() 2. Repository.create_reference() or Reference.target= 3. Repository.checkout_head() I am not sure about what is…
avck
  • 3,535
  • 3
  • 26
  • 38
1
vote
1 answer

Unable to ssh push in pygit2

I am trying to push using ssh to a github repo using pygit2. Here is the error I keep getting. Can you point out the error? >>> sshcred = repo_.pygit2.credentials.Keypair('avckp','id_rsa.pub','id_rsa','') >>> remo2.credentials=sshcred ## remo2 is a…
avck
  • 3,535
  • 3
  • 26
  • 38
1
vote
1 answer

Staging an individual hunk using PyGit2

I'm trying to implement git add -p in pygit2, so I can make an alternative frontend to it. So I need to be able to stage individual hunks, first and foremost. I'm able to find the hunks by using diff_to_workdir from the index, like…
zdsmith
  • 13
  • 3
1
vote
1 answer

How to make a git merge by pygit2

I try to merge branch into master: repo = pygit2.Repository("/path/to/repo/") branch = repo.lookup_branch("upstream/branch", pygit2.GIT_BRANCH_REMOTE) oid = branch.target merge_result = repo.merge(oid) And merge_result contains ff oid (as in…
1
vote
2 answers

PyGit2 - TreeBuilder.insert('name',blobid,GIT_FILEMODE_BLOB) vs index.add( 'path/to/file' )?

I'm a little confused about how to get started with PyGit2. When adding files (plural) to a newly created repo, should I add them to index.add('path/to/file') or would I be better off creating a TreeBuilder and using tb.insert( 'name',oid,…
RSAdmin
  • 419
  • 1
  • 6
  • 20
1
vote
1 answer

How to install libgit2/pygit2 into virtualenv? (Ubuntu)

I have tried dulwich, and GitPython - neither of which seem mature. Now I am trying to install libgit2/pygit2. I have successfully installed them into the host packages environment, but now I need to get them installed in the virtualenv of the app…
RSAdmin
  • 419
  • 1
  • 6
  • 20
1
vote
1 answer

How do I set ssh credentials for libgit2/libssh2?

I am attempting to push references from within pygit2/libgit2: push_refspec = git_repo.lookup_reference('HEAD').resolve().name logger.info("Pushing " + push_refspec) git_remote.push(push_refspec) However, I get an error about missing…
David Greene
  • 394
  • 2
  • 12
0
votes
0 answers

Using Python and pygit2 to checkout / switch to a new branch

I'm writing some helper code in Python to automate the creation of feature and hotfix branches. I'm currently using GitPython to call the git binary directly, using commands like local_repo.git.checkout(branch_name). This works, but there's a new…
acjca2
  • 152
  • 8
0
votes
0 answers

pygit2 Slow performance on Diff Patch iteration and no cache on DiffStats

It seems, pygit2 is not caching Patch and DiffStats attributes from a Diff object. Each access to these attributes re-triggers the git stats calculation. Is there a way to optimize this operation and possibly cache the stats numbers? I compared the…
0
votes
1 answer

How to remove a specific commit using pygit2?

I'm stuck trying to implement a method with pygit2 that removes a given commit. With plain git, I could do something like: git rebase --onto SHA^ SHA but there is no such method in the library. According to pygit2 documentation, merge_trees can be…