#141 Compatibility with GitPython >= 2
Closed: Fixed 8 years ago Opened 8 years ago by lsedlar.

There is a Bugzilla request to provide newer version of GitPython in Fedora.

According to the changelog, there are backwards incompatible changes in the 2.0.0 release. Most important one is that Python 2.6 is no longer supported. The other incompatible change listed is difference in how diffs are handled, which should not affect rpkg as far as I can tell.

We should test the newer version and try to find out if there are any problems.


Unfortunately, GitPython >= 2 cannot work with Python 2.6 at all, even occasionally.

(rpkg-env)[root@cc7a147e5dc1 ~]# rpkg
Traceback (most recent call last):
  File "/root/rpkg-env/bin/rpkg", line 8, in <module>
    execfile(__file__)
  File "/root/code/rpkg/bin/rpkg", line 13, in <module>
    import pyrpkg
  File "/root/code/rpkg/pyrpkg/__init__.py", line 14, in <module>
    import git
  File "/root/rpkg-env/lib/python2.6/site-packages/git/__init__.py", line 38, in <module>
    from git.config import GitConfigParser  # @NoMove @IgnorePep8
  File "/root/rpkg-env/lib/python2.6/site-packages/git/config.py", line 25, in <module>
    from git.util import LockFile
  File "/root/rpkg-env/lib/python2.6/site-packages/git/util.py", line 18, in <module>
    from unittest.case import SkipTest
ImportError: No module named case

I'm thinking of the possibility of dropping GitPython and maintain rpkg's own module to get information from package repository.

Following are the lines calling GitPython API, all of them can be easily covnerted into git command running in a subprocess obviously.

./__init__.py:359:                merge = self.repo.git.config('--get', 'branch.%s.merge' % localbranch)
./__init__.py:379:            remote = self.repo.git.config('--get', 'branch.%s.remote'
./__init__.py:399:            url = self.repo.git.remote('get-url', '--push', self.branch_remote)
./__init__.py:402:                url = self.repo.git.config(
./__init__.py:406:                    url = self.repo.git.config(
./__init__.py:995:            self.repo.git.fetch(remote)
./__init__.py:1479:        ourfiles = self.repo.git.ls_files().split('\n')
./__init__.py:1551:            tag = self.repo.git.describe('--tags', '--abbrev=0')
./__init__.py:1556:        return self.repo.git.diff('-M', tag)
./__init__.py:1737:                self.log.info(self.repo.git.checkout('-b', branch, '--track', totrack))
./__init__.py:1744:                self.repo.git.checkout(branch)
./__init__.py:1767:            remote = self.repo.git.config('--get', 'branch.%s.remote' % branch)
./__init__.py:1768:            merge = self.repo.git.config('--get', 'branch.%s.merge' % branch).replace('refs/heads',
./__init__.py:1770:            if self.repo.git.rev_list('%s...%s' % (merge, branch)):
./__init__.py:2389:        files = self.repo.git.ls_files('--exclude-standard').split()

Make sense?

Ran tests with GitPython 2.1.0 in Fedora, all passed, based on current coverage.

So far, upgrading GitPython to 2.x should not be a big issue to rpkg and fedpkg. I'm going to close this issue. Depending on the concrete version of GitPython 2.x, if there will be issues introduced, then fix it.

@cqi changed the status to Closed

8 years ago

Log in to comment on this ticket.

Metadata