update test_incremental_dev.py

This commit is contained in:
mannaandpoem 2024-01-10 14:13:48 +08:00
parent 7a5485bc8b
commit a9e0b67b71

View file

@ -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")