summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-07-09 12:18:38 +0200
committerSebastian Thiel <byronimo@gmail.com>2010-07-09 12:18:38 +0200
commit08457a7a6b6ad4f518fad0d5bca094a2b5b38fbe (patch)
treeff129ad199b7e069cb3cef0fcf34353717befa60
parent3288a244428751208394d8137437878277ceb71f (diff)
downloadgitpython-08457a7a6b6ad4f518fad0d5bca094a2b5b38fbe.tar.gz
Added python 2.4 support: Repo will now use the original GitCmdObjectDB in python 2.4, as the pure python implementation cannot work without memory maps
-rw-r--r--lib/git/__init__.py1
-rw-r--r--lib/git/db.py8
m---------lib/git/ext/gitdb0
-rw-r--r--lib/git/repo/base.py7
-rw-r--r--test/git/test_repo.py7
5 files changed, 18 insertions, 5 deletions
diff --git a/lib/git/__init__.py b/lib/git/__init__.py
index 5ebeaa7d..7f275b44 100644
--- a/lib/git/__init__.py
+++ b/lib/git/__init__.py
@@ -29,6 +29,7 @@ from git.objects import *
from git.refs import *
from git.diff import *
from git.exc import *
+from git.db import *
from git.cmd import Git
from git.repo import Repo
from git.remote import *
diff --git a/lib/git/db.py b/lib/git/db.py
index 6339569f..b1c65377 100644
--- a/lib/git/db.py
+++ b/lib/git/db.py
@@ -34,13 +34,13 @@ class GitCmdObjectDB(LooseObjectDB):
self._git = git
def info(self, sha):
- t = self._git.get_object_header(bin_to_hex(sha))
- return OInfo(*t)
+ hexsha, typename, size = self._git.get_object_header(bin_to_hex(sha))
+ return OInfo(hex_to_bin(hexsha), typename, size)
def stream(self, sha):
"""For now, all lookup is done by git itself"""
- t = self._git.stream_object_data(bin_to_hex(sha))
- return OStream(*t)
+ hexsha, typename, size, stream = self._git.stream_object_data(bin_to_hex(sha))
+ return OStream(hex_to_bin(hexsha), typename, size, stream)
# { Interface
diff --git a/lib/git/ext/gitdb b/lib/git/ext/gitdb
-Subproject f534e6e9a24f2ac7e7e0f3679551b512d4af569
+Subproject 18152febd428e67b86bb4fb68ec1691d4de75a9
diff --git a/lib/git/repo/base.py b/lib/git/repo/base.py
index d45dd713..4456b1e9 100644
--- a/lib/git/repo/base.py
+++ b/lib/git/repo/base.py
@@ -34,6 +34,11 @@ import os
import sys
import re
+DefaultDBType = GitDB
+if sys.version_info[1] < 5: # python 2.4 compatiblity
+ DefaultDBType = GitCmdObjectDB
+# END handle python 2.4
+
__all__ = ('Repo', )
@@ -66,7 +71,7 @@ class Repo(object):
# represents the configuration level of a configuration file
config_level = ("system", "global", "repository")
- def __init__(self, path=None, odbt = GitDB):
+ def __init__(self, path=None, odbt = DefaultDBType):
"""Create a new Repo instance
:param path: is the path to either the root git directory or the bare git repo::
diff --git a/test/git/test_repo.py b/test/git/test_repo.py
index 88d8c8c1..65dce590 100644
--- a/test/git/test_repo.py
+++ b/test/git/test_repo.py
@@ -545,3 +545,10 @@ class TestRepo(TestBase):
# cannot handle rev-log for now
self.failUnlessRaises(ValueError, rev_parse, "hi@there")
+
+ def test_repo_odbtype(self):
+ target_type = GitDB
+ if sys.version_info[1] < 5:
+ target_type = GitCmdObjectDB
+ assert isinstance(self.rorepo.odb, target_type)
+