From a12a7618a1f6f61a4c97ddf4cc422158c3fa72ba Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 7 Apr 2011 20:17:00 +0200 Subject: 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 --- git/objects/blob.py | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) (limited to 'git/objects/blob.py') 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 -- cgit v1.2.3