Skip to content

Commit eb2fa2e

Browse files
Merge pull request #219 from ISISComputingGroup/set_upstream_on_install
Set upstream on all local branches
2 parents c44fbad + 3e693b4 commit eb2fa2e

File tree

1 file changed

+24
-1
lines changed
  • installation_and_upgrade/ibex_install_utils/tasks

1 file changed

+24
-1
lines changed

installation_and_upgrade/ibex_install_utils/tasks/git_tasks.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def checkout_to_release_branch(self) -> None:
4141

4242
try:
4343
subprocess.check_call(f"cd /d {EPICS_PATH} && git fetch", shell=True)
44-
print("Fetched remote")
44+
print("Fetching from remote")
4545
except subprocess.CalledProcessError as e:
4646
print(f"Error fetching remote: {e}")
4747

@@ -51,6 +51,29 @@ def checkout_to_release_branch(self) -> None:
5151
except subprocess.CalledProcessError as e:
5252
print(f"Error running git status: {e}")
5353

54+
# this sets upstream tracking on all local branches not just current one
55+
try:
56+
subprocess.check_call(
57+
f"cd /d {EPICS_PATH} && FOR /F \"delims=* \" %i IN ('git branch') "
58+
"DO git branch --set-upstream-to=origin/%i %i",
59+
shell=True,
60+
)
61+
print("Set branch upstream tracking")
62+
except subprocess.CalledProcessError as e:
63+
print(f"Error setting branch upstream tracking: {e}")
64+
65+
try:
66+
subprocess.check_call(f"cd /d {EPICS_PATH} && git pull", shell=True)
67+
print("Pulled current branch from remote")
68+
except subprocess.CalledProcessError as e:
69+
print(f"Error pulling from remote: {e}")
70+
71+
try:
72+
# run a git status to rebuild index if needed
73+
subprocess.check_call(f"cd /d {EPICS_PATH} && git status", shell=True)
74+
except subprocess.CalledProcessError as e:
75+
print(f"Error running git status: {e}")
76+
5477
try:
5578
subprocess.check_call(
5679
f"cd /d {EPICS_PATH} && git checkout -b %COMPUTERNAME%", shell=True

0 commit comments

Comments
 (0)