From 8910b38c0231c37b41ed2eb05415077f851a6322 Mon Sep 17 00:00:00 2001 From: Dominik Jain Date: Thu, 3 Jul 2025 12:14:39 +0200 Subject: [PATCH] Migrate config from old location only if no config at new location --- src/serena/config/serena_config.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/serena/config/serena_config.py b/src/serena/config/serena_config.py index 7c5ea64a..232afd27 100644 --- a/src/serena/config/serena_config.py +++ b/src/serena/config/serena_config.py @@ -247,11 +247,12 @@ class SerenaConfig: else: config_path = str(Path.home() / SERENA_MANAGED_DIR_NAME / cls.CONFIG_FILE) - # migrate configuration in old location - old_config_path = os.path.join(REPO_ROOT, cls.CONFIG_FILE) - if os.path.exists(old_config_path): - log.info(f"Moving Serena configuration file from {old_config_path} to {config_path}") - shutil.move(old_config_path, config_path) + # if the config file does not exist, check if we can migrate it from the old location + if not os.path.exists(config_path): + old_config_path = os.path.join(REPO_ROOT, cls.CONFIG_FILE) + if os.path.exists(old_config_path): + log.info(f"Moving Serena configuration file from {old_config_path} to {config_path}") + shutil.move(old_config_path, config_path) return config_path