From dd6217120ff2e966da6ca01b654fe0b92dcd8307 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Sun, 12 May 2019 23:33:49 +0300 Subject: [PATCH] remote: checkout: save checksums without re-computation We do a similar thing on save, where we set cache checksum from already computated ones for actual data. This patch does the same thing but in revers: on checkout we know cache checksums, so we can set data checksums from it without having to re-calculate it. Fixes #1991 Signed-off-by: Ruslan Kuprieiev --- dvc/remote/base.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dvc/remote/base.py b/dvc/remote/base.py index 64f8bae6c..7ab579349 100644 --- a/dvc/remote/base.py +++ b/dvc/remote/base.py @@ -592,6 +592,7 @@ class RemoteBASE(object): self.link(cache_info, path_info) self.state.save_link(path_info) + self.state.save(path_info, checksum) if progress_callback: progress_callback.update(path_info.url) @@ -613,22 +614,24 @@ class RemoteBASE(object): entry_info = copy(path_info) for entry in dir_info: relpath = entry[self.PARAM_RELPATH] - checksum = entry[self.PARAM_CHECKSUM] - entry_cache_info = self.checksum_to_path_info(checksum) + entry_checksum = entry[self.PARAM_CHECKSUM] + entry_cache_info = self.checksum_to_path_info(entry_checksum) entry_info.url = self.ospath.join(path_info.url, relpath) entry_info.path = self.ospath.join(path_info.path, relpath) - entry_checksum_info = {self.PARAM_CHECKSUM: checksum} + entry_checksum_info = {self.PARAM_CHECKSUM: entry_checksum} if self.changed(entry_info, entry_checksum_info): if self.exists(entry_info): self.safe_remove(entry_info, force=force) self.link(entry_cache_info, entry_info) + self.state.save(entry_info, entry_checksum) if progress_callback: progress_callback.update(entry_info.url) self._remove_redundant_files(path_info, dir_info, force) self.state.save_link(path_info) + self.state.save(path_info, checksum) def _remove_redundant_files(self, path_info, dir_info, force): existing_files = set(