From 003d14c21b779d6c2e0d99f80b4151404d358058 Mon Sep 17 00:00:00 2001
From: mario4tier <mario4tier@users.noreply.github.com>
Date: Tue, 19 Nov 2024 19:20:42 -0500
Subject: [PATCH] sync.py now shows if dev branch changes were pulled or not

---
 scripts/sync.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/scripts/sync.py b/scripts/sync.py
index b8e92465..deabf461 100755
--- a/scripts/sync.py
+++ b/scripts/sync.py
@@ -26,8 +26,20 @@ def main():
         run_command(['git', 'checkout', 'dev'])
         run_command(['git', 'stash', 'push', '-m', 'sync-script-stash'])
 
+        # Get the local dev commit hash before pulling
+        # This is later used to detect if any changes were pulled.
+        local_dev_commit_before = run_command(['git', 'rev-parse', 'dev'])
+
         # Pull the latest dev changes
         run_command(['git', 'pull', 'origin', 'dev'])
+
+        # Check if there were any changes pulled
+        local_dev_commit_after = run_command(['git', 'rev-parse', 'dev'])
+        if local_dev_commit_before == local_dev_commit_after:
+            print("No changes to merge from origin/dev")
+        else:
+            print("Pulled latest changes from origin/dev")
+
         # Apply the stashed changes
         stash_list = run_command(['git', 'stash', 'list'])
         if 'sync-script-stash' in stash_list:
@@ -49,7 +61,7 @@ def main():
         # Check if there are any changes from main that are not in dev
         diff_output = subprocess.run(['git', 'diff', '--quiet', merge_base, 'main'], stderr=subprocess.DEVNULL)
         if diff_output.returncode == 0:
-            print("No changes to merge from main to dev.")
+            print("No changes to merge from origin/main")
         else:
             # Perform the actual merge
             merge_output = subprocess.run(['git', 'merge', '--no-commit', '--no-ff', 'main'], stderr=subprocess.DEVNULL)