Compare commits

...
2 Commits
Author SHA1 Message Date
Ruslan Kuprieiev f4c0946f65 repo: cache: support some view options 2023-08-08 01:09:50 +03:00
Ruslan Kuprieiev e35fb76dac repo: add basic cache_check_missing 2023-08-07 22:23:49 +03:00
2 changed files with 32 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)
+31
View File
@@ -0,0 +1,31 @@
import os
def check_missing(repo, rev=None, max_size=None, types=None):
from dvc_data.index import StorageKeyError
with repo.switch(rev or "workspace"):
idx = repo.index.targets_view(
None,
max_size=max_size,
types=types,
)
index = idx.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