From de5aca14a918fc6166ade7b975d6e9de151bf239 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 24 Jul 2021 12:51:40 -0700 Subject: [PATCH] Let gitcheckup push to all remotes. --- gitcheckup.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/gitcheckup.py b/gitcheckup.py index e1b2711..ebb406e 100644 --- a/gitcheckup.py +++ b/gitcheckup.py @@ -54,6 +54,7 @@ import sys from voussoirkit import betterhelp from voussoirkit import dotdict from voussoirkit import pathclass +from voussoirkit import subproctools from voussoirkit import vlogging from voussoirkit import winwhich @@ -177,10 +178,25 @@ def git_pull(): command = [GIT, 'pull', '--all'] return check_output(command) -def git_push(): +def git_push_all(): + remotes = git_remotes() + branch = git_current_branch() + for remote in remotes: + git_push(remote, branch) + +def git_push(remote=None, branch=None): command = [GIT, 'push'] + if remote: + command.append(remote) + if branch: + command.append(branch) return check_output(command) +def git_remotes(): + command = [GIT, 'remote'] + remotes = check_output(command).splitlines() + return remotes + def git_rev_parse(rev): command = [GIT, 'rev-parse', rev] return check_output(command) @@ -278,7 +294,7 @@ def gitcheckup( git_pull() if do_push: - git_push() + git_push_all() commit_details = checkup_committed() push_details = checkup_pushed()