diff --git a/dvc/remote/local/__init__.py b/dvc/remote/local/__init__.py index 117d50edf..25bf1d425 100644 --- a/dvc/remote/local/__init__.py +++ b/dvc/remote/local/__init__.py @@ -38,8 +38,6 @@ from dvc.exceptions import DvcException from dvc.progress import progress from concurrent.futures import ThreadPoolExecutor -from dvc.utils.fs import get_mtime_and_size, get_inode - logger = logging.getLogger(__name__) @@ -495,22 +493,6 @@ class RemoteLOCAL(RemoteBASE): download=True, ) - def _changed_dir_cache(self, checksum): - mtime, size = get_mtime_and_size(self.cache_dir) - inode = get_inode(self.cache_dir) - - existing_record = self.state.get_state_record_for_inode(inode) - if existing_record: - cached_mtime, cached_size, _, _ = existing_record - changed = not (mtime == cached_mtime and size == cached_size) - else: - changed = True - - if not changed: - return False - - return super(RemoteLOCAL, self)._changed_dir_cache(checksum) - def _log_missing_caches(self, checksum_info_dict): missing_caches = [ (md5, info) diff --git a/dvc/state.py b/dvc/state.py index 8e46b31cd..08dbab63c 100644 --- a/dvc/state.py +++ b/dvc/state.py @@ -269,8 +269,6 @@ class State(StateBase): # pylint: disable=too-many-instance-attributes ) ) - self._update_cache_directory_state() - self.database.commit() self.cursor.close() self.database.close() @@ -458,20 +456,3 @@ class State(StateBase): # pylint: disable=too-many-instance-attributes for relpath in unused: cmd = 'DELETE FROM {} WHERE path = "{}"' self._execute(cmd.format(self.LINK_STATE_TABLE, relpath)) - - def _update_cache_directory_state(self): - cache_path = self.repo.cache.local.cache_dir - mtime, size = get_mtime_and_size(cache_path) - inode = get_inode(cache_path) - - cmd = ( - "INSERT OR REPLACE INTO {}(inode, size, mtime, timestamp, md5) " - 'VALUES ({}, "{}", "{}", "{}", "")'.format( - self.STATE_TABLE, - self._to_sqlite(inode), - size, - mtime, - current_timestamp(), - ) - ) - self._execute(cmd) diff --git a/tests/func/test_add.py b/tests/func/test_add.py index 87a16ecf5..0105c93da 100644 --- a/tests/func/test_add.py +++ b/tests/func/test_add.py @@ -325,29 +325,6 @@ class TestAddCommit(TestDvc): self.assertEqual(len(os.listdir(self.dvc.cache.local.cache_dir)), 1) -class TestShouldNotCheckCacheForDirIfCacheMetadataDidNotChange(TestDvc): - def test(self): - remote_local_loader_spy = spy( - dvc.remote.local.RemoteLOCAL.load_dir_cache - ) - with patch.object( - dvc.remote.local.RemoteLOCAL, - "load_dir_cache", - remote_local_loader_spy, - ): - - ret = main(["config", "cache.type", "copy"]) - self.assertEqual(ret, 0) - - ret = main(["add", self.DATA_DIR]) - self.assertEqual(ret, 0) - self.assertEqual(1, remote_local_loader_spy.mock.call_count) - - ret = main(["status", "{}.dvc".format(self.DATA_DIR)]) - self.assertEqual(ret, 0) - self.assertEqual(1, remote_local_loader_spy.mock.call_count) - - class TestShouldCollectDirCacheOnlyOnce(TestDvc): def test(self): from dvc.remote.local import RemoteLOCAL