##// END OF EJS Templates
lfs: move the initialization of the upload request into the try block...
Matt Harbison -
r44599:46c8f15f default
parent child Browse files
Show More
@@ -490,15 +490,17 b' class _gitlfsremote(object):'
490 _(b'detected corrupt lfs object: %s') % oid,
490 _(b'detected corrupt lfs object: %s') % oid,
491 hint=_(b'run hg verify'),
491 hint=_(b'run hg verify'),
492 )
492 )
493 request.data = lfsuploadfile(localstore.open(oid))
494 request.get_method = lambda: 'PUT'
495 request.add_header('Content-Type', 'application/octet-stream')
496 request.add_header('Content-Length', len(request.data))
497
493
498 for k, v in headers:
494 for k, v in headers:
499 request.add_header(pycompat.strurl(k), pycompat.strurl(v))
495 request.add_header(pycompat.strurl(k), pycompat.strurl(v))
500
496
501 try:
497 try:
498 if action == b'upload':
499 request.data = lfsuploadfile(localstore.open(oid))
500 request.get_method = lambda: 'PUT'
501 request.add_header('Content-Type', 'application/octet-stream')
502 request.add_header('Content-Length', len(request.data))
503
502 with contextlib.closing(self.urlopener.open(request)) as res:
504 with contextlib.closing(self.urlopener.open(request)) as res:
503 contentlength = res.info().get(b"content-length")
505 contentlength = res.info().get(b"content-length")
504 ui = self.ui # Shorten debug lines
506 ui = self.ui # Shorten debug lines
General Comments 0
You need to be logged in to leave comments. Login now