diff --git a/bev/__version__.py b/bev/__version__.py index 1bebb74..350cbe9 100644 --- a/bev/__version__.py +++ b/bev/__version__.py @@ -1 +1 @@ -__version__ = "0.11.3" +__version__ = "0.11.4" diff --git a/bev/cli/pull.py b/bev/cli/pull.py index 36318ce..f44d0c0 100644 --- a/bev/cli/pull.py +++ b/bev/cli/pull.py @@ -6,6 +6,7 @@ import typer from rich.progress import track +from tarn.utils import value_to_buffer from typing_extensions import Annotated from ..exceptions import HashError @@ -130,7 +131,12 @@ def save_hash(value, file, repo, fetch): f.write(value) +def copy_value(value, file): + with value_to_buffer(value) as f, open(file, 'wb') as file: + shutil.copyfileobj(f, file) + + PULL_MODES = { - PullMode.copy: lambda h, dst, repo, fetch: repo.storage.read(shutil.copyfile, h, dst, fetch=fetch), + PullMode.copy: lambda h, dst, repo, fetch: repo.storage.read(copy_value, h, dst, fetch=fetch), PullMode.hash: save_hash, } diff --git a/bev/interface.py b/bev/interface.py index 0165037..2d18111 100644 --- a/bev/interface.py +++ b/bev/interface.py @@ -15,6 +15,7 @@ from .vc import VC, CommittedVersion, SubprocessGit, Version from .wc import BevLocalGlob, BevVCGlob + _NoArg = object() @@ -139,7 +140,7 @@ def _resolve(path): raise NameConflict(f'Both the path "{relative}" and its hash "{to_hash(relative)}" found') return absolute.resolve() - key = self.get_key(relative, version=version, fetch=fetch) + key = self.get_key(*parts, version=version, fetch=fetch) return self.storage.read(_resolve, key, fetch=fetch) def glob(self, *parts: PathOrStr, version: Optional[Version] = None,