summaryrefslogtreecommitdiff
path: root/git
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2011-07-07 21:28:08 +0200
committerSebastian Thiel <byronimo@gmail.com>2011-07-07 21:28:08 +0200
commit09064504e52a5ec8bfc4825a3176239b731380d2 (patch)
treeed5c54b6e7d2b82ffd9df6c3ffefbb0902985ff3 /git
parentb56764b2dbe8845d476e41c8659fc0543ffb3433 (diff)
downloadgitpython-09064504e52a5ec8bfc4825a3176239b731380d2.tar.gz
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
Diffstat (limited to 'git')
-rw-r--r--git/db/dulwich/complex.py16
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,