mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
disable nested progress bar during checkout (#9446)
This commit is contained in:
+9
-11
@@ -36,7 +36,7 @@ from dvc_objects.errors import ObjectFormatError
|
|||||||
|
|
||||||
from .annotations import ANNOTATION_FIELDS, ANNOTATION_SCHEMA, Annotation
|
from .annotations import ANNOTATION_FIELDS, ANNOTATION_SCHEMA, Annotation
|
||||||
from .fs import LocalFileSystem, RemoteMissingDepsError, Schemes, get_cloud_fs
|
from .fs import LocalFileSystem, RemoteMissingDepsError, Schemes, get_cloud_fs
|
||||||
from .fs.callbacks import DEFAULT_CALLBACK, Callback
|
from .fs.callbacks import DEFAULT_CALLBACK, Callback, TqdmCallback
|
||||||
from .utils import relpath
|
from .utils import relpath
|
||||||
from .utils.fs import path_isin
|
from .utils.fs import path_isin
|
||||||
|
|
||||||
@@ -276,6 +276,11 @@ class OutputIsIgnoredError(DvcException):
|
|||||||
super().__init__(f"Path '{match.file}' is ignored by\n{lines}")
|
super().__init__(f"Path '{match.file}' is ignored by\n{lines}")
|
||||||
|
|
||||||
|
|
||||||
|
class CheckoutCallback(TqdmCallback):
|
||||||
|
# disable branching for checkouts
|
||||||
|
branch = Callback.branch # type: ignore[assignment]
|
||||||
|
|
||||||
|
|
||||||
class Output:
|
class Output:
|
||||||
IS_DEPENDENCY = False
|
IS_DEPENDENCY = False
|
||||||
|
|
||||||
@@ -740,9 +745,7 @@ class Output:
|
|||||||
)
|
)
|
||||||
if relink:
|
if relink:
|
||||||
rel = self.fs.path.relpath(filter_info or self.fs_path)
|
rel = self.fs.path.relpath(filter_info or self.fs_path)
|
||||||
with Callback.as_tqdm_callback(
|
with CheckoutCallback(desc=f"Checking out {rel}", unit="files") as cb:
|
||||||
desc=f"Checking out {rel}", unit="files"
|
|
||||||
) as callback:
|
|
||||||
self._checkout(
|
self._checkout(
|
||||||
filter_info or self.fs_path,
|
filter_info or self.fs_path,
|
||||||
self.fs,
|
self.fs,
|
||||||
@@ -751,7 +754,7 @@ class Output:
|
|||||||
relink=True,
|
relink=True,
|
||||||
state=self.repo.state,
|
state=self.repo.state,
|
||||||
prompt=prompt.confirm,
|
prompt=prompt.confirm,
|
||||||
progress_callback=callback,
|
progress_callback=cb,
|
||||||
)
|
)
|
||||||
self.set_exec()
|
self.set_exec()
|
||||||
|
|
||||||
@@ -901,9 +904,6 @@ class Output:
|
|||||||
progress_callback.relative_update(inc)
|
progress_callback.relative_update(inc)
|
||||||
return super().relative_update(inc)
|
return super().relative_update(inc)
|
||||||
|
|
||||||
def branch(self, *args, **kwargs):
|
|
||||||
return progress_callback.branch(*args, **kwargs)
|
|
||||||
|
|
||||||
callback = CallbackProxy()
|
callback = CallbackProxy()
|
||||||
if not self.use_cache:
|
if not self.use_cache:
|
||||||
callback.relative_update(self.get_files_number(filter_info))
|
callback.relative_update(self.get_files_number(filter_info))
|
||||||
@@ -1357,9 +1357,7 @@ class Output:
|
|||||||
|
|
||||||
if relink:
|
if relink:
|
||||||
rel = self.fs.path.relpath(path)
|
rel = self.fs.path.relpath(path)
|
||||||
with Callback.as_tqdm_callback(
|
with CheckoutCallback(desc=f"Checking out {rel}", unit="files") as callback:
|
||||||
desc=f"Checking out {rel}", unit="files"
|
|
||||||
) as callback:
|
|
||||||
self._checkout(
|
self._checkout(
|
||||||
path,
|
path,
|
||||||
self.fs,
|
self.fs,
|
||||||
|
|||||||
Reference in New Issue
Block a user