mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
Check dir changes properly. Close #491.
This commit is contained in:
+11
-3
@@ -195,14 +195,22 @@ class Output(Dependency):
|
||||
if not os.path.isdir(self.path) or not os.path.isfile(self.cache):
|
||||
return True
|
||||
|
||||
dir_info = self._collect_dir()
|
||||
dir_info_cached = self.load_dir_cache(self.cache)
|
||||
dir_info = self._collect_dir() # slow!
|
||||
dir_info_cached = self.load_dir_cache(self.cache) # slow. why?
|
||||
|
||||
if dir_info != dir_info_cached:
|
||||
if not self.are_dir_info_equal(dir_info, dir_info_cached):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def are_dir_info_equal(dir_info1, dir_info2):
|
||||
return Output.dir_info_dict(dir_info1) == Output.dir_info_dict(dir_info2)
|
||||
|
||||
@staticmethod
|
||||
def dir_info_dict(dir_info):
|
||||
return {i['relpath']: i['md5'] for i in dir_info}
|
||||
|
||||
def changed(self):
|
||||
ret = True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user