##// 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 ui = fctx.repo().ui
610 ui = fctx.repo().ui
611 chunks = callconduit(ui, b'file.querychunks', {b'filePHID': fphid})
611 chunks = callconduit(ui, b'file.querychunks', {b'filePHID': fphid})
612 progress = ui.makeprogress(
612 with ui.makeprogress(
613 _(b'uploading file chunks'), unit=_(b'chunks'), total=len(chunks)
613 _(b'uploading file chunks'), unit=_(b'chunks'), total=len(chunks)
614 )
614 ) as progress:
615 for chunk in chunks:
615 for chunk in chunks:
616 progress.increment()
616 progress.increment()
617 if chunk[b'complete']:
617 if chunk[b'complete']:
618 continue
618 continue
619 bstart = int(chunk[b'byteStart'])
619 bstart = int(chunk[b'byteStart'])
620 bend = int(chunk[b'byteEnd'])
620 bend = int(chunk[b'byteEnd'])
621 callconduit(
621 callconduit(
622 ui,
622 ui,
623 b'file.uploadchunk',
623 b'file.uploadchunk',
624 {
624 {
625 b'filePHID': fphid,
625 b'filePHID': fphid,
626 b'byteStart': bstart,
626 b'byteStart': bstart,
627 b'data': base64.b64encode(fctx.data()[bstart:bend]),
627 b'data': base64.b64encode(fctx.data()[bstart:bend]),
628 b'dataEncoding': b'base64',
628 b'dataEncoding': b'base64',
629 },
629 },
630 )
630 )
631 progress.complete()
632
631
633
632
634 def uploadfile(fctx):
633 def uploadfile(fctx):
General Comments 0
You need to be logged in to leave comments. Login now