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:
David Soria Parra 2017-04-19 23:33:06 -07:00
parent 9dc2f1efb7
commit 4359d6f9ad

View File

@ -35,8 +35,11 @@ def create(tr, ui, repo, importset, filelogs):
# same filelog. It would be more appropriate to update the filelist # same filelog. It would be more appropriate to update the filelist
# after receiving the initial filelist but this would not be parallel. # after receiving the initial filelist but this would not be parallel.
fi = importer.FileImporter(ui, repo, importset, filelog) fi = importer.FileImporter(ui, repo, importset, filelog)
mdict = fi.create(tr) fileflags = fi.create(tr)
yield 1, json.dumps(mdict) yield 1, json.dumps({
'fileflags': fileflags,
'depotname': filelog.depotfile,
})
# -> Dict[Int, List[str]] # -> Dict[Int, List[str]]
#def create_runlist(ui, repo, filelist, path): #def create_runlist(ui, repo, filelist, path):
@ -152,11 +155,12 @@ def p4fastimport(ui, repo, client, **opts):
ui.flush() ui.flush()
prog = worker.worker(ui, weight, create, wargs, filelogs) prog = worker.worker(ui, weight, create, wargs, filelogs)
for i, serialized in prog: for i, serialized in prog:
ui.progress(_('importing'), count, item='file', unit='file', data = json.loads(serialized)
total=len(p4filelogs)) 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 # Json converts to UTF8 and int keys to strings, so we have to
# convert back. TODO: Find a better way to handle this. # 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 count += i
ui.progress(_('importing'), None) ui.progress(_('importing'), None)