From 112bb1672d6b28f203e7839e320b985486636800 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 30 May 2011 01:23:28 +0200 Subject: Finished moving all repository methods to the respective interfaces and implementations. It seems theoretically work together now, although it clearly is much more complex than ever before. The repo package was slimmed down to being a module once again, which is only there for compatability actually --- git/db/complex.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 git/db/complex.py (limited to 'git/db/complex.py') diff --git a/git/db/complex.py b/git/db/complex.py new file mode 100644 index 00000000..dc85a595 --- /dev/null +++ b/git/db/complex.py @@ -0,0 +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 + +__all__ = ['CmdGitDB', 'PureGitDB', 'PureCmdGitDB'] + +class PureCmdGitDB(PureGitDB, CmdGitDB, RepoCompatInterface): + """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.""" -- cgit v1.2.3 From 024adf37acddd6a5d8293b6b5d15795c59a142c0 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 30 May 2011 13:06:37 +0200 Subject: 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 --- git/db/complex.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'git/db/complex.py') 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.""" -- cgit v1.2.3 From 1f71ed94578799ee1667ba54b66a369e307f415b Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 30 May 2011 16:32:56 +0200 Subject: git cmd implementation of repository appears to work, at least this is what the test suggests. Pure python implementation still has some trouble, but this should be very fixable --- git/db/complex.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'git/db/complex.py') diff --git a/git/db/complex.py b/git/db/complex.py index ef2013e3..71a39c45 100644 --- a/git/db/complex.py +++ b/git/db/complex.py @@ -1,12 +1,25 @@ """Module with many useful complex databases with different useful combinations of primary implementations""" -from py.complex import PureGitDB +from py.complex import PurePartialGitDB from cmd.complex import CmdPartialGitDB from compat import RepoCompatibilityInterface -__all__ = ['CmdPartialGitDB', 'PureGitDB', 'PureCmdGitDB'] +__all__ = ['CmdGitDB', 'PureGitDB', 'CmdCompatibilityGitDB', 'PureCompatibilityGitDB'] -class PureCmdGitDB(PureGitDB, CmdPartialGitDB, RepoCompatibilityInterface): +class CmdGitDB(CmdPartialGitDB, PurePartialGitDB): + """A database which uses primarily the git command implementation, but falls back + to pure python where it is more feasible""" + +class CmdCompatibilityGitDB(RepoCompatibilityInterface, CmdGitDB): + """A database which fills in its missing implementation using the pure python + implementation""" + pass + +class PureGitDB(PurePartialGitDB, CmdPartialGitDB): + """A repository which uses the pure implementation primarily, but falls back + on using the git command for high-level functionality""" + +class PureCompatibilityGitDB(RepoCompatibilityInterface, PureGitDB): """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.""" -- cgit v1.2.3 From a5497c432fe8ab1415d633d5d4b68f00a2807c26 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 6 Jun 2011 20:29:03 +0200 Subject: Streams returned by git cmd db are now containing all the data right away. This could cause several copies to exist, and makes the cmd implementation a bad choice if big files are involved --- git/db/complex.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'git/db/complex.py') diff --git a/git/db/complex.py b/git/db/complex.py index 71a39c45..31b047a0 100644 --- a/git/db/complex.py +++ b/git/db/complex.py @@ -8,7 +8,10 @@ __all__ = ['CmdGitDB', 'PureGitDB', 'CmdCompatibilityGitDB', 'PureCompatibilityG class CmdGitDB(CmdPartialGitDB, PurePartialGitDB): """A database which uses primarily the git command implementation, but falls back - to pure python where it is more feasible""" + to pure python where it is more feasible + :note: To assure consistent behaviour across implementations, when calling the + ``stream()`` method a cache is created. This makes this implementation a bad + choice when reading big files as these are streamed from memory in all cases.""" class CmdCompatibilityGitDB(RepoCompatibilityInterface, CmdGitDB): """A database which fills in its missing implementation using the pure python -- cgit v1.2.3