From 7adafd0b5c28f6b34181db700c3b84a7225a95c3 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Wed, 17 Oct 2018 07:00:25 +0300 Subject: [PATCH] progress: properly report on dir with large dirs Signed-off-by: Ruslan Kuprieiev --- dvc/remote/local.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dvc/remote/local.py b/dvc/remote/local.py index 2effd5b2b..81bb0cac1 100644 --- a/dvc/remote/local.py +++ b/dvc/remote/local.py @@ -158,14 +158,15 @@ class RemoteLOCAL(RemoteBase): def collect_dir_cache(self, dname): dir_info = [] - bar = False for root, dirs, files in os.walk(dname): + bar = False + if len(files) > LARGE_DIR_SIZE: msg = "Computing md5 for a large directory {}. " \ "This is only done once." - Logger.info(msg.format(os.path.relpath(dname))) + Logger.info(msg.format(os.path.relpath(root))) bar = True - title = os.path.relpath(dname) + title = os.path.relpath(root) processed = 0 total = len(files) progress.update_target(title, 0, total) @@ -182,8 +183,8 @@ class RemoteLOCAL(RemoteBase): dir_info.append({self.PARAM_RELPATH: relpath, self.PARAM_MD5: md5}) - if bar: - progress.finish_target(title) + if bar: + progress.finish_target(title) # NOTE: sorting the list by path to ensure reproducibility dir_info = sorted(dir_info, key=itemgetter(self.PARAM_RELPATH))