From b54b9399920375f0bab14ff8495c0ea3f5fa1c33 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 22 Jan 2015 12:40:07 +0100 Subject: Overhauled all tutorials, and placed them in a unit-test. That way they are protected from regression. Fixes #239 --- git/repo/base.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'git/repo/base.py') diff --git a/git/repo/base.py b/git/repo/base.py index ce8db7f7..61352a9a 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -103,17 +103,23 @@ class Repo(object): # represents the configuration level of a configuration file config_level = ("system", "user", "global", "repository") + # Subclass configuration + # Subclasses may easily bring in their own custom types by placing a constructor or type here + GitCommandWrapperType = Git + def __init__(self, path=None, odbt=DefaultDBType, search_parent_directories=False): """Create a new Repo instance - :param path: is the path to either the root git directory or the bare git repo:: + :param path: + 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") + 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") - :param odbt: Object DataBase type - a type which is constructed by providing + :param odbt: + Object DataBase type - a type which is constructed by providing the directory containing the database objects, i.e. .git/objects. It will be used to access all object data :raise InvalidGitRepositoryError: @@ -170,7 +176,7 @@ class Repo(object): # END working dir handling self.working_dir = self._working_tree_dir or self.git_dir - self.git = Git(self.working_dir) + self.git = self.GitCommandWrapperType(self.working_dir) # special handling, in special times args = [join(self.git_dir, 'objects')] -- cgit v1.2.1