/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

Fix reading pack files over http.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
from bzrlib.errors import (
46
46
    FileExists,
47
47
    NoSuchFile,
 
48
    TransportNotPossible,
48
49
    )
49
50
 
50
51
 
130
131
        ret = []
131
132
        for name in self._pack_names():
132
133
            if name.startswith("pack-") and name.endswith(".pack"):
133
 
                size = self.pack_transport.stat(name).st_size
134
 
                pd = PackData(name, self.pack_transport.get(name), size=size)
 
134
                try:
 
135
                    size = self.pack_transport.stat(name).st_size
 
136
                except TransportNotPossible:
 
137
                    # FIXME: This reads the whole pack file at once
 
138
                    from cStringIO import StringIO
 
139
                    f = self.pack_transport.get(name)
 
140
                    contents = f.read()
 
141
                    pd = PackData(name, StringIO(contents), size=len(contents))
 
142
                else:
 
143
                    pd = PackData(name, self.pack_transport.get(name),
 
144
                            size=size)
135
145
                idxname = name.replace(".pack", ".idx")
136
146
                idx = load_pack_index_file(idxname, self.pack_transport.get(idxname))
137
147
                ret.append(Pack.from_objects(pd, idx))