From 09064504e52a5ec8bfc4825a3176239b731380d2 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 7 Jul 2011 21:28:08 +0200 Subject: 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 --- git/db/dulwich/complex.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'git/db') 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, -- cgit v1.2.3