Skip to content

Commit 0906450

Browse files
committed
Added trivial implementation for info and stream methods - info is very inefficient, but can't help it. Basic repo tests don't work as dulwich ignores alternate files
1 parent b56764b commit 0906450

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

git/db/dulwich/complex.py

+16
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
#from git.db.interface import ObjectDBW, ObjectDBR
1818
from dulwich.repo import Repo as DulwichRepo
1919

20+
from git.base import OInfo, OStream
21+
from git.fun import type_id_to_type_map
22+
23+
from cStringIO import StringIO
2024
import os
2125

2226

@@ -42,6 +46,18 @@ def __getattr__(self, attr):
4246
return getattr(self._dw_repo, attr)
4347
#END handle attr
4448

49+
#{ Object DBR
50+
51+
def info(self, binsha):
52+
type_id, uncomp_data = self._dw_repo.object_store.get_raw(binsha)
53+
return OInfo(binsha, type_id_to_type_map[type_id], len(uncomp_data))
54+
55+
def stream(self, binsha):
56+
type_id, uncomp_data = self._dw_repo.object_store.get_raw(binsha)
57+
return OStream(binsha, type_id_to_type_map[type_id], len(uncomp_data), StringIO(uncomp_data))
58+
59+
#}END object dbr
60+
4561

4662
class DulwichGitDB( PureRepositoryPathsMixin, PureConfigurationMixin,
4763
PureReferencesMixin, PureSubmoduleDB,

0 commit comments

Comments
 (0)