diff options
-rw-r--r-- | git/db/py/base.py | 15 | ||||
-rw-r--r-- | git/db/py/complex.py | 4 | ||||
-rw-r--r-- | git/db/py/ref.py | 4 |
3 files changed, 11 insertions, 12 deletions
diff --git a/git/db/py/base.py b/git/db/py/base.py index 4d9b6e14..a2c9a4ef 100644 --- a/git/db/py/base.py +++ b/git/db/py/base.py @@ -96,8 +96,9 @@ class PureObjectDBW(ObjectDBW): class PureRootPathDB(RootPathDB): def __init__(self, root_path): - super(PureRootPathDB, self).__init__(root_path) self._root_path = root_path + super(PureRootPathDB, self).__init__(root_path) + #{ Interface @@ -127,8 +128,8 @@ class PureCompoundDB(CompoundDB, PureObjectDBR, LazyMixin, CachingDB): def _set_cache_(self, attr): if attr == '_dbs': self._dbs = list() - elif attr == '_db_cache': - self._db_cache = dict() + elif attr == '_obj_cache': + self._obj_cache = dict() else: super(PureCompoundDB, self)._set_cache_(attr) @@ -138,14 +139,14 @@ class PureCompoundDB(CompoundDB, PureObjectDBR, LazyMixin, CachingDB): # most databases use binary representations, prevent converting # it everytime a database is being queried try: - return self._db_cache[sha] + return self._obj_cache[sha] except KeyError: pass # END first level cache for db in self._dbs: if db.has_object(sha): - self._db_cache[sha] = db + self._obj_cache[sha] = db return db # END for each database raise BadObject(sha) @@ -181,7 +182,7 @@ class PureCompoundDB(CompoundDB, PureObjectDBR, LazyMixin, CachingDB): def update_cache(self, force=False): # something might have changed, clear everything - self._db_cache.clear() + self._obj_cache.clear() stat = False for db in self._dbs: if isinstance(db, CachingDB): @@ -191,8 +192,6 @@ class PureCompoundDB(CompoundDB, PureObjectDBR, LazyMixin, CachingDB): return stat def partial_to_complete_sha_hex(self, partial_hexsha): - databases = self.databases() - len_partial_hexsha = len(partial_hexsha) if len_partial_hexsha % 2 != 0: partial_binsha = hex_to_bin(partial_hexsha + "0") diff --git a/git/db/py/complex.py b/git/db/py/complex.py index a51118b3..d5c185f3 100644 --- a/git/db/py/complex.py +++ b/git/db/py/complex.py @@ -38,7 +38,7 @@ import os __all__ = ('PureGitODB', 'PurePartialGitDB', 'PureCompatibilityGitDB') -class PureGitODB(PureRootPathDB, PureObjectDBW, PureCompoundDB): +class PureGitODB(PureRootPathDB, PureObjectDBW, PureCompoundDB, PureAlternatesFileMixin): """A git-style object-only database, which contains all objects in the 'objects' subdirectory. :note: The type needs to be initialized on the ./objects directory to function, @@ -105,7 +105,7 @@ class PureGitODB(PureRootPathDB, PureObjectDBW, PureCompoundDB): class PurePartialGitDB(PureGitODB, PureRepositoryPathsMixin, PureConfigurationMixin, - PureReferencesMixin, PureSubmoduleDB, PureAlternatesFileMixin, + PureReferencesMixin, PureSubmoduleDB, PureIndexDB, PureTransportDB # HighLevelRepository Currently not implemented ! ): diff --git a/git/db/py/ref.py b/git/db/py/ref.py index 94887fb8..d2c77a3a 100644 --- a/git/db/py/ref.py +++ b/git/db/py/ref.py @@ -31,8 +31,8 @@ class PureReferenceDB(PureCompoundDB): dbcls = self.ObjectDBCls if dbcls is None: # late import - from complex import PureGitODB # TODO: This should be a configurable for flexibility - dbcls = PureGitODB + import complex + dbcls = complex.PureGitODB # END get db type # try to get as many as possible, don't fail if some are unavailable |