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

Commita5a0fa2

Browse files
committed
Fixed up tests to actually use pygit2. Its worth noting that the performance tests only work reliably in a patched up version, or the next point release.
1 parent16a1327 commita5a0fa2

File tree

3 files changed

+26
-23
lines changed

3 files changed

+26
-23
lines changed

‎git/db/pygit2/complex.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
frompygit2importRepositoryasPygit2Repo
1818

1919
fromgit.baseimportOInfo,OStream
20-
fromgit.funimporttype_id_to_type_map,type_to_type_id_map
20+
fromgit.funimporttype_id_to_type_map,type_to_type_id_map
21+
fromgit.utilimporthex_to_bin
2122

2223
fromcStringIOimportStringIO
2324
importos
@@ -49,23 +50,25 @@ def __getattr__(self, attr):
4950

5051
#{ Object DBR
5152

52-
#def info(self, binsha):
53-
#type_id, uncomp_data = self._py2_repo.object_store.get_raw(binsha)
54-
#return OInfo(binsha, type_id_to_type_map[type_id], len(uncomp_data))
55-
#
56-
#def stream(self, binsha):
57-
#type_id, uncomp_data = self._py2_repo.object_store.get_raw(binsha)
58-
#return OStream(binsha, type_id_to_type_map[type_id], len(uncomp_data), StringIO(uncomp_data))
59-
#
53+
definfo(self,binsha):
54+
type_id,uncomp_data=self._py2_repo.read(binsha)
55+
returnOInfo(binsha,type_id_to_type_map[type_id],len(uncomp_data))
56+
57+
defstream(self,binsha):
58+
type_id,uncomp_data=self._py2_repo.read(binsha)
59+
returnOStream(binsha,type_id_to_type_map[type_id],len(uncomp_data),StringIO(uncomp_data))
60+
6061
# #}END object dbr
6162
#
6263
# #{ Object DBW
63-
#
64-
# def store(self, istream):
65-
# obj = ShaFile.from_raw_string(type_to_type_id_map[istream.type], istream.read())
66-
# self._py2_repo.object_store.add_object(obj)
67-
# istream.binsha = obj.sha().digest()
68-
# return istream
64+
defstore(self,istream):
65+
# TODO: remove this check once the required functionality was merged in pygit2
66+
ifhasattr(self._py2_repo,'write'):
67+
istream.binsha=hex_to_bin(self._py2_repo.write(type_to_type_id_map[istream.type],istream.read()))
68+
returnistream
69+
else:
70+
returnsuper(Pygit2GitODB,self).store(istream)
71+
#END handle write support
6972

7073
#}END object dbw
7174

‎git/test/performance/db/test_odb_dulwich.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
fromgit.test.db.dulwich.libimportDulwichRequiredMetaMixin
88
fromodb_implimportTestObjDBPerformanceBase
99

10-
classTestPureDB(TestObjDBPerformanceBase):
10+
classTestDulwichDB(TestObjDBPerformanceBase):
1111
__metaclass__=DulwichRequiredMetaMixin
1212
RepoCls=DulwichCompatibilityGitDB
1313

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
try:
2-
fromgit.db.dulwich.compleximportDulwichCompatibilityGitDB
2+
fromgit.db.pygit2.compleximportPygit2CompatibilityGitDB
33
exceptImportError:
4-
fromgit.db.compleximportPureCompatibilityGitDBasDulwichCompatibilityGitDB
5-
#END handledulwich compatibility
4+
fromgit.db.compleximportPureCompatibilityGitDBasPygit2CompatibilityGitDB
5+
#END handlepygit2 compatibility
66

7-
fromgit.test.db.dulwich.libimportDulwichRequiredMetaMixin
7+
fromgit.test.db.pygit2.libimportPygit2RequiredMetaMixin
88
fromodb_implimportTestObjDBPerformanceBase
99

10-
classTestPureDB(TestObjDBPerformanceBase):
11-
__metaclass__=DulwichRequiredMetaMixin
12-
RepoCls=DulwichCompatibilityGitDB
10+
classTestPygit2DB(TestObjDBPerformanceBase):
11+
__metaclass__=Pygit2RequiredMetaMixin
12+
RepoCls=Pygit2CompatibilityGitDB
1313

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp