summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-06-29 20:16:37 +0200
committerSebastian Thiel <byronimo@gmail.com>2010-06-29 20:16:37 +0200
commit18be0972304dc7f1a2a509595de7da689bddbefa (patch)
tree9f23a910a68120e64419ee8c03f37ed0790ab621
parent77cd6659b64cb1950a82e6a3cccdda94f15ae739 (diff)
downloadgitpython-18be0972304dc7f1a2a509595de7da689bddbefa.tar.gz
Removed blob.data property as there is no real reason for an exception to the rule of trying not to cache possibly heavy data. The data_stream method should be used instead
-rw-r--r--CHANGES38
-rw-r--r--lib/git/objects/blob.py12
-rw-r--r--test/git/test_base.py2
-rw-r--r--test/git/test_blob.py8
4 files changed, 24 insertions, 36 deletions
diff --git a/CHANGES b/CHANGES
index 66e0a42d..61626f47 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,26 +1,34 @@
=======
CHANGES
=======
+
0.3
===
- * ConcurrentWriteOperation was removed, and replaced by LockedFD
- * IndexFile.get_entries_key was renamed to entry_key
- * IndexEntry instances contained in IndexFile.entries now use binary sha's. Use
- the .hexsha property to obtain the hexadecimal version. The .sha property
- was removed to make the use of the respective sha more explicit.
- * IndexFile.write_tree: removed missing_ok keyword, its always True now
- Instead of raising GitCommandError it raises UnmergedEntriesError
- * diff.Diff.null_hex_sha renamed to NULL_HEX_SHA, to be conforming with
- the naming in the Object base class
- * Object instances, and everything derived from it, now use binary sha's internally. The 'sha' member was removed, in favor of the 'binsha' member.
- An 'hexsha' property is available for convenient conversions.
- They may only be initialized using their binary shas, reference names or revision specs are not allowed anymore.
- * The .data attribute was removed from the Object type, it is only available
- on the Blob type.
- * For consistency with naming conventions used in sub-modules like gitdb, the following modules have been renamed
+Renamed Modules
+---------------
+* For consistency with naming conventions used in sub-modules like gitdb, the following modules have been renamed
* git.utils -> git.util
* git.errors -> git.exc
* git.objects.utils -> git.objects.util
+
+General
+-------
+* Object instances, and everything derived from it, now use binary sha's internally. The 'sha' member was removed, in favor of the 'binsha' member.
+ An 'hexsha' property is available for convenient conversions.
+ They may only be initialized using their binary shas, reference names or revision specs are not allowed anymore.
+* IndexEntry instances contained in IndexFile.entries now use binary sha's. Use the .hexsha property to obtain the hexadecimal version. The .sha property was removed to make the use of the respective sha more explicit.
+* If objects are instantiated explicitly, a binary sha is required to identify the object, where previously any rev-spec could be used. The ref-spec compatible
+version still exists as Object.new or Repo.commit|Repo.tree respectively.
+* The .data attribute was removed from the Object type, to obtain plain data, use the data_stream property instead.
+* ConcurrentWriteOperation was removed, and replaced by LockedFD
+* IndexFile.get_entries_key was renamed to entry_key
+* IndexFile.write_tree: removed missing_ok keyword, its always True now
+ Instead of raising GitCommandError it raises UnmergedEntriesError.
+ This is required as the pure-python implementation doesn't support the missing_ok keyword yet.
+* diff.Diff.null_hex_sha renamed to NULL_HEX_SHA, to be conforming with
+ the naming in the Object base class
+
+
0.2 Beta 2
diff --git a/lib/git/objects/blob.py b/lib/git/objects/blob.py
index d0ef54c7..32f8c61c 100644
--- a/lib/git/objects/blob.py
+++ b/lib/git/objects/blob.py
@@ -14,17 +14,7 @@ class Blob(base.IndexObject):
DEFAULT_MIME_TYPE = "text/plain"
type = "blob"
- __slots__ = "data"
-
- def _set_cache_(self, attr):
- if attr == "data":
- ostream = self.repo.odb.stream(self.binsha)
- self.size = ostream.size
- self.data = ostream.read()
- # assert ostream.type == self.type, _assertion_msg_format % (self.binsha, ostream.type, self.type)
- else:
- super(Blob, self)._set_cache_(attr)
- # END handle data
+ __slots__ = tuple()
@property
def mime_type(self):
diff --git a/test/git/test_base.py b/test/git/test_base.py
index 938647d0..db13feae 100644
--- a/test/git/test_base.py
+++ b/test/git/test_base.py
@@ -42,8 +42,6 @@ class TestBase(TestBase):
assert item.hexsha == hexsha
assert item.type == typename
assert item.size
- if isinstance(item, Blob):
- assert item.data
assert item == item
assert not item != item
assert str(item) == item.hexsha
diff --git a/test/git/test_blob.py b/test/git/test_blob.py
index e5fca0a6..623ed179 100644
--- a/test/git/test_blob.py
+++ b/test/git/test_blob.py
@@ -10,14 +10,6 @@ from gitdb.util import hex_to_bin
class TestBlob(TestBase):
- def test_should_cache_data(self):
- bid = 'a802c139d4767c89dcad79d836d05f7004d39aac'
- blob = Blob(self.rorepo, hex_to_bin(bid))
- blob.data
- assert blob.data
- blob.size
- blob.size
-
def test_mime_type_should_return_mime_type_for_known_types(self):
blob = Blob(self.rorepo, **{'binsha': Blob.NULL_BIN_SHA, 'path': 'foo.png'})
assert_equal("image/png", blob.mime_type)