Skip to content

Commit 192d62f

Browse files
authored
Move the creation of the mux connection further down the stacky (#38)
It allows to detect things like not synced branch or everything up to date without having to establish a connection. It would also allow eventually to deal with pre-push hooks
1 parent 1ff9ee6 commit 192d62f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/stacky/stacky.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,6 @@ def do_push(
858858
pr: bool = False,
859859
remote_name: str = "origin",
860860
):
861-
start_muxed_ssh(remote_name)
862861
if pr:
863862
load_pr_info_for_forest(forest)
864863
print_forest(forest)
@@ -937,8 +936,15 @@ def do_push(
937936
prefix = f'{val.split(":")[1].split("/")[0]}:'
938937
else:
939938
prefix = ""
939+
muxed = False
940940
for b, push, pr_action in actions:
941941
if push:
942+
if not muxed:
943+
start_muxed_ssh(remote_name)
944+
muxed = True
945+
# Try to run pre-push before muxing ...
946+
# To do so we need to pickup the current commit of the branch, the branch name, the
947+
# parent branch and it's parent commit and call .git/hooks/pre-push
942948
cout("Pushing {}\n", b.name, fg="green")
943949
run(
944950
CmdArgs(

0 commit comments

Comments
 (0)