diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2011-04-07 20:17:00 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2011-04-07 20:17:00 +0200 |
commit | a12a7618a1f6f61a4c97ddf4cc422158c3fa72ba (patch) | |
tree | 2b2e0e9991ddede152556f7954cd6e4c6121be97 /git/objects/blob.py | |
parent | e77d2d0ebb9487b696835f219e4a23a558462a55 (diff) | |
download | gitpython-a12a7618a1f6f61a4c97ddf4cc422158c3fa72ba.tar.gz |
Updated objects to use the ones defined in gitdb as basis. Only the submodule implementation is left in git-python as it requires some advanced features. No tests where run yet
Diffstat (limited to 'git/objects/blob.py')
-rw-r--r-- | git/objects/blob.py | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/git/objects/blob.py b/git/objects/blob.py index f52d1a53..38834436 100644 --- a/git/objects/blob.py +++ b/git/objects/blob.py @@ -4,29 +4,10 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php -from mimetypes import guess_type -import base +from git.util import RepoAliasMixin +from gitdb.object.blob import Blob as GitDB_Blob __all__ = ('Blob', ) -class Blob(base.IndexObject): - """A Blob encapsulates a git blob object""" - DEFAULT_MIME_TYPE = "text/plain" - type = "blob" - - # valid blob modes - executable_mode = 0100755 - file_mode = 0100644 - link_mode = 0120000 - +class Blob(GitDB_Blob, RepoAliasMixin): __slots__ = tuple() - - @property - def mime_type(self): - """ - :return: String describing the mime type of this file (based on the filename) - :note: Defaults to 'text/plain' in case the actual file type is unknown. """ - guesses = None - if self.path: - guesses = guess_type(self.path) - return guesses and guesses[0] or self.DEFAULT_MIME_TYPE |