diff options
Diffstat (limited to 'git/db/dulwich/complex.py')
-rw-r--r-- | git/db/dulwich/complex.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/git/db/dulwich/complex.py b/git/db/dulwich/complex.py index 3fa7c1cd..e1dad01d 100644 --- a/git/db/dulwich/complex.py +++ b/git/db/dulwich/complex.py @@ -17,6 +17,10 @@ from git.db.compat import RepoCompatibilityInterfaceNoBare #from git.db.interface import ObjectDBW, ObjectDBR from dulwich.repo import Repo as DulwichRepo +from git.base import OInfo, OStream +from git.fun import type_id_to_type_map + +from cStringIO import StringIO import os @@ -42,6 +46,18 @@ class DulwichGitODB(PureGitODB): return getattr(self._dw_repo, attr) #END handle attr + #{ Object DBR + + def info(self, binsha): + type_id, uncomp_data = self._dw_repo.object_store.get_raw(binsha) + return OInfo(binsha, type_id_to_type_map[type_id], len(uncomp_data)) + + def stream(self, binsha): + type_id, uncomp_data = self._dw_repo.object_store.get_raw(binsha) + return OStream(binsha, type_id_to_type_map[type_id], len(uncomp_data), StringIO(uncomp_data)) + + #}END object dbr + class DulwichGitDB( PureRepositoryPathsMixin, PureConfigurationMixin, PureReferencesMixin, PureSubmoduleDB, |