Skip to content

Commit

Permalink
push/fetch: respect --jobs on worktree push/fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
pmrowla committed Jan 9, 2023
1 parent 0e5674f commit c1ac943
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion dvc/repo/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def fetch(
all_tags=all_tags,
all_commits=all_commits,
targets=targets,
jobs=jobs,
with_deps=with_deps,
recursive=recursive,
)
Expand Down Expand Up @@ -181,6 +182,7 @@ def _fetch_worktree(
all_tags: bool = False,
all_commits: bool = False,
targets: Optional["TargetType"] = None,
jobs: Optional[int] = None,
**kwargs,
) -> int:
from dvc.repo.worktree import fetch_worktree
Expand All @@ -192,5 +194,7 @@ def _fetch_worktree(
all_tags=all_tags,
all_commits=all_commits,
):
downloaded += fetch_worktree(repo, remote, targets=targets, **kwargs)
downloaded += fetch_worktree(
repo, remote, targets=targets, jobs=jobs, **kwargs
)
return downloaded
4 changes: 3 additions & 1 deletion dvc/repo/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def push(
all_tags=all_tags,
all_commits=all_commits,
targets=expanded_targets,
jobs=jobs,
with_deps=with_deps,
recursive=recursive,
)
Expand Down Expand Up @@ -105,6 +106,7 @@ def _push_worktree(
all_tags: bool = False,
all_commits: bool = False,
targets: Optional["TargetType"] = None,
jobs: Optional[int] = None,
**kwargs,
) -> int:
from dvc.repo.worktree import push_worktree
Expand All @@ -114,4 +116,4 @@ def _push_worktree(
"Multiple rev push is unsupported for cloud versioned remotes"
)

return push_worktree(repo, remote, targets=targets, **kwargs)
return push_worktree(repo, remote, targets=targets, jobs=jobs, **kwargs)
5 changes: 4 additions & 1 deletion dvc/repo/worktree.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def fetch_worktree(
repo: "Repo",
remote: "Remote",
targets: Optional["TargetType"] = None,
jobs: Optional[int] = None,
**kwargs,
) -> int:
from dvc_data.index import save
Expand All @@ -91,13 +92,14 @@ def fetch_worktree(
unit="file", desc="Fetch", disable=total == 0
) as cb:
cb.set_size(total)
return save(index, callback=cb)
return save(index, callback=cb, jobs=jobs)


def push_worktree(
repo: "Repo",
remote: "Remote",
targets: Optional["TargetType"] = None,
jobs: Optional[int] = None,
**kwargs,
) -> int:
from dvc_data.index import checkout
Expand Down Expand Up @@ -139,6 +141,7 @@ def push_worktree(
delete=remote.worktree,
callback=cb,
latest_only=remote.worktree,
jobs=jobs,
**diff_kwargs,
)
if pushed:
Expand Down

0 comments on commit c1ac943

Please sign in to comment.