diff options
| author | Sebastian Thiel <byronimo@gmail.com> | 2011-05-30 13:06:37 +0200 |
|---|---|---|
| committer | Sebastian Thiel <byronimo@gmail.com> | 2011-05-30 13:06:37 +0200 |
| commit | 024adf37acddd6a5d8293b6b5d15795c59a142c0 (patch) | |
| tree | 3610b99168f984acb0eefe3a995295f4d3b1d096 /git/db | |
| parent | 112bb1672d6b28f203e7839e320b985486636800 (diff) | |
| download | GitPython-024adf37acddd6a5d8293b6b5d15795c59a142c0.tar.gz GitPython-024adf37acddd6a5d8293b6b5d15795c59a142c0.zip | |
Fixed tests far enough to allow basic repository tests to be applied to any of the new database types. This reduces code duplication to the mere minimum, but allows custom tests to be added on top easily and flexibly
Diffstat (limited to 'git/db')
| -rw-r--r-- | git/db/cmd/__init__.py | 6 | ||||
| -rw-r--r-- | git/db/cmd/base.py | 2 | ||||
| -rw-r--r-- | git/db/cmd/complex.py | 20 | ||||
| -rw-r--r-- | git/db/compat.py | 2 | ||||
| -rw-r--r-- | git/db/complex.py | 8 | ||||
| -rw-r--r-- | git/db/py/__init__.py | 2 | ||||
| -rw-r--r-- | git/db/py/complex.py | 4 | ||||
| -rw-r--r-- | git/db/py/resolve.py | 13 |
8 files changed, 37 insertions, 20 deletions
diff --git a/git/db/cmd/__init__.py b/git/db/cmd/__init__.py index 968d8c11..8a681e42 100644 --- a/git/db/cmd/__init__.py +++ b/git/db/cmd/__init__.py @@ -1,2 +1,4 @@ - -from complex import * +# Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors +# +# This module is part of GitDB and is released under +# the New BSD License: http://www.opensource.org/licenses/bsd-license.php diff --git a/git/db/cmd/base.py b/git/db/cmd/base.py index 0025e9b0..6a2473a3 100644 --- a/git/db/cmd/base.py +++ b/git/db/cmd/base.py @@ -15,7 +15,7 @@ from git.util import ( bin_to_hex, hex_to_bin ) -from git.db.compat import RepoCompatInterface +from git.db.compat import RepoCompatibilityInterface from git.util import RemoteProgress from git.db.interface import FetchInfo as GitdbFetchInfo from git.db.interface import PushInfo as GitdbPushInfo diff --git a/git/db/cmd/complex.py b/git/db/cmd/complex.py index 9c26a8fa..3e6804f5 100644 --- a/git/db/cmd/complex.py +++ b/git/db/cmd/complex.py @@ -1,17 +1,27 @@ """Module with our own git implementation - it uses the git command""" -from git.db.compat import RepoCompatInterface +from git.db.compat import RepoCompatibilityInterface from git.db.py.complex import PureGitDB from base import * -__all__ = ['GitCmdDB', 'CmdCompatibilityGitDB'] +__all__ = ['GitCmdDB', 'CmdCompatibilityGitDB', 'CmdPartialGitDB'] -class CmdGitDB( GitCommandMixin, CmdObjectDBRMixin, CmdTransportMixin, - CmdHighLevelRepository, PureGitDB): +class CmdPartialGitDB( GitCommandMixin, CmdObjectDBRMixin, CmdTransportMixin, + CmdHighLevelRepository ): + """Utility repository which only partially implements all required methods. + It cannot be reliably used alone, but is provided to allow mixing it with other + implementations""" pass -class CmdCompatibilityGitDB(CmdGitDB, RepoCompatInterface): + +class CmdGitDB(CmdPartialGitDB, PureGitDB): + """A database which fills in its missing implementation using the pure python + implementation""" + pass + + +class CmdCompatibilityGitDB(CmdGitDB, RepoCompatibilityInterface): """Command git database with the compatabilty interface added for 0.3x code""" diff --git a/git/db/compat.py b/git/db/compat.py index b0c042a5..767ab5e0 100644 --- a/git/db/compat.py +++ b/git/db/compat.py @@ -4,7 +4,7 @@ # the New BSD License: http://www.opensource.org/licenses/bsd-license.php """Module providing adaptors to maintain backwards compatability""" -class RepoCompatInterface(object): +class RepoCompatibilityInterface(object): """Interface to install backwards compatability of the new complex repository types with the previous, all in one, repository.""" diff --git a/git/db/complex.py b/git/db/complex.py index dc85a595..ef2013e3 100644 --- a/git/db/complex.py +++ b/git/db/complex.py @@ -1,12 +1,12 @@ """Module with many useful complex databases with different useful combinations of primary implementations""" from py.complex import PureGitDB -from cmd.complex import CmdGitDB -from compat import RepoCompatInterface +from cmd.complex import CmdPartialGitDB +from compat import RepoCompatibilityInterface -__all__ = ['CmdGitDB', 'PureGitDB', 'PureCmdGitDB'] +__all__ = ['CmdPartialGitDB', 'PureGitDB', 'PureCmdGitDB'] -class PureCmdGitDB(PureGitDB, CmdGitDB, RepoCompatInterface): +class PureCmdGitDB(PureGitDB, CmdPartialGitDB, RepoCompatibilityInterface): """Repository which uses the pure implementation primarily, but falls back to the git command implementation. Please note that the CmdGitDB does it the opposite way around.""" diff --git a/git/db/py/__init__.py b/git/db/py/__init__.py index 73cc2bdf..8a681e42 100644 --- a/git/db/py/__init__.py +++ b/git/db/py/__init__.py @@ -2,5 +2,3 @@ # # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php - -from complex import * diff --git a/git/db/py/complex.py b/git/db/py/complex.py index efcbb2ba..9d891537 100644 --- a/git/db/py/complex.py +++ b/git/db/py/complex.py @@ -20,7 +20,7 @@ from pack import PurePackedODB from ref import PureReferenceDB from submodule import PureSubmoduleDB -from git.db.compat import RepoCompatInterface +from git.db.compat import RepoCompatibilityInterface from git.util import ( LazyMixin, @@ -123,6 +123,6 @@ class PureGitDB(PureGitODB, -class PureCompatibilityGitDB(PureGitDB, RepoCompatInterface): +class PureCompatibilityGitDB(PureGitDB, RepoCompatibilityInterface): """Pure git database with a compatability layer required by 0.3x code""" diff --git a/git/db/py/resolve.py b/git/db/py/resolve.py index d0685747..7194149c 100644 --- a/git/db/py/resolve.py +++ b/git/db/py/resolve.py @@ -3,12 +3,19 @@ version assuming compatible interface for reference and object types""" from git.db.interface import ReferencesMixin from git.exc import BadObject -from git.refs import SymbolicReference -from git.objects.base import Object -from git.objects.commit import Commit +from git.refs import ( + SymbolicReference, + Reference, + HEAD, + Head, + TagReference + ) from git.refs.head import HEAD from git.refs.headref import Head from git.refs.tag import TagReference + +from git.objects.base import Object +from git.objects.commit import Commit from git.util import ( join, isdir, |
