From 3c31234151070e5e9a1fdafd49caf96a6f3a4363 Mon Sep 17 00:00:00 2001 From: skshetry <18718008+skshetry@users.noreply.github.com> Date: Tue, 12 Dec 2023 09:47:35 +0545 Subject: [PATCH] unprotect: add progress bar (#10152) * unprotect: add progress bar * Update pyproject.toml --- dvc/output.py | 5 ++++- dvc/repo/__init__.py | 5 ++++- pyproject.toml | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dvc/output.py b/dvc/output.py index a7278ce69..59f384057 100644 --- a/dvc/output.py +++ b/dvc/output.py @@ -1092,7 +1092,10 @@ class Output: 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: diff --git a/dvc/repo/__init__.py b/dvc/repo/__init__.py index 804d5a25b..f51ec4d34 100644 --- a/dvc/repo/__init__.py +++ b/dvc/repo/__init__.py @@ -447,7 +447,10 @@ class 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"]] diff --git a/pyproject.toml b/pyproject.toml index b6fb76835..5c498d351 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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.1,<2.24", "dvc-http>=2.29.0", "dvc-render>=1.0.0,<2", "dvc-studio-client>=0.17.1,<1",