From 4359d6f9ada75ae10c70a90e6935e121def97059 Mon Sep 17 00:00:00 2001 From: David Soria Parra Date: Wed, 19 Apr 2017 23:33:06 -0700 Subject: [PATCH] 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 --- p4fastimport/__init__.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/p4fastimport/__init__.py b/p4fastimport/__init__.py index 312e7a6edb..34d631c463 100644 --- a/p4fastimport/__init__.py +++ b/p4fastimport/__init__.py @@ -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)