From 0b46fc25fb44a7690e73978d25fe75e5796e3220 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Sun, 7 Jan 2018 00:54:09 -0800 Subject: [PATCH] Bugfix: checkout - handle files with missing caches --- dvc/stage.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dvc/stage.py b/dvc/stage.py index dcad68e9b..667164878 100644 --- a/dvc/stage.py +++ b/dvc/stage.py @@ -125,7 +125,12 @@ class Output(object): def checkout(self): if not self.use_cache: return - self.link(checkout=True) + if not os.path.exists(self.cache): + self.project.logger.warn(u'\'{}\': cache file not found'.format(self.dvc_path)) + if os.path.exists(self.path): + os.unlink(self.path) + else: + self.link(checkout=True) def mtime(self): return os.path.getmtime(self.path)