From 41aee9a3b7abc7e11e95c2c3b8c0657bf66236d1 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Mon, 25 Oct 2021 16:01:23 +0300 Subject: [PATCH] localfs: use mtime/size/inode for checksum Currently it depends on the whole `info()` output, which has too much information that doesn't really matter. To check if file contents didn't change mtime, size, inode combo is enough. --- dvc/fs/local.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dvc/fs/local.py b/dvc/fs/local.py index 16867b620..a236bace9 100644 --- a/dvc/fs/local.py +++ b/dvc/fs/local.py @@ -39,7 +39,11 @@ class LocalFileSystem(BaseFileSystem): return os.path.lexists(path_info) def checksum(self, path_info) -> str: - return self.fs.checksum(path_info) + from fsspec.utils import tokenize + + st = os.stat(path_info) + + return str(int(tokenize([st.st_ino, st.st_mtime, st.st_size]), 16)) def isfile(self, path_info) -> bool: return os.path.isfile(path_info)