Questions tagged [gitpython]

GitPython is a python library used to interact with Git repositories

GitPython is a python library used to interact with Git repositories, providing object model access.

495 questions
0
votes
1 answer

Can't import on Windows/Anaconda

Windows 10, Anaconda 2 or 3 c:\leo.repo\leo-editor>c:\apps\Git\bin\git.exe --version yields: git version 2.8.2.windows.1 sys.path contains C:\apps\Git, C:\apps\Git\bin and C:\apps\Git\cmd, but I am getting the dreaded GitCommandNotFound exception. …
Edward K. Ream
  • 179
  • 1
  • 8
0
votes
1 answer

Why does this error message display each time I try to import git

I am new to GitPython. I try to import git after installing gitpython successfully, import git but it returns this error message : /data/data/org.qpython.qpy3/files/bin/qpython.sh "/storage/sdcard0/qpython/scripts/.last_tmp.py" &&…
Udonse
  • 51
  • 6
0
votes
1 answer

How to get list of staged files for commit ? (fullpaths)

I'm trying to get the list of files staged for the next commit. I want their fullpath based on the repository's base directory. How do I do that in python, with or even better, without the gitpython module ? I have a starter : repo =…
ypicard
  • 3,593
  • 3
  • 20
  • 34
0
votes
0 answers

Get diff git commit objects in gitpython on git fetch or pull

How can i get updated commits from remote to local branch when we call git pull or git fetch? I need to know the list of commits that are updated on call of git.pull so that i will get to know the list of files that got changed ,author of the commit…
0
votes
1 answer

How to pull a certain branch from a upstream repository

Assume I have a local git clone called GitPython. I'm able to commit and push using gitpython: repo = Repo(D:\Dev\Gitpython) print(repo.git.add(".")) print(repo.git.commit(m='my commit message')) print(repo.git.push()) However, how can I pull from…
Fengeey
  • 3
  • 3
0
votes
1 answer

TypeError: unsupported operand type(s) for +: 'NoneType' and 'str' using GITPYTHON

I am using gitpython to do some file processing. Everything is working fine, except for the d.new_file condition where I encountered this type error where i can't concatenate NoneType and str together. I think that d.a_path is None, but I cannot…
decemberrobot
  • 451
  • 2
  • 9
  • 20
0
votes
1 answer

Not able to commit file to git using gitpython library

I have a local git repository. I have a python file in it called 'fibo.py'. I edited that file in editor and saved the changes. Then I wrote following code to commit that file to repo. from git import Repo import os repo_dir = 'D:\\Git…
Sam
  • 736
  • 5
  • 15
  • 27
0
votes
1 answer

GitPython `repo.index.commit()` spawns persistent git.exe instance, holds handles to repo

I am trying to use GitPython for some repo manipulation, but ran into issues with my app, with handles open where i wouldn't expect. Bug-jarring the issue, it seems that calling repo.index.commit() results in a handle to the directory (presumably…
some bits flipped
  • 2,592
  • 4
  • 27
  • 42
0
votes
1 answer

Getting the time when the file was committed on Github

I want to somehow want to see if there is a way to get the time for when a file was committed on Github. I have tried using PyGithub and GitPython, but they don't have any options as such. Does anyone know a way around this?
Harshdeep Singh
  • 327
  • 1
  • 5
  • 18
0
votes
1 answer

GitPython "blame" does not give me all changed lines

I am using GitPython. Below I print the total number of lines changed in a specific commit: f092795fe94ba727f7368b63d8eb1ecd39749fc4: from git import Repo repo = Repo("C:/Users/shiro/Desktop/lucene-solr/") sum_lines = 0 for blame_commit,…
dimitris93
  • 4,155
  • 11
  • 50
  • 86
0
votes
1 answer

GitPython log() Error

I have a problem with the method log() repo = git.Repo(repo_path) branch = repo.head log = branch.log() print log Error: Traceback (most recent call last): File "gitpython.py", line 29, in
benj
  • 23
  • 1
  • 6
0
votes
0 answers

Find bugs of Lucene through Jira python API

I am using Python with GitPython to read various commits of the Lucene project. Those commits contain messages like LUCENE-4797: enable doclint html verification git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1658040…
dimitris93
  • 4,155
  • 11
  • 50
  • 86
0
votes
1 answer

Serve repository using git daemon with GitPython

I'm trying to initialize a git repo and then serve it using the git daemon. Everything with GitPython. Initializing the repo works: temp_dir = '/tmp/something' repo = git.Repo.init(temp_dir) Starting the daemon as well: gd = Git().daemon(temp_dir,…
0
votes
2 answers

Can a bare repository have an index? Is this a bug?

I'm trying to get GitPython 0.3 to commit a file to a repository. Roughly, I'm doing this as follows: data = ... istream = repo.odb.store(gitdb.IStream(git.Blob.type, len(data), StringIO(data))) entry = git.BaseIndexEntry((stat.S_IFREG | 0644,…
Thomas
  • 174,939
  • 50
  • 355
  • 478
0
votes
1 answer

Use bare repo with git-python

When I'm trying to add files to bare repo: import git r = git.Repo("./bare-repo") r.working_dir("/tmp/f") print(r.bare) # True r.index.add(["/tmp/f/foo"]) # Exception, can't use bare repo <...> I only understood that I can add files only by…
mikroskeem
  • 37
  • 1
  • 9