Skip to content

Commit

Permalink
add: fail loudly if there's no dir cache (iterative#9466)
Browse files Browse the repository at this point in the history
  • Loading branch information
skshetry authored May 17, 2023
1 parent 83ffb88 commit 99daf5d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions dvc/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -1222,10 +1222,12 @@ def unstage(self, path: str) -> Tuple["Meta", "Tree"]:
assert isinstance(self.fs.path, Path)
rel_key = tuple(self.fs.path.parts(self.fs.path.relpath(path, self.fs_path)))

if not self.hash_info:
tree = Tree()
if self.hash_info:
tree = self.get_dir_cache()
if tree is None:
raise DvcException(f"could not read {self.hash_info.value!r}")
else:
tree = self.get_dir_cache() or Tree()
tree = Tree()

trie = tree.as_trie()
assert isinstance(trie, Trie)
Expand Down Expand Up @@ -1257,10 +1259,12 @@ def apply(
append_only = True
rel_key = tuple(self.fs.path.parts(self.fs.path.relpath(path, self.fs_path)))

if not self.hash_info:
tree = Tree()
if self.hash_info:
tree = self.get_dir_cache()
if tree is None:
raise DvcException(f"could not read {self.hash_info.value!r}")
else:
tree = self.get_dir_cache() or Tree()
tree = Tree()

trie = tree.as_trie()
assert isinstance(trie, Trie)
Expand Down

0 comments on commit 99daf5d

Please sign in to comment.