mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
repo: add basic cache_check_missing
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user