summaryrefslogtreecommitdiff
path: root/git/db/py/complex.py
diff options
context:
space:
mode:
authorCraig Northway <craig.northway@gmail.com>2014-07-25 11:26:48 +1000
committerCraig Northway <craig.northway@gmail.com>2014-07-25 19:19:22 +1000
commita23d0d8617ba3119069e610fc7b0850a17322726 (patch)
treed8bc5213dd7e7c7f0befdf65afecb13d5435f873 /git/db/py/complex.py
parent75194159abce545bfa38c3172efb42da9b0017dc (diff)
downloadgitpython-a23d0d8617ba3119069e610fc7b0850a17322726.tar.gz
Autopep8 fixes with maximum line length 120
Diffstat (limited to 'git/db/py/complex.py')
-rw-r--r--git/db/py/complex.py78
1 files changed, 39 insertions, 39 deletions
diff --git a/git/db/py/complex.py b/git/db/py/complex.py
index 9d06f74a..1ef40ac2 100644
--- a/git/db/py/complex.py
+++ b/git/db/py/complex.py
@@ -4,14 +4,14 @@
# the New BSD License: http://www.opensource.org/licenses/bsd-license.php
from git.db.interface import HighLevelRepository
from base import (
- PureCompoundDB,
- PureObjectDBW,
- PureRootPathDB,
- PureRepositoryPathsMixin,
- PureConfigurationMixin,
- PureAlternatesFileMixin,
- PureIndexDB,
- )
+ PureCompoundDB,
+ PureObjectDBW,
+ PureRootPathDB,
+ PureRepositoryPathsMixin,
+ PureConfigurationMixin,
+ PureAlternatesFileMixin,
+ PureIndexDB,
+)
from transport import PureTransportDB
from resolve import PureReferencesMixin
@@ -29,6 +29,7 @@ __all__ = ('PureGitODB', 'PurePartialGitDB', 'PureCompatibilityGitDB')
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,
@@ -38,23 +39,22 @@ class PureGitODB(PureRootPathDB, PureObjectDBW, PureCompoundDB, PureAlternatesFi
PackDBCls = PurePackedODB
LooseDBCls = PureLooseObjectODB
PureReferenceDBCls = PureReferenceDB
-
+
# Directories
packs_dir = 'pack'
loose_dir = ''
-
-
+
def __init__(self, root_path):
"""Initialize ourselves on a git ./objects directory"""
super(PureGitODB, self).__init__(root_path)
-
+
def _set_cache_(self, attr):
if attr == '_dbs' or attr == '_loose_db':
self._dbs = list()
loose_db = None
- for subpath, dbcls in ((self.packs_dir, self.PackDBCls),
- (self.loose_dir, self.LooseDBCls),
- (self.alternates_filepath, self.PureReferenceDBCls)):
+ for subpath, dbcls in ((self.packs_dir, self.PackDBCls),
+ (self.loose_dir, self.LooseDBCls),
+ (self.alternates_filepath, self.PureReferenceDBCls)):
path = self.db_path(subpath)
if os.path.exists(path):
self._dbs.append(dbcls(path))
@@ -63,56 +63,56 @@ class PureGitODB(PureRootPathDB, PureObjectDBW, PureCompoundDB, PureAlternatesFi
# END remember loose db
# END check path exists
# END for each db type
-
+
# should have at least one subdb
if not self._dbs:
raise InvalidDBRoot(self.root_path())
# END handle error
-
+
# we the first one should have the store method
assert loose_db is not None and hasattr(loose_db, 'store'), "One database needs store functionality"
-
+
# finally set the value
self._loose_db = loose_db
else:
super(PureGitODB, self)._set_cache_(attr)
# END handle attrs
-
+
#{ PureObjectDBW interface
-
+
def store(self, istream):
return self._loose_db.store(istream)
-
+
def ostream(self):
return self._loose_db.ostream()
-
+
def set_ostream(self, ostream):
return self._loose_db.set_ostream(ostream)
-
+
#} END objectdbw interface
-
-
-
-class PurePartialGitDB(PureGitODB,
- PureRepositoryPathsMixin, PureConfigurationMixin,
- PureReferencesMixin, PureSubmoduleDB,
- PureIndexDB,
- PureTransportDB # not fully implemented
- # HighLevelRepository Currently not implemented !
- ):
+
+
+class PurePartialGitDB(PureGitODB,
+ PureRepositoryPathsMixin, PureConfigurationMixin,
+ PureReferencesMixin, PureSubmoduleDB,
+ PureIndexDB,
+ PureTransportDB # not fully implemented
+ # HighLevelRepository Currently not implemented !
+ ):
+
"""Git like database with support for object lookup as well as reference resolution.
Our rootpath is set to the actual .git directory (bare on unbare).
-
+
The root_path will be the git objects directory. Use git_path() to obtain the actual top-level
git directory."""
- #directories
-
+ # directories
+
def __init__(self, root_path):
"""Initialize ourselves on the .git directory, or the .git/objects directory."""
PureRepositoryPathsMixin._initialize(self, root_path)
super(PurePartialGitDB, self).__init__(self.objects_dir)
-
-
+
+
class PureCompatibilityGitDB(PurePartialGitDB, RepoCompatibilityInterface):
+
"""Pure git database with a compatability layer required by 0.3x code"""
-