From f7dd35e7b863aac05b83a18b9e712937df94316c Mon Sep 17 00:00:00 2001 From: Freddie Akeroyd Date: Sun, 19 Jan 2025 20:45:59 +0000 Subject: [PATCH 1/2] Set upstream on all local branches --- .../ibex_install_utils/tasks/git_tasks.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/installation_and_upgrade/ibex_install_utils/tasks/git_tasks.py b/installation_and_upgrade/ibex_install_utils/tasks/git_tasks.py index 7ee7759..8e94971 100644 --- a/installation_and_upgrade/ibex_install_utils/tasks/git_tasks.py +++ b/installation_and_upgrade/ibex_install_utils/tasks/git_tasks.py @@ -41,10 +41,27 @@ 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}") + # 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) From 3e693b4cc17c2071c97eb31676e125e277099c01 Mon Sep 17 00:00:00 2001 From: Freddie Akeroyd Date: Sun, 19 Jan 2025 21:00:05 +0000 Subject: [PATCH 2/2] Add extra git status --- .../ibex_install_utils/tasks/git_tasks.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/installation_and_upgrade/ibex_install_utils/tasks/git_tasks.py b/installation_and_upgrade/ibex_install_utils/tasks/git_tasks.py index 8e94971..d749fc9 100644 --- a/installation_and_upgrade/ibex_install_utils/tasks/git_tasks.py +++ b/installation_and_upgrade/ibex_install_utils/tasks/git_tasks.py @@ -45,6 +45,12 @@ def checkout_to_release_branch(self) -> None: except subprocess.CalledProcessError as e: print(f"Error fetching 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}") + # this sets upstream tracking on all local branches not just current one try: subprocess.check_call(