From a9e0b67b7187474efe1272b3c294b6c1a3b75110 Mon Sep 17 00:00:00 2001 From: mannaandpoem <1580466765@qq.com> Date: Wed, 10 Jan 2024 14:13:48 +0800 Subject: [PATCH] update test_incremental_dev.py --- tests/metagpt/test_incremental_dev.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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")