Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #39

Merged
merged 3 commits into from
Apr 8, 2024
Merged

Dev #39

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bev/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.11.3"
__version__ = "0.11.4"
8 changes: 7 additions & 1 deletion bev/cli/pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
}
3 changes: 2 additions & 1 deletion bev/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from .vc import VC, CommittedVersion, SubprocessGit, Version
from .wc import BevLocalGlob, BevVCGlob


_NoArg = object()


Expand Down Expand Up @@ -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,
Expand Down
Loading