summaryrefslogtreecommitdiff
path: root/git/db/cmd/complex.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2011-05-29 21:59:12 +0200
committerSebastian Thiel <byronimo@gmail.com>2011-05-29 21:59:12 +0200
commit0996049122842a343e0ea7fbbecafddb2b4ba9d3 (patch)
treecaf5682e79d1317cd29d9bbab965cf932a1b67ff /git/db/cmd/complex.py
parentcd26aaebbda94dc3740e41bbd3f91ba6b1a25c10 (diff)
downloadgitpython-0996049122842a343e0ea7fbbecafddb2b4ba9d3.tar.gz
Intermediate commit with quite some progress in order to put all extra methods on the default Repo implementation into interfaces or something that can be abstracted. It shows that it would indeed be good to keep the differentiation between Repositories which contain an object database as it is clearly easier to setup any combination of repositories that use git and those that do not, with just the addition of one more level of indirection. Lets see how it will end up
Diffstat (limited to 'git/db/cmd/complex.py')
-rw-r--r--git/db/cmd/complex.py25
1 files changed, 20 insertions, 5 deletions
diff --git a/git/db/cmd/complex.py b/git/db/cmd/complex.py
index 73e2048f..2eed17ad 100644
--- a/git/db/cmd/complex.py
+++ b/git/db/cmd/complex.py
@@ -14,8 +14,13 @@ from git.util import (
hex_to_bin
)
from git.db.py.loose import PureLooseObjectODB
+from git.db.compat import RepoCompatInterface
from git.util import RemoteProgress
-from git.db.py.base import TransportDB
+from git.db.py.base import (
+ TransportDB,
+ PureRepositoryPathsMixin,
+ PureAlternatesFileMixin
+ )
from git.db.interface import FetchInfo as GitdbFetchInfo
from git.db.interface import PushInfo as GitdbPushInfo
@@ -33,7 +38,7 @@ import re
import sys
-__all__ = ('CmdGitDB', 'RemoteProgress' )
+__all__ = ('CmdGitDB', 'RemoteProgress', 'CmdCompatibilityGitDB' )
class PushInfo(GitdbPushInfo):
@@ -266,7 +271,7 @@ class FetchInfo(GitdbFetchInfo):
return cls(remote_local_ref, flags, note, old_commit_binsha)
-class CmdGitDB(PureLooseObjectODB, TransportDB):
+class CmdGitDB(PureLooseObjectODB, TransportDB, PureRepositoryPathsMixin, PureAlternatesFileMixin):
"""A database representing the default git object store, which includes loose
objects, pack files and an alternates file
@@ -276,7 +281,8 @@ class CmdGitDB(PureLooseObjectODB, TransportDB):
"""
def __init__(self, root_path, git):
"""Initialize this instance with the root and a git command"""
- super(CmdGitDB, self).__init__(root_path)
+ self._initialize(root_path)
+ super(CmdGitDB, self).__init__(self.objects_dir)
self._git = git
@classmethod
@@ -373,7 +379,8 @@ class CmdGitDB(PureLooseObjectODB, TransportDB):
#{ ODB Interface
-
+ # overrides from PureOdb Implementation, which is responsible only for writing
+ # objects
def info(self, sha):
hexsha, typename, size = self._git.get_object_header(bin_to_hex(sha))
return OInfo(hex_to_bin(hexsha), typename, size)
@@ -399,6 +406,10 @@ class CmdGitDB(PureLooseObjectODB, TransportDB):
except (GitCommandError, ValueError):
raise BadObject(partial_hexsha)
# END handle exceptions
+
+ @property
+ def git(self):
+ return self._git
#} END interface
@@ -432,3 +443,7 @@ class CmdGitDB(PureLooseObjectODB, TransportDB):
return self._get_fetch_info_from_stderr(proc, progress or RemoteProgress())
#} end transport db interface
+
+
+class CmdCompatibilityGitDB(CmdGitDB, RepoCompatInterface):
+ """Command git database with the compatabilty interface added for 0.3x code"""