mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 09:17:30 +03:00
p4fastimport: return filename from worker
Summary: Return the filename from the worker so that we can later use it for better messages and pass it correctly to progress(). Test Plan: cd tests && rt test-p4* Reviewers: #sourcecontrol, durham, ikostia Reviewed By: ikostia Subscribers: ikostia, durham, mjpieters, #idi Differential Revision: https://phabricator.intern.facebook.com/D4890079 Signature: t1:4890079:1492643347:10eb254ba99faf9e28107ede3ef78f1fcab7946a
This commit is contained in:
parent
9dc2f1efb7
commit
4359d6f9ad
@ -35,8 +35,11 @@ def create(tr, ui, repo, importset, filelogs):
|
||||
# same filelog. It would be more appropriate to update the filelist
|
||||
# after receiving the initial filelist but this would not be parallel.
|
||||
fi = importer.FileImporter(ui, repo, importset, filelog)
|
||||
mdict = fi.create(tr)
|
||||
yield 1, json.dumps(mdict)
|
||||
fileflags = fi.create(tr)
|
||||
yield 1, json.dumps({
|
||||
'fileflags': fileflags,
|
||||
'depotname': filelog.depotfile,
|
||||
})
|
||||
|
||||
# -> Dict[Int, List[str]]
|
||||
#def create_runlist(ui, repo, filelist, path):
|
||||
@ -152,11 +155,12 @@ def p4fastimport(ui, repo, client, **opts):
|
||||
ui.flush()
|
||||
prog = worker.worker(ui, weight, create, wargs, filelogs)
|
||||
for i, serialized in prog:
|
||||
ui.progress(_('importing'), count, item='file', unit='file',
|
||||
total=len(p4filelogs))
|
||||
data = json.loads(serialized)
|
||||
ui.progress(_('importing'), count, item=data['depotname'],
|
||||
unit='file', total=len(p4filelogs))
|
||||
# Json converts to UTF8 and int keys to strings, so we have to
|
||||
# convert back. TODO: Find a better way to handle this.
|
||||
fileflags.update(util.decodefileflags(json.loads(serialized)))
|
||||
fileflags.update(util.decodefileflags(data['fileflags']))
|
||||
count += i
|
||||
ui.progress(_('importing'), None)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user