##// END OF EJS Templates
phabricator: add the uploadchunks function...
Ian Moody -
r43457:45307960 default
parent child Browse files
Show More
@@ -41,6 +41,7 b' Config::'
41 41
42 42 from __future__ import absolute_import
43 43
44 import base64
44 45 import contextlib
45 46 import itertools
46 47 import json
@@ -579,6 +580,34 b' def maketext(pchange, ctx, fname):'
579 580 )
580 581
581 582
583 def uploadchunks(fctx, fphid):
584 """upload large binary files as separate chunks.
585 Phab requests chunking over 8MiB, and splits into 4MiB chunks
586 """
587 ui = fctx.repo().ui
588 chunks = callconduit(ui, b'file.querychunks', {b'filePHID': fphid})
589 progress = ui.makeprogress(
590 _(b'uploading file chunks'), unit=_(b'chunks'), total=len(chunks)
591 )
592 for chunk in chunks:
593 progress.increment()
594 if chunk[b'complete']:
595 continue
596 bstart = int(chunk[b'byteStart'])
597 bend = int(chunk[b'byteEnd'])
598 callconduit(
599 ui,
600 b'file.uploadchunk',
601 {
602 b'filePHID': fphid,
603 b'byteStart': bstart,
604 b'data': base64.b64encode(fctx.data()[bstart:bend]),
605 b'dataEncoding': b'base64',
606 },
607 )
608 progress.complete()
609
610
582 611 def creatediff(ctx):
583 612 """create a Differential Diff"""
584 613 repo = ctx.repo()
General Comments 0
You need to be logged in to leave comments. Login now