From cd26aaebbda94dc3740e41bbd3f91ba6b1a25c10 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 10 May 2011 10:21:26 +0200 Subject: Made repository paths methods a property to be compatible with the existing repo interface. Added submodule interface ... goal is to provide all of the extra repo functionality in custom interfaces --- git/db/compat.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 git/db/compat.py (limited to 'git/db/compat.py') diff --git a/git/db/compat.py b/git/db/compat.py new file mode 100644 index 00000000..1c0ba6f5 --- /dev/null +++ b/git/db/compat.py @@ -0,0 +1,13 @@ +# 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 +"""Module providing adaptors to maintain backwards compatability""" + +class RepoCompatInterface(object): + """Interface to install backwards compatability of the new complex repository + types with the previous, all in one, repository.""" + + @property + def bare(self): + return self.is_bare -- cgit v1.2.3 From 0996049122842a343e0ea7fbbecafddb2b4ba9d3 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 29 May 2011 21:59:12 +0200 Subject: 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 --- git/db/compat.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'git/db/compat.py') diff --git a/git/db/compat.py b/git/db/compat.py index 1c0ba6f5..16bf0562 100644 --- a/git/db/compat.py +++ b/git/db/compat.py @@ -11,3 +11,20 @@ class RepoCompatInterface(object): @property def bare(self): return self.is_bare + + def rev_parse(self, *args, **kwargs): + return self.resolve_object(*args, **kwargs) + + @property + def odb(self): + """The odb is now an integrated part of each repository""" + return self + + @property + def active_branch(self): + """The name of the currently active branch. + + :return: Head to the active branch""" + return self.head.reference + + -- cgit v1.2.3 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/compat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'git/db/compat.py') diff --git a/git/db/compat.py b/git/db/compat.py index 16bf0562..b0c042a5 100644 --- a/git/db/compat.py +++ b/git/db/compat.py @@ -27,4 +27,5 @@ class RepoCompatInterface(object): :return: Head to the active branch""" return self.head.reference - + def __repr__(self): + return '' % self.git_dir -- 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/compat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git/db/compat.py') 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.""" -- cgit v1.2.3