/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to transportgit.py

Write git pack files rather than loose objects.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""A Git repository implementation that uses a Bazaar transport."""
18
18
 
 
19
from cStringIO import StringIO
19
20
 
20
21
from dulwich.errors import (
21
22
    NotGitRepository,
136
137
                except TransportNotPossible:
137
138
                    def pd():
138
139
                        # FIXME: This reads the whole pack file at once
139
 
                        from cStringIO import StringIO
140
140
                        f = self.pack_transport.get(name)
141
141
                        contents = f.read()
142
142
                        return PackData(name, StringIO(contents), size=len(contents))
195
195
        basename = "pack-%s" % iter_sha1(entry[0] for entry in entries)
196
196
        f.seek(0)
197
197
        self.pack_transport.put_file(basename + ".pack", f)
198
 
        index_path = self.pack_transport.local_abspath(basename+".idx")
199
 
        write_pack_index_v2(index_path, entries, p.get_stored_checksum())
200
 
        idx = load_pack_index_file(basename+".idx",
201
 
                self.pack_transport.get(basename+".idx"))
 
198
        idxfile = StringIO()
 
199
        write_pack_index_v2(idxfile, entries, p.get_stored_checksum())
 
200
        idxfile.seek(0)
 
201
        self.pack_transport.put_file(basename + ".idx", idxfile)
 
202
        idxfile.seek(0)
 
203
        idx = load_pack_index_file(basename+".idx", idxfile)
202
204
        final_pack = Pack.from_objects(p, idx)
203
205
        self._add_known_pack(final_pack)
204
206
        return final_pack