summaryrefslogtreecommitdiff
path: root/lib/git/blob.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2009-10-09 11:57:48 +0200
committerSebastian Thiel <byronimo@gmail.com>2009-10-09 11:57:48 +0200
commit92a97480edcc0f0de787a752bf90feed0445dd39 (patch)
tree518c00ba9840a2d6f32ffa7a876d7efa98016a03 /lib/git/blob.py
parent2b7f5cb25e0e03e06ec506d31c001c172dd71ef6 (diff)
downloadgitpython-92a97480edcc0f0de787a752bf90feed0445dd39.tar.gz
Blob|Tree: renamed 'name' member to 'path', updated tests and changelog as it would make existing code incompatible in some places
Diffstat (limited to 'lib/git/blob.py')
-rw-r--r--lib/git/blob.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/git/blob.py b/lib/git/blob.py
index 82a41f73..dac0888f 100644
--- a/lib/git/blob.py
+++ b/lib/git/blob.py
@@ -15,7 +15,7 @@ class Blob(object):
"""A Blob encapsulates a git blob object"""
DEFAULT_MIME_TYPE = "text/plain"
- def __init__(self, repo, id, mode=None, name=None):
+ def __init__(self, repo, id, mode=None, path=None):
"""
Create an unbaked Blob containing just the specified attributes
@@ -28,8 +28,8 @@ class Blob(object):
``mode``
is the file mode
- ``name``
- is the file name
+ ``path``
+ is the path to the file
Returns
git.Blob
@@ -37,7 +37,7 @@ class Blob(object):
self.repo = repo
self.id = id
self.mode = mode
- self.name = name
+ self.path = path
self._size = None
self.data_stored = None
@@ -83,17 +83,17 @@ class Blob(object):
Defaults to 'text/plain' in case the actual file type is unknown.
"""
guesses = None
- if self.name:
- guesses = mimetypes.guess_type(self.name)
+ if self.path:
+ guesses = mimetypes.guess_type(self.path)
return guesses and guesses[0] or self.DEFAULT_MIME_TYPE
@property
def basename(self):
"""
Returns
- The basename of the Blobs file name
+ The basename of the Blobs file path
"""
- return os.path.basename(self.name)
+ return os.path.basename(self.path)
@classmethod
def blame(cls, repo, commit, file):