summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2009-10-08 09:57:36 +0200
committerSebastian Thiel <byronimo@gmail.com>2009-10-08 13:41:34 +0200
commitbca0cb7f507d6a21a652307737a57057692d2f79 (patch)
tree93c2eb765ee024990ba16c228c1f7a9a66f996c5
parent4c39f9da792792d4e73fc3a5effde66576ae128c (diff)
downloadgitpython-bca0cb7f507d6a21a652307737a57057692d2f79.tar.gz
Improved documentation on Actor and Blob
-rw-r--r--lib/git/actor.py3
-rw-r--r--lib/git/blob.py17
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/git/actor.py b/lib/git/actor.py
index cdcc02f8..bc1a4479 100644
--- a/lib/git/actor.py
+++ b/lib/git/actor.py
@@ -7,6 +7,9 @@
import re
class Actor(object):
+ """Actors hold information about a person acting on the repository. They
+ can be committers and authors or anything with a name and an email as
+ mentioned in the git log entries."""
def __init__(self, name, email):
self.name = name
self.email = email
diff --git a/lib/git/blob.py b/lib/git/blob.py
index 82f92ce3..eea04490 100644
--- a/lib/git/blob.py
+++ b/lib/git/blob.py
@@ -12,6 +12,7 @@ from actor import Actor
from commit import Commit
class Blob(object):
+ """A Blob encapsulates a git blob object"""
DEFAULT_MIME_TYPE = "text/plain"
def __init__(self, repo, id, mode=None, name=None):
@@ -48,6 +49,9 @@ class Blob(object):
Returns
int
+
+ NOTE
+ The size will be cached after the first access
"""
if self._size is None:
self._size = int(self.repo.git.cat_file(self.id, s=True).rstrip())
@@ -60,6 +64,9 @@ class Blob(object):
Returns
str
+
+ NOTE
+ The data will be cached after the first access.
"""
self.data_stored = self.data_stored or self.repo.git.cat_file(self.id, p=True, with_raw_output=True)
return self.data_stored
@@ -71,6 +78,9 @@ class Blob(object):
Returns
str
+
+ NOTE
+ Defaults to 'text/plain' in case the actual file type is unknown.
"""
guesses = None
if self.name:
@@ -79,6 +89,10 @@ class Blob(object):
@property
def basename(self):
+ """
+ Returns
+ The basename of the Blobs file name
+ """
return os.path.basename(self.name)
@classmethod
@@ -88,6 +102,9 @@ class Blob(object):
Returns
list: [git.Commit, list: [<line>]]
+ A list of tuples associating a Commit object with a list of lines that
+ changed within the given commit. The Commit objects will be given in order
+ of appearance.
"""
data = repo.git.blame(commit, '--', file, p=True)
commits = {}