From e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 8 Jan 2015 12:19:56 +0100 Subject: Fixed PY3 support. Apparently, thanks to an incorrect version check, PY3 ended up using a git command object database by default. This is now fixed. Additionally, the update_cache code was adjusted to check for method-existence, as it's valid to use object databases which simply don't have a caching mechanism (like the git command object database) --- git/remote.py | 6 ++++-- git/repo/base.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/git/remote.py b/git/remote.py index 1500f3d1..746a7819 100644 --- a/git/remote.py +++ b/git/remote.py @@ -611,7 +611,8 @@ class Remote(LazyMixin, Iterable): proc = self.repo.git.fetch(self, *args, with_extended_output=True, as_process=True, v=True, **kwargs) res = self._get_fetch_info_from_stderr(proc, progress or RemoteProgress()) - self.repo.odb.update_cache() + if hasattr(self.repo.odb, 'update_cache'): + self.repo.odb.update_cache() return res def pull(self, refspec=None, progress=None, **kwargs): @@ -625,7 +626,8 @@ class Remote(LazyMixin, Iterable): kwargs = add_progress(kwargs, self.repo.git, progress) proc = self.repo.git.pull(self, refspec, with_extended_output=True, as_process=True, v=True, **kwargs) res = self._get_fetch_info_from_stderr(proc, progress or RemoteProgress()) - self.repo.odb.update_cache() + if hasattr(self.repo.odb, 'update_cache'): + self.repo.odb.update_cache() return res def push(self, refspec=None, progress=None, **kwargs): diff --git a/git/repo/base.py b/git/repo/base.py index 7bd2be48..a84f617d 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -59,7 +59,7 @@ import sys import re DefaultDBType = GitDB -if sys.version_info[1] < 5: # python 2.4 compatiblity +if sys.version_info[:2] < (2, 5): # python 2.4 compatiblity DefaultDBType = GitCmdObjectDB # END handle python 2.4 -- cgit v1.2.1