From 21b80d0c0624f07dffd5b1b2436675ccc4bd9bab Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Fri, 17 Nov 2023 15:48:59 -0800 Subject: [PATCH] aider: Added logging to print out the commit hashes for `local_main` and `origin_main` before the comparison to diagnose the issue with the script reporting that the main branch is not up to date with `origin/main` even though it is. # Aider chat conversation: USER: it's printing Error: The main branch is not up to date with origin/main. even though main is up to date with origin/main ASSISTANT: To address the issue you're experiencing with the script reporting that the main branch is not up to date with `origin/main` even though it is, we should add additional logging to the script to help diagnose the problem. We can print out the commit hashes for `local_main` and `origin_main` before the comparison to see what the script is actually getting from the `git` commands. Let's modify the `scripts/versionbump.py` file to add this logging. Here is the *SEARCH/REPLACE* block: scripts/versionbump.py ```python <<<<<<< SEARCH local_main = subprocess.run(["git", "rev-parse", "main"], capture_output=True, text=True).stdout.strip() origin_main = subprocess.run(["git", "rev-parse", "origin/main"], capture_output=True, text=True).stdout.strip() if local_main != origin_main: print("Error: The main branch is not up to date with origin/main.") ======= local_main = subprocess.run(["git", "rev-parse", "main"], capture_output=True, text=True).stdout.strip() print(f"Local main commit hash: {local_main}") origin_main = subprocess.run(["git", "rev-parse", "origin/main"], capture_output=True, text=True).stdout.strip() print(f"Origin main commit hash: {origin_main}") if local_main != origin_main: print("Error: The main branch is not up to date with origin/main. Please pull the latest changes.") >>>>>>> REPLACE ``` This change will print out the commit hashes for both `local_main` and `origin_main` before the script checks if they are the same. This should help you diagnose why the script thinks the branches are not in sync. If the hashes are indeed the same, but the script still reports an error, it could be an issue with the script's logic or the environment in which it's being run. --- scripts/versionbump.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/versionbump.py b/scripts/versionbump.py index 9924d2286..76ff07699 100755 --- a/scripts/versionbump.py +++ b/scripts/versionbump.py @@ -32,9 +32,11 @@ def main(): def check_main_branch_up_to_date(): subprocess.run(["git", "fetch", "origin"], check=True) local_main = subprocess.run(["git", "rev-parse", "main"], capture_output=True, text=True).stdout.strip() + print(f"Local main commit hash: {local_main}") origin_main = subprocess.run(["git", "rev-parse", "origin/main"], capture_output=True, text=True).stdout.strip() + print(f"Origin main commit hash: {origin_main}") if local_main != origin_main: - print("Error: The main branch is not up to date with origin/main.") + print("Error: The main branch is not up to date with origin/main. Please pull the latest changes.") sys.exit(1) args = parser.parse_args()