equal
deleted
inserted
replaced
4 # |
4 # |
5 # This software may be used and distributed according to the terms of the |
5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. |
6 # GNU General Public License version 2 or any later version. |
7 from __future__ import absolute_import |
7 from __future__ import absolute_import |
8 |
8 |
9 import cStringIO |
|
10 import errno |
9 import errno |
11 import os |
10 import os |
12 import re |
11 import re |
13 import socket |
12 import socket |
14 |
13 |
22 from . import ( |
21 from . import ( |
23 common, |
22 common, |
24 cvsps, |
23 cvsps, |
25 ) |
24 ) |
26 |
25 |
27 StringIO = cStringIO.StringIO |
26 stringio = util.stringio |
28 checktool = common.checktool |
27 checktool = common.checktool |
29 commit = common.commit |
28 commit = common.commit |
30 converter_source = common.converter_source |
29 converter_source = common.converter_source |
31 makedatetimestamp = common.makedatetimestamp |
30 makedatetimestamp = common.makedatetimestamp |
32 NoRepo = common.NoRepo |
31 NoRepo = common.NoRepo |
226 |
225 |
227 def chunkedread(fp, count): |
226 def chunkedread(fp, count): |
228 # file-objects returned by socket.makefile() do not handle |
227 # file-objects returned by socket.makefile() do not handle |
229 # large read() requests very well. |
228 # large read() requests very well. |
230 chunksize = 65536 |
229 chunksize = 65536 |
231 output = StringIO() |
230 output = stringio() |
232 while count > 0: |
231 while count > 0: |
233 data = fp.read(min(count, chunksize)) |
232 data = fp.read(min(count, chunksize)) |
234 if not data: |
233 if not data: |
235 raise error.Abort(_("%d bytes missing from remote file") |
234 raise error.Abort(_("%d bytes missing from remote file") |
236 % count) |
235 % count) |