diff options
-rw-r--r-- | README | 8 | ||||
-rw-r--r-- | lib/git_python/diff.py | 4 | ||||
-rw-r--r-- | lib/git_python/git.py | 11 | ||||
-rw-r--r-- | lib/git_python/repo.py | 2 | ||||
-rw-r--r-- | test/git/test_repo.py | 2 |
5 files changed, 20 insertions, 7 deletions
@@ -51,11 +51,11 @@ Initialize a Repo object The first step is to create a ``Repo`` object to represent your repository. >>> from git_python import * - >>> repo = Repo.new("/Users/mtrier/Development/git-python") + >>> repo = Repo("/Users/mtrier/Development/git-python") -In the above example, the directory ``/Users/mtrier/Development/git-python`` is my working -repo and contains the ``.git`` directory. You can also initialize GitPython with a -bare repo. +In the above example, the directory ``/Users/mtrier/Development/git-python`` +is my working repository and contains the ``.git`` directory. You can also +initialize GitPython with a bare repository. >>> repo = Repo.init_bare("/var/git/git-python.git") diff --git a/lib/git_python/diff.py b/lib/git_python/diff.py index 9d2690be..185e1f57 100644 --- a/lib/git_python/diff.py +++ b/lib/git_python/diff.py @@ -2,6 +2,10 @@ import re import commit class Diff(object): + """ + A Diff contains diff information between two commits. + """ + def __init__(self, repo, a_path, b_path, a_commit, b_commit, a_mode, b_mode, new_file, deleted_file, diff): self.repo = repo self.a_path = a_path diff --git a/lib/git_python/git.py b/lib/git_python/git.py index 4bc8760a..4d7063f4 100644 --- a/lib/git_python/git.py +++ b/lib/git_python/git.py @@ -5,6 +5,9 @@ from utils import * from method_missing import MethodMissingMixin class Git(MethodMissingMixin): + """ + The Git class manages communication with the Git binary + """ def __init__(self, git_dir): super(Git, self).__init__() self.git_dir = git_dir @@ -16,7 +19,13 @@ class Git(MethodMissingMixin): return self.git_dir def execute(self, command): - print command + """ + Handles executing the command on the shell and consumes and returns + the returned information (stdout) + + ``command`` + The command to execute + """ proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, diff --git a/lib/git_python/repo.py b/lib/git_python/repo.py index a9bf30dd..20f60a3d 100644 --- a/lib/git_python/repo.py +++ b/lib/git_python/repo.py @@ -233,7 +233,7 @@ class Repo(object): ``paths`` is an optional list of file paths on which to restrict the diff """ - self.git.diff(a, b, '--', *paths) + return self.git.diff(a, b, '--', *paths) def commit_diff(self, commit): """ diff --git a/test/git/test_repo.py b/test/git/test_repo.py index d7a2f271..85a7c581 100644 --- a/test/git/test_repo.py +++ b/test/git/test_repo.py @@ -262,7 +262,7 @@ class TestRepo(object): self.repo.alternates = [] assert_true(os.called) - def test_inspect(self): + def test_repr(self): assert_equal('<GitPython.Repo "%s/.git">' % os.path.abspath(GIT_REPO), repr(self.repo)) @patch(Git, 'method_missing') |