mercurial/httppeer.py
changeset 50928 d718eddf01d9
parent 50666 60f9602b413e
child 50929 18c8c18993f0
equal deleted inserted replaced
50927:7a8ea1397816 50928:d718eddf01d9
    63 
    63 
    64 
    64 
    65 class _multifile:
    65 class _multifile:
    66     def __init__(self, *fileobjs):
    66     def __init__(self, *fileobjs):
    67         for f in fileobjs:
    67         for f in fileobjs:
    68             if not util.safehasattr(f, 'length'):
    68             if not hasattr(f, 'length'):
    69                 raise ValueError(
    69                 raise ValueError(
    70                     b'_multifile only supports file objects that '
    70                     b'_multifile only supports file objects that '
    71                     b'have a length but this one does not:',
    71                     b'have a length but this one does not:',
    72                     type(f),
    72                     type(f),
    73                     f,
    73                     f,
   178             q += sorted(args.items())
   178             q += sorted(args.items())
   179 
   179 
   180     qs = b'?%s' % urlreq.urlencode(q)
   180     qs = b'?%s' % urlreq.urlencode(q)
   181     cu = b"%s%s" % (repobaseurl, qs)
   181     cu = b"%s%s" % (repobaseurl, qs)
   182     size = 0
   182     size = 0
   183     if util.safehasattr(data, 'length'):
   183     if hasattr(data, 'length'):
   184         size = data.length
   184         size = data.length
   185     elif data is not None:
   185     elif data is not None:
   186         size = len(data)
   186         size = len(data)
   187     if data is not None and 'Content-Type' not in headers:
   187     if data is not None and 'Content-Type' not in headers:
   188         headers['Content-Type'] = 'application/mercurial-0.1'
   188         headers['Content-Type'] = 'application/mercurial-0.1'