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

OPT: Avoid multiple calls to git-push with multiple refspecs #4692

Merged
merged 1 commit into from
Jul 13, 2020
Merged
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
14 changes: 5 additions & 9 deletions datalad/core/distributed/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,15 +668,11 @@ def _push(dspath, content, target, data, force, jobs, res_kwargs, pbars,


def _push_refspecs(repo, target, refspecs, force_git_push, res_kwargs):
# TODO inefficient, but push only takes a single refspec at a time
# at the moment, enhance GitRepo.push() to do all at once
push_res = []
for refspec in refspecs:
push_res.extend(repo.push(
remote=target,
refspec=refspec,
git_options=['--force'] if force_git_push else None,
))
push_res = repo.push(
remote=target,
refspec=refspecs,
git_options=['--force'] if force_git_push else None,
)
# TODO maybe compress into a single message whenever everything is
# OK?
for pr in push_res:
Expand Down
8 changes: 4 additions & 4 deletions datalad/support/gitrepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2249,8 +2249,8 @@ def fetch(self, remote=None, refspec=None, all_=False, git_options=None,
remote : str, optional
name of the remote to fetch from. If no remote is given and
`all_` is not set, the tracking branch is fetched.
refspec : str, optional
refspec to fetch.
refspec : str or list, optional
refspec(s) to fetch.
all_ : bool, optional
fetch all remotes (and all of their branches).
Fails if `remote` was given.
Expand Down Expand Up @@ -2351,8 +2351,8 @@ def push(self, remote=None, refspec=None, all_remotes=False,
remote : str, optional
name of the remote to push to. If no remote is given and
`all_` is not set, the tracking branch is pushed.
refspec : str, optional
refspec to push.
refspec : str or list, optional
refspec(s) to push.
all_ : bool, optional
push to all remotes. Fails if `remote` was given.
git_options : list, optional
Expand Down