From 0c96a93f31c1d44558c90f55ff6a2941b109eead Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Tue, 6 Feb 2018 14:03:45 +0200 Subject: [PATCH] output: move debug msg to changed() method Signed-off-by: Ruslan Kuprieiev --- dvc/output.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/dvc/output.py b/dvc/output.py index 4f0bbf1a8..b602cd7e3 100644 --- a/dvc/output.py +++ b/dvc/output.py @@ -172,16 +172,24 @@ class Output(Dependency): return [cls.loads(project, x, use_cache=use_cache, cwd=cwd) for x in s_list] def changed(self): - if not self.use_cache: - return super(Output, self).changed() + ret = True - if os.path.exists(self.path) and \ + if not self.use_cache: + ret = super(Output, self).changed() + elif os.path.exists(self.path) and \ os.path.exists(self.cache) and \ System.samefile(self.path, self.cache) and \ os.stat(self.cache).st_mode & stat.S_IREAD: - return False + ret = False - return True + msg = "Data {} with cache {} " + if ret: + msg += "changed" + else: + msg += "didn't change" + self.project.logger.debug(msg.format(self.path, self.cache)) + + return ret def hardlink(self, src, link): self.project.logger.debug("creating hardlink {} -> {}".format(src, link)) @@ -207,7 +215,7 @@ class Output(Dependency): self.project.logger.debug("Checking out {} with cache {}".format(self.path, self.cache)) if not self.changed(): - msg = "Data {} with cache {} didn't change" + msg = "Data {} with cache {} didn't change, skipping checkout." self.project.logger.debug(msg.format(self.path, self.cache)) return @@ -246,9 +254,7 @@ class Output(Dependency): raise CmdOutputAlreadyTrackedError(self.rel_path) if not self.changed(): - msg = "Data {} with cache {} didn't change" - self.project.logger.debug(msg.format(self.path, self.cache)) - return + return if os.path.exists(self.cache): # This means that we already have cache for this data.