File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 1616
1717#from git.db.interface import ObjectDBW, ObjectDBR
1818from dulwich .repo import Repo as DulwichRepo
19+ from dulwich .objects import ShaFile
1920
2021from git .base import OInfo , OStream
21- from git .fun import type_id_to_type_map
22+ from git .fun import type_id_to_type_map , type_to_type_id_map
2223
2324from cStringIO import StringIO
2425import os
@@ -57,7 +58,16 @@ def stream(self, binsha):
5758 return OStream (binsha , type_id_to_type_map [type_id ], len (uncomp_data ), StringIO (uncomp_data ))
5859
5960 #}END object dbr
61+
62+ #{ Object DBW
63+
64+ def store (self , istream ):
65+ obj = ShaFile .from_raw_string (type_to_type_id_map [istream .type ], istream .read ())
66+ self ._dw_repo .object_store .add_object (obj )
67+ istream .binsha = obj .sha ().digest ()
68+ return istream
6069
70+ #}END object dbw
6171
6272class DulwichGitDB ( PureRepositoryPathsMixin , PureConfigurationMixin ,
6373 PureReferencesMixin , PureSubmoduleDB ,
You can’t perform that action at this time.
0 commit comments