remove other.xml if was added by incorrect component roaming type

This commit is contained in:
Vladimir Krivosheev
2016-07-12 13:54:26 +02:00
parent 56f6f05c95
commit bd99bd6180
3 changed files with 24 additions and 18 deletions
@@ -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) {
+19 -16
View File
@@ -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) })
}
@@ -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)