Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

update test_incremental_dev.py

mannaandpoema9e0b67b7187
diff --git a/tests/metagpt/test_incremental_dev.py b/tests/metagpt/test_incremental_dev.py
index e86e6d5ff..2ff33dff3 100644
--- a/tests/metagpt/test_incremental_dev.py
+++ b/tests/metagpt/test_incremental_dev.py
@@ -278,11 +278,11 @@ def check_or_create_base_tag(project_path):
if has_base_tag:
logger.info("Base tag exists")
# Switch to the 'base' branch if it exists
- stash_cmd = ["git", "stash"]
- switch_to_base_branch_cmd = ["git", "checkout", "-f", "base"]
try:
- subprocess.run(stash_cmd, check=True)
- subprocess.run(switch_to_base_branch_cmd, check=True)
+ status = subprocess.run(["git", "status", "-s"], capture_output=True, text=True).stdout.strip()
+ if status:
+ subprocess.run(["git", "clean", "-df"])
+ subprocess.run(["git", "checkout", "-f", "base"], check=True)
logger.info("Switched to base branch")
except Exception as e:
logger.error("Failed to switch to base branch")