Skip to content
Snippets Groups Projects
Commit 4db95754 authored by r.jaepel's avatar r.jaepel
Browse files

Push to all remotes by default on .push()

parent 157d8a7c
No related branches found
No related tags found
No related merge requests found
...@@ -391,17 +391,20 @@ class BaseRepo: ...@@ -391,17 +391,20 @@ class BaseRepo:
if remote is None: if remote is None:
if len(self._git_repo.remotes) == 0: if len(self._git_repo.remotes) == 0:
raise RuntimeError("No remote has been set for this repository yet.") raise RuntimeError("No remote has been set for this repository yet.")
remote = [str(remote.name) for remote in self._git_repo.remotes][0] remote_list = [str(remote.name) for remote in self._git_repo.remotes]
else:
remote_list = [remote]
remote_interface = self._git_repo.remotes[remote] for remote in remote_list:
remote_interface = self._git_repo.remotes[remote]
if push_all: if push_all:
push_results = remote_interface.push(all=True) push_results = remote_interface.push(all=True)
else: else:
push_results = remote_interface.push(refspec=f'{local_branch}:{remote_branch}') push_results = remote_interface.push(refspec=f'{local_branch}:{remote_branch}')
for push_res in push_results: for push_res in push_results:
print(push_res.summary) print(push_res.summary)
if hasattr(self, "output_repo") and push_all: if hasattr(self, "output_repo") and push_all:
self.output_repo.push() self.output_repo.push()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment