diff --git a/plugins/settings-repository/src/BaseRepositoryManager.kt b/plugins/settings-repository/src/BaseRepositoryManager.kt index 8d8ca968ebe0..35029871070e 100644 --- a/plugins/settings-repository/src/BaseRepositoryManager.kt +++ b/plugins/settings-repository/src/BaseRepositoryManager.kt @@ -130,7 +130,7 @@ abstract class BaseRepositoryManager(protected val dir: Path) : RepositoryManage */ protected abstract fun addToIndex(file: Path, path: String, content: ByteArray, size: Int) - override fun delete(path: String) { + override fun delete(path: String): Boolean { LOG.debug { "Remove $path"} lock.write { @@ -138,8 +138,11 @@ abstract class BaseRepositoryManager(protected val dir: Path) : RepositoryManage // delete could be called for non-existent file if (file.exists()) { delete(file, path) + return true } } + + return false } private fun delete(file: Path, path: String) { diff --git a/plugins/settings-repository/src/IcsManager.kt b/plugins/settings-repository/src/IcsManager.kt index 7e6217b1ed84..568156f900d7 100644 --- a/plugins/settings-repository/src/IcsManager.kt +++ b/plugins/settings-repository/src/IcsManager.kt @@ -242,23 +242,26 @@ class IcsApplicationLoadListener : ApplicationLoadListener { val repositoryManager = icsManager.repositoryManager if (repositoryManager.isRepositoryExists() && repositoryManager is GitRepositoryManager) { - if (repositoryManager.renameDirectory(linkedMapOf( - Pair("\$ROOT_CONFIG$", null), - Pair("_mac/\$ROOT_CONFIG$", "_mac"), - Pair("_windows/\$ROOT_CONFIG$", "_windows"), - Pair("_linux/\$ROOT_CONFIG$", "_linux"), - Pair("_freebsd/\$ROOT_CONFIG$", "_freebsd"), - Pair("_unix/\$ROOT_CONFIG$", "_unix"), - Pair("_unknown/\$ROOT_CONFIG$", "_unknown"), + val migrateSchemes = repositoryManager.renameDirectory(linkedMapOf( + Pair("\$ROOT_CONFIG$", null), + Pair("_mac/\$ROOT_CONFIG$", "_mac"), + Pair("_windows/\$ROOT_CONFIG$", "_windows"), + Pair("_linux/\$ROOT_CONFIG$", "_linux"), + Pair("_freebsd/\$ROOT_CONFIG$", "_freebsd"), + Pair("_unix/\$ROOT_CONFIG$", "_unix"), + Pair("_unknown/\$ROOT_CONFIG$", "_unknown"), - Pair("\$APP_CONFIG$", null), - Pair("_mac/\$APP_CONFIG$", "_mac"), - Pair("_windows/\$APP_CONFIG$", "_windows"), - Pair("_linux/\$APP_CONFIG$", "_linux"), - Pair("_freebsd/\$APP_CONFIG$", "_freebsd"), - Pair("_unix/\$APP_CONFIG$", "_unix"), - Pair("_unknown/\$APP_CONFIG$", "_unknown") - ))) { + Pair("\$APP_CONFIG$", null), + Pair("_mac/\$APP_CONFIG$", "_mac"), + Pair("_windows/\$APP_CONFIG$", "_windows"), + Pair("_linux/\$APP_CONFIG$", "_linux"), + Pair("_freebsd/\$APP_CONFIG$", "_freebsd"), + Pair("_unix/\$APP_CONFIG$", "_unix"), + Pair("_unknown/\$APP_CONFIG$", "_unknown") + )) + + val removeOtherXml = repositoryManager.delete("other.xml") + if (migrateSchemes || removeOtherXml) { // schedule push to avoid merge conflicts application.invokeLater({ icsManager.autoSyncManager.autoSync(force = true) }) } diff --git a/plugins/settings-repository/src/RepositoryManager.kt b/plugins/settings-repository/src/RepositoryManager.kt index 223471a6014f..c743e6ae9de1 100644 --- a/plugins/settings-repository/src/RepositoryManager.kt +++ b/plugins/settings-repository/src/RepositoryManager.kt @@ -46,7 +46,7 @@ interface RepositoryManager { */ fun write(path: String, content: ByteArray, size: Int): Boolean - fun delete(path: String) + fun delete(path: String): Boolean fun processChildren(path: String, filter: (name: String) -> Boolean, processor: (name: String, inputStream: InputStream) -> Boolean)