repo: add basic cache_check_missing

This commit is contained in:
Ruslan Kuprieiev
2023-08-07 22:23:49 +03:00
parent 722839dda6
commit e35fb76dac
2 changed files with 26 additions and 0 deletions
+1
View File
@@ -93,6 +93,7 @@ class Repo:
from dvc.repo.status import status # type: ignore[misc]
from dvc.repo.update import update # type: ignore[misc]
from .cache import check_missing as cache_check_missing # type: ignore[misc]
from .data import status as data_status # type: ignore[misc]
ls = staticmethod(_ls)
+25
View File
@@ -0,0 +1,25 @@
import os
def check_missing(repo, rev=None):
from dvc_data.index import StorageKeyError
with repo.switch(rev or "workspace"):
index = repo.index.data["repo"]
def onerror(_entry, _exc):
pass
index.onerror = onerror
ret = []
for _, entry in index.iteritems():
try:
fs, path = index.storage_map.get_cache(entry)
except (StorageKeyError, ValueError):
continue
if not fs.exists(path):
ret.append(os.path.join(*entry.key))
return ret