From fbbe5af6061f1ea2917ac04c1e76e06b07e86baa Mon Sep 17 00:00:00 2001 From: Peter Rowlands Date: Wed, 22 Apr 2020 17:02:06 +0900 Subject: [PATCH 1/2] output: don't use PathInfo when collecting used dir cache --- dvc/output/base.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/dvc/output/base.py b/dvc/output/base.py index 2e555119cb..9bd66fdd5b 100644 --- a/dvc/output/base.py +++ b/dvc/output/base.py @@ -1,4 +1,5 @@ import logging +import os from urllib.parse import urlparse from copy import copy @@ -390,11 +391,17 @@ def _collect_used_dir_cache( else: return cache + path = str(self.path_info) + filter_path = str(filter_info) if filter_info else None for entry in self.dir_cache: checksum = entry[self.remote.PARAM_CHECKSUM] - info = self.path_info / entry[self.remote.PARAM_RELPATH] - if not filter_info or info.isin_or_eq(filter_info): - cache.add(self.scheme, checksum, str(info)) + entry_path = os.path.join(path, entry[self.remote.PARAM_RELPATH]) + if ( + not filter_path + or entry_path == filter_path + or entry_path.startswith(filter_path + os.sep) + ): + cache.add(self.scheme, checksum, entry_path) return cache From dce42b9ad3b149db151e975c09659547fdb08c17 Mon Sep 17 00:00:00 2001 From: Peter Rowlands Date: Thu, 23 Apr 2020 14:45:29 +0900 Subject: [PATCH 2/2] fix windows path handling --- dvc/output/base.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dvc/output/base.py b/dvc/output/base.py index 9bd66fdd5b..a539e18e7f 100644 --- a/dvc/output/base.py +++ b/dvc/output/base.py @@ -393,9 +393,13 @@ def _collect_used_dir_cache( path = str(self.path_info) filter_path = str(filter_info) if filter_info else None + is_win = os.name == "nt" for entry in self.dir_cache: checksum = entry[self.remote.PARAM_CHECKSUM] - entry_path = os.path.join(path, entry[self.remote.PARAM_RELPATH]) + entry_relpath = entry[self.remote.PARAM_RELPATH] + if is_win: + entry_relpath = entry_relpath.replace("/", os.sep) + entry_path = os.path.join(path, entry_relpath) if ( not filter_path or entry_path == filter_path