From 15f074fd962e9ad1ce15867196b64ebc21adbe0b Mon Sep 17 00:00:00 2001 From: "Mr. Outis" Date: Wed, 15 May 2019 19:00:38 -0700 Subject: [PATCH] refactor: rely on RemoteBasic._changed_dir_cache Defining `_changed_cache_dir` for the sole purpose of executing code before `_changed_dir_cache` was not that clear. Now, it overwrites `_changed_dir_cache` but reference the base method. --- dvc/remote/base.py | 7 ------- dvc/remote/local/__init__.py | 7 +++++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/dvc/remote/base.py b/dvc/remote/base.py index 7ab579349..a597521ae 100644 --- a/dvc/remote/base.py +++ b/dvc/remote/base.py @@ -524,14 +524,7 @@ class RemoteBASE(object): return True - def _changed_cache_dir(self): - # NOTE: only implemented for RemoteLOCAL - return True - def _changed_dir_cache(self, checksum): - if not self._changed_cache_dir(): - return False - if self.changed_cache_file(checksum): return True diff --git a/dvc/remote/local/__init__.py b/dvc/remote/local/__init__.py index 4638f723a..117d50edf 100644 --- a/dvc/remote/local/__init__.py +++ b/dvc/remote/local/__init__.py @@ -495,7 +495,7 @@ class RemoteLOCAL(RemoteBASE): download=True, ) - def _changed_cache_dir(self): + def _changed_dir_cache(self, checksum): mtime, size = get_mtime_and_size(self.cache_dir) inode = get_inode(self.cache_dir) @@ -506,7 +506,10 @@ class RemoteLOCAL(RemoteBASE): else: changed = True - return changed + if not changed: + return False + + return super(RemoteLOCAL, self)._changed_dir_cache(checksum) def _log_missing_caches(self, checksum_info_dict): missing_caches = [