equal
deleted
inserted
replaced
94 def write(self, oid, data): |
94 def write(self, oid, data): |
95 pass |
95 pass |
96 |
96 |
97 |
97 |
98 class lfsuploadfile(httpconnectionmod.httpsendfile): |
98 class lfsuploadfile(httpconnectionmod.httpsendfile): |
99 """a file-like object that supports keepalive. |
99 """a file-like object that supports keepalive.""" |
100 """ |
|
101 |
100 |
102 def __init__(self, ui, filename): |
101 def __init__(self, ui, filename): |
103 super(lfsuploadfile, self).__init__(ui, filename, b'rb') |
102 super(lfsuploadfile, self).__init__(ui, filename, b'rb') |
104 self.read = self._data.read |
103 self.read = self._data.read |
105 |
104 |
256 False otherwise.""" |
255 False otherwise.""" |
257 return self.cachevfs.exists(oid) or self.vfs.exists(oid) |
256 return self.cachevfs.exists(oid) or self.vfs.exists(oid) |
258 |
257 |
259 |
258 |
260 def _urlerrorreason(urlerror): |
259 def _urlerrorreason(urlerror): |
261 '''Create a friendly message for the given URLError to be used in an |
260 """Create a friendly message for the given URLError to be used in an |
262 LfsRemoteError message. |
261 LfsRemoteError message. |
263 ''' |
262 """ |
264 inst = urlerror |
263 inst = urlerror |
265 |
264 |
266 if isinstance(urlerror.reason, Exception): |
265 if isinstance(urlerror.reason, Exception): |
267 inst = urlerror.reason |
266 inst = urlerror.reason |
268 |
267 |
336 {'oid': pycompat.strurl(p.oid()), 'size': p.size()} |
335 {'oid': pycompat.strurl(p.oid()), 'size': p.size()} |
337 for p in pointers |
336 for p in pointers |
338 ] |
337 ] |
339 requestdata = pycompat.bytesurl( |
338 requestdata = pycompat.bytesurl( |
340 json.dumps( |
339 json.dumps( |
341 {'objects': objects, 'operation': pycompat.strurl(action),} |
340 { |
|
341 'objects': objects, |
|
342 'operation': pycompat.strurl(action), |
|
343 } |
342 ) |
344 ) |
343 ) |
345 ) |
344 url = b'%s/objects/batch' % self.baseurl |
346 url = b'%s/objects/batch' % self.baseurl |
345 batchreq = util.urlreq.request(pycompat.strurl(url), data=requestdata) |
347 batchreq = util.urlreq.request(pycompat.strurl(url), data=requestdata) |
346 batchreq.add_header('Accept', 'application/vnd.git-lfs+json') |
348 batchreq.add_header('Accept', 'application/vnd.git-lfs+json') |