Skip to content

Commit

Permalink
unprotect: add progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
skshetry committed Dec 11, 2023
1 parent 7c898cf commit 53e9ad6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion dvc/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,10 @@ def get_files_number(self, filter_info=None):

def unprotect(self):
if self.exists and self.use_cache:
self.cache.unprotect(self.fs_path)
with Callback.as_tqdm_callback(
size=self.meta.nfiles or -1, desc=f"Unprotecting {self}"
) as callback:
self.cache.unprotect(self.fs_path, callback=callback)

def get_dir_cache(self, **kwargs) -> Optional["Tree"]:
if not self.is_dir_checksum:
Expand Down
5 changes: 4 additions & 1 deletion dvc/repo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,10 @@ def init(root_dir=os.curdir, no_scm=False, force=False, subdir=False) -> "Repo":
return init(root_dir=root_dir, no_scm=no_scm, force=force, subdir=subdir)

def unprotect(self, target):
return self.cache.repo.unprotect(target)
from dvc_objects.fs.callbacks import Callback

with Callback.as_tqdm_callback(desc=f"Unprotecting {target}") as callback:
return self.cache.repo.unprotect(target, callback=callback)

def _ignore(self):
flist = [self.config.files["local"]]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dependencies = [
"configobj>=5.0.6",
"distro>=1.3",
"dpath<3,>=2.1.0",
"dvc-data>=2.22.6,<2.23.0",
"dvc-data>=2.23,<2.24",
"dvc-http>=2.29.0",
"dvc-render>=1.0.0,<2",
"dvc-studio-client>=0.17.1,<1",
Expand Down

0 comments on commit 53e9ad6

Please sign in to comment.