Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit18be097

Browse files
committed
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
1 parent77cd665 commit18be097

File tree

4 files changed

+24
-36
lines changed

4 files changed

+24
-36
lines changed

‎CHANGES‎

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,34 @@
11
=======
22
CHANGES
33
=======
4+
45
0.3
56
===
6-
* ConcurrentWriteOperation was removed, and replaced by LockedFD
7-
* IndexFile.get_entries_key was renamed to entry_key
8-
* IndexEntry instances contained in IndexFile.entries now use binary sha's. Use
9-
the .hexsha property to obtain the hexadecimal version. The .sha property
10-
was removed to make the use of the respective sha more explicit.
11-
* IndexFile.write_tree: removed missing_ok keyword, its always True now
12-
Instead of raising GitCommandError it raises UnmergedEntriesError
13-
* diff.Diff.null_hex_sha renamed to NULL_HEX_SHA, to be conforming with
14-
the naming in the Object base class
15-
* Object instances, and everything derived from it, now use binary sha's internally. The 'sha' member was removed, in favor of the 'binsha' member.
16-
An 'hexsha' property is available for convenient conversions.
17-
They may only be initialized using their binary shas, reference names or revision specs are not allowed anymore.
18-
* The .data attribute was removed from the Object type, it is only available
19-
on the Blob type.
20-
* For consistency with naming conventions used in sub-modules like gitdb, the following modules have been renamed
7+
Renamed Modules
8+
---------------
9+
* For consistency with naming conventions used in sub-modules like gitdb, the following modules have been renamed
2110
* git.utils -> git.util
2211
* git.errors -> git.exc
2312
* git.objects.utils -> git.objects.util
13+
14+
General
15+
-------
16+
* Object instances, and everything derived from it, now use binary sha's internally. The 'sha' member was removed, in favor of the 'binsha' member.
17+
An 'hexsha' property is available for convenient conversions.
18+
They may only be initialized using their binary shas, reference names or revision specs are not allowed anymore.
19+
* 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.
20+
* 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
21+
version still exists as Object.new or Repo.commit|Repo.tree respectively.
22+
* The .data attribute was removed from the Object type, to obtain plain data, use the data_stream property instead.
23+
* ConcurrentWriteOperation was removed, and replaced by LockedFD
24+
* IndexFile.get_entries_key was renamed to entry_key
25+
* IndexFile.write_tree: removed missing_ok keyword, its always True now
26+
Instead of raising GitCommandError it raises UnmergedEntriesError.
27+
This is required as the pure-python implementation doesn't support the missing_ok keyword yet.
28+
* diff.Diff.null_hex_sha renamed to NULL_HEX_SHA, to be conforming with
29+
the naming in the Object base class
30+
31+
2432

2533

2634
0.2 Beta 2

‎lib/git/objects/blob.py‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,7 @@ class Blob(base.IndexObject):
1414
DEFAULT_MIME_TYPE="text/plain"
1515
type="blob"
1616

17-
__slots__="data"
18-
19-
def_set_cache_(self,attr):
20-
ifattr=="data":
21-
ostream=self.repo.odb.stream(self.binsha)
22-
self.size=ostream.size
23-
self.data=ostream.read()
24-
# assert ostream.type == self.type, _assertion_msg_format % (self.binsha, ostream.type, self.type)
25-
else:
26-
super(Blob,self)._set_cache_(attr)
27-
# END handle data
17+
__slots__=tuple()
2818

2919
@property
3020
defmime_type(self):

‎test/git/test_base.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ def test_base_object(self):
4242
assertitem.hexsha==hexsha
4343
assertitem.type==typename
4444
assertitem.size
45-
ifisinstance(item,Blob):
46-
assertitem.data
4745
assertitem==item
4846
assertnotitem!=item
4947
assertstr(item)==item.hexsha

‎test/git/test_blob.py‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,6 @@
1010

1111
classTestBlob(TestBase):
1212

13-
deftest_should_cache_data(self):
14-
bid='a802c139d4767c89dcad79d836d05f7004d39aac'
15-
blob=Blob(self.rorepo,hex_to_bin(bid))
16-
blob.data
17-
assertblob.data
18-
blob.size
19-
blob.size
20-
2113
deftest_mime_type_should_return_mime_type_for_known_types(self):
2214
blob=Blob(self.rorepo,**{'binsha':Blob.NULL_BIN_SHA,'path':'foo.png'})
2315
assert_equal("image/png",blob.mime_type)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp