diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2011-07-07 23:37:04 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2011-07-07 23:37:04 +0200 |
commit | f4f330f8588dacd43af6513e1e1e1a50237da1e7 (patch) | |
tree | 2ebffe75f484d48a8fdc2c282a457cf77a86c3cf /git | |
parent | 6a10c8a82adcbe1f18c2e79a9135c7f5c753b826 (diff) | |
download | gitpython-f4f330f8588dacd43af6513e1e1e1a50237da1e7.tar.gz |
Added store support. Now the basic object IO is implemented, which shall be enough for the first batch of work
Diffstat (limited to 'git')
-rw-r--r-- | git/db/dulwich/complex.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/git/db/dulwich/complex.py b/git/db/dulwich/complex.py index e1dad01d..ad5b97a4 100644 --- a/git/db/dulwich/complex.py +++ b/git/db/dulwich/complex.py @@ -16,9 +16,10 @@ from git.db.compat import RepoCompatibilityInterfaceNoBare #from git.db.interface import ObjectDBW, ObjectDBR from dulwich.repo import Repo as DulwichRepo +from dulwich.objects import ShaFile from git.base import OInfo, OStream -from git.fun import type_id_to_type_map +from git.fun import type_id_to_type_map, type_to_type_id_map from cStringIO import StringIO import os @@ -57,7 +58,16 @@ class DulwichGitODB(PureGitODB): return OStream(binsha, type_id_to_type_map[type_id], len(uncomp_data), StringIO(uncomp_data)) #}END object dbr + + #{ Object DBW + + def store(self, istream): + obj = ShaFile.from_raw_string(type_to_type_id_map[istream.type], istream.read()) + self._dw_repo.object_store.add_object(obj) + istream.binsha = obj.sha().digest() + return istream + #}END object dbw class DulwichGitDB( PureRepositoryPathsMixin, PureConfigurationMixin, PureReferencesMixin, PureSubmoduleDB, |