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/repo.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 git/repo.py (limited to 'git/repo.py') diff --git a/git/repo.py b/git/repo.py new file mode 100644 index 00000000..178947c8 --- /dev/null +++ b/git/repo.py @@ -0,0 +1,45 @@ +# repo.py +# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# +# This module is part of GitPython and is released under +# the BSD License: http://www.opensource.org/licenses/bsd-license.php +"""This module is just to maintain compatibility to git-python 0.3x""" + +from git.db.cmd import CmdCompatibilityGitDB + + +import warnings + +__all__ = ('Repo', ) + + +class Repo(CmdCompatibilityGitDB): + """Represents a git repository and allows you to query references, + gather commit information, generate diffs, create and clone repositories query + the log. + + The following attributes are worth using: + + 'working_dir' is the working directory of the git command, wich is the working tree + directory if available or the .git directory in case of bare repositories + + 'working_tree_dir' is the working tree directory, but will raise AssertionError + if we are a bare repository. + + 'git_dir' is the .git repository directoy, which is always set.""" + + def __init__(self, path=None, odbt = None): + """Create a new Repo instance + + :param path: is the path to either the root git directory or the bare git repo:: + + repo = Repo("/Users/mtrier/Development/git-python") + repo = Repo("/Users/mtrier/Development/git-python.git") + repo = Repo("~/Development/git-python.git") + repo = Repo("$REPOSITORIES/Development/git-python.git") + :raise InvalidDBRoot: + :return: git.Repo """ + if odbt is not None: + warnings.warn("deprecated use of odbt", DeprecationWarning) + #END handle old parameter + super(Repo, self).__init__(path) -- 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/repo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git/repo.py') diff --git a/git/repo.py b/git/repo.py index 178947c8..8973dbd2 100644 --- a/git/repo.py +++ b/git/repo.py @@ -5,7 +5,7 @@ # the BSD License: http://www.opensource.org/licenses/bsd-license.php """This module is just to maintain compatibility to git-python 0.3x""" -from git.db.cmd import CmdCompatibilityGitDB +from git.db.cmd.complex import CmdCompatibilityGitDB import warnings -- 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/repo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git/repo.py') diff --git a/git/repo.py b/git/repo.py index 8973dbd2..8d5c4021 100644 --- a/git/repo.py +++ b/git/repo.py @@ -5,7 +5,7 @@ # the BSD License: http://www.opensource.org/licenses/bsd-license.php """This module is just to maintain compatibility to git-python 0.3x""" -from git.db.cmd.complex import CmdCompatibilityGitDB +from git.db.complex import CmdCompatibilityGitDB import warnings -- cgit v1.2.3