Skip to content

Commit

Permalink
repo: drop_data_index: delete all first level nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
efiop committed Nov 13, 2023
1 parent 8d23a5e commit e9f2da4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions dvc/repo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,11 @@ def data_index(self) -> "DataIndex":
return self._data_index

def drop_data_index(self) -> None:
try:
self.data_index.delete_node(("tree",))
except KeyError:
pass
for key in self.data_index.ls((), detail=False):
try:
self.data_index.delete_node(key)
except KeyError:
pass
self.data_index.commit()
self._reset()

Expand Down Expand Up @@ -626,7 +627,7 @@ def site_cache_dir(self) -> str:
# components were changed (useful to prevent newer dvc versions from
# using older broken cache). Please reset this back to 0 if other parts
# of the token components are changed.
salt = 1
salt = 2

# NOTE: This helps us avoid accidentally reusing cache for repositories
# that just happened to be at the same path as old deleted ones.
Expand Down

0 comments on commit e9f2da4

Please sign in to comment.