##// END OF EJS Templates
phabricator: use context manager form of progress in uploadchunks...
Ian Moody -
r43810:a78a65c3 default
parent child Browse files
Show More
@@ -609,26 +609,25 b' def uploadchunks(fctx, fphid):'
609 609 """
610 610 ui = fctx.repo().ui
611 611 chunks = callconduit(ui, b'file.querychunks', {b'filePHID': fphid})
612 progress = ui.makeprogress(
612 with ui.makeprogress(
613 613 _(b'uploading file chunks'), unit=_(b'chunks'), total=len(chunks)
614 )
615 for chunk in chunks:
616 progress.increment()
617 if chunk[b'complete']:
618 continue
619 bstart = int(chunk[b'byteStart'])
620 bend = int(chunk[b'byteEnd'])
621 callconduit(
622 ui,
623 b'file.uploadchunk',
624 {
625 b'filePHID': fphid,
626 b'byteStart': bstart,
627 b'data': base64.b64encode(fctx.data()[bstart:bend]),
628 b'dataEncoding': b'base64',
629 },
630 )
631 progress.complete()
614 ) as progress:
615 for chunk in chunks:
616 progress.increment()
617 if chunk[b'complete']:
618 continue
619 bstart = int(chunk[b'byteStart'])
620 bend = int(chunk[b'byteEnd'])
621 callconduit(
622 ui,
623 b'file.uploadchunk',
624 {
625 b'filePHID': fphid,
626 b'byteStart': bstart,
627 b'data': base64.b64encode(fctx.data()[bstart:bend]),
628 b'dataEncoding': b'base64',
629 },
630 )
632 631
633 632
634 633 def uploadfile(fctx):
General Comments 0
You need to be logged in to leave comments. Login now