Merge pull request #1080 from efiop/master

state: don't forget subdirs when computing effective mtime
This commit is contained in:
Ruslan Kuprieiev
2018-09-01 15:56:36 +03:00
committed by GitHub
2 changed files with 11 additions and 3 deletions
+3 -3
View File
@@ -99,9 +99,9 @@ class State(object):
mtime = os.path.getmtime(path)
if os.path.isdir(path):
for root, dirs, files in os.walk(path):
for fname in files:
f = os.path.join(root, fname)
m = os.path.getmtime(f)
for entry in list(dirs) + list(files):
p = os.path.join(root, entry)
m = os.path.getmtime(p)
if m > mtime:
mtime = m
+8
View File
@@ -18,6 +18,7 @@ from dvc.project import Project, ReproductionError
from dvc.utils import file_md5
from dvc.remote.local import RemoteLOCAL
from dvc.stage import Stage, StageFileDoesNotExistError
from dvc.system import System
from tests.basic_env import TestDvc
from tests.test_data_cloud import _should_test_aws, TEST_AWS_REPO_BUCKET
@@ -296,6 +297,13 @@ class TestReproChangedDirData(TestDvc):
self.assertEqual(len(stages), 1)
self.assertTrue(stages[0] is not None)
# Check that dvc registers mtime change for the directory.
System.hardlink(self.DATA_SUB, self.DATA_SUB + '.lnk')
sleep()
stages = self.dvc.reproduce(stage.path)
self.assertEqual(len(stages), 1)
self.assertTrue(stages[0] is not None)
class TestReproMissingMd5InStageFile(TestRepro):
def test(self):