Skip to content

Commit

Permalink
Merge pull request #219 from ISISComputingGroup/set_upstream_on_install
Browse files Browse the repository at this point in the history
Set upstream on all local branches
  • Loading branch information
Tom-Willemsen authored Jan 20, 2025
2 parents c44fbad + 3e693b4 commit eb2fa2e
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion installation_and_upgrade/ibex_install_utils/tasks/git_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def checkout_to_release_branch(self) -> None:

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

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

# this sets upstream tracking on all local branches not just current one
try:
subprocess.check_call(
f"cd /d {EPICS_PATH} && FOR /F \"delims=* \" %i IN ('git branch') "
"DO git branch --set-upstream-to=origin/%i %i",
shell=True,
)
print("Set branch upstream tracking")
except subprocess.CalledProcessError as e:
print(f"Error setting branch upstream tracking: {e}")

try:
subprocess.check_call(f"cd /d {EPICS_PATH} && git pull", shell=True)
print("Pulled current branch from remote")
except subprocess.CalledProcessError as e:
print(f"Error pulling from remote: {e}")

try:
# run a git status to rebuild index if needed
subprocess.check_call(f"cd /d {EPICS_PATH} && git status", shell=True)
except subprocess.CalledProcessError as e:
print(f"Error running git status: {e}")

try:
subprocess.check_call(
f"cd /d {EPICS_PATH} && git checkout -b %COMPUTERNAME%", shell=True
Expand Down

0 comments on commit eb2fa2e

Please sign in to comment.