summaryrefslogtreecommitdiff
path: root/lib/git/objects/commit.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2009-10-16 19:19:57 +0200
committerSebastian Thiel <byronimo@gmail.com>2009-10-16 19:19:57 +0200
commitb372e26366348920eae32ee81a47b469b511a21f (patch)
tree9cee746944005c9c5d7adf284785a2fdb62dc2e4 /lib/git/objects/commit.py
parentbb24f67e64b4ebe11c4d3ce7df021a6ad7ca98f2 (diff)
downloadgitpython-b372e26366348920eae32ee81a47b469b511a21f.tar.gz
added Diffable interface to objects.base, its used by Commit and Tree objects.
Diff class has been prepared to process raw input, but its not yet more than a frame
Diffstat (limited to 'lib/git/objects/commit.py')
-rw-r--r--lib/git/objects/commit.py56
1 files changed, 1 insertions, 55 deletions
diff --git a/lib/git/objects/commit.py b/lib/git/objects/commit.py
index 847f4dec..7ed38703 100644
--- a/lib/git/objects/commit.py
+++ b/lib/git/objects/commit.py
@@ -11,7 +11,7 @@ from tree import Tree
import base
import utils
-class Commit(base.Object, Iterable):
+class Commit(base.Object, Iterable, base.Diffable):
"""
Wraps a git Commit object.
@@ -176,60 +176,6 @@ class Commit(base.Object, Iterable):
return self.iter_items( self.repo, self, paths, **kwargs )
- @classmethod
- def diff(cls, repo, a, b=None, paths=None):
- """
- Creates diffs between a tree and the index or between two trees:
-
- ``repo``
- is the Repo
-
- ``a``
- is a named commit
-
- ``b``
- is an optional named commit. Passing a list assumes you
- wish to omit the second named commit and limit the diff to the
- given paths.
-
- ``paths``
- is a list of paths to limit the diff to.
-
- Returns
- git.Diff[]::
-
- between tree and the index if only a is given
- between two trees if a and b are given and are commits
- """
- paths = paths or []
-
- if isinstance(b, list):
- paths = b
- b = None
-
- if paths:
- paths.insert(0, "--")
-
- if b:
- paths.insert(0, b)
- paths.insert(0, a)
- text = repo.git.diff('-M', full_index=True, *paths)
- return diff.Diff._list_from_string(repo, text)
-
- @property
- def diffs(self):
- """
- Returns
- git.Diff[]
- Diffs between this commit and its first parent or all changes if this
- commit is the first commit and has no parent.
- """
- if not self.parents:
- d = self.repo.git.show(self.id, '-M', full_index=True, pretty='raw')
- return diff.Diff._list_from_string(self.repo, d)
- else:
- return self.diff(self.repo, self.parents[0].id, self.id)
-
@property
def stats(self):
"""