mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 11:53:49 +07:00
[lvcs] make local history facade reachable only from local history to avoid unnecessary storage initialization (IJPL-161713)
GitOrigin-RevId: 45e43537051c0ddc484163242df573a3b7900b94
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8b44f407ee
commit
fa90432b6e
@@ -72,8 +72,6 @@ com.intellij.history.core.LabelImpl
|
||||
- a:getByteContent(com.intellij.history.core.tree.RootEntry,java.lang.String):com.intellij.history.ByteContent
|
||||
- a:getLabelChangeId():J
|
||||
c:com.intellij.history.core.LocalHistoryFacade
|
||||
- sf:Companion:com.intellij.history.core.LocalHistoryFacade$Companion
|
||||
- <init>():V
|
||||
- f:accept(com.intellij.history.core.changes.ChangeVisitor):V
|
||||
- f:addChangeInTests(com.intellij.history.core.changes.StructuralChange):V
|
||||
- f:addListener(com.intellij.history.core.LocalHistoryFacade$Listener,com.intellij.openapi.Disposable):V
|
||||
@@ -87,7 +85,6 @@ c:com.intellij.history.core.LocalHistoryFacade
|
||||
- bs:endChangeSet$default(com.intellij.history.core.LocalHistoryFacade,java.lang.String,com.intellij.history.ActivityId,I,java.lang.Object):V
|
||||
- f:forceBeginChangeSet():V
|
||||
- f:getChangeListInTests():com.intellij.history.core.ChangeList
|
||||
- sf:getInstance():com.intellij.history.core.LocalHistoryFacade
|
||||
- f:moved(java.lang.String,java.lang.String):V
|
||||
- f:putLabelInTests(com.intellij.history.core.changes.PutLabelChange):V
|
||||
- f:putSystemLabel(java.lang.String,java.lang.String,I):com.intellij.history.core.LabelImpl
|
||||
@@ -97,8 +94,6 @@ c:com.intellij.history.core.LocalHistoryFacade
|
||||
- f:renamed(java.lang.String,java.lang.String):V
|
||||
- f:revertUpToChange(com.intellij.history.core.tree.RootEntry,J,java.lang.String,Z,Z):java.lang.String
|
||||
- f:revertUpToChangeSet(com.intellij.history.core.tree.RootEntry,J,java.lang.String,Z,Z):java.lang.String
|
||||
f:com.intellij.history.core.LocalHistoryFacade$Companion
|
||||
- f:getInstance():com.intellij.history.core.LocalHistoryFacade
|
||||
a:com.intellij.history.core.LocalHistoryFacade$Listener
|
||||
- <init>():V
|
||||
- changeAdded(com.intellij.history.core.changes.Change):V
|
||||
@@ -452,6 +447,11 @@ pf:com.intellij.history.integration.IdeaGateway$VersionedFilterData
|
||||
f:com.intellij.history.integration.LocalHistoryBundle
|
||||
- s:message(java.lang.String,java.lang.Object[]):java.lang.String
|
||||
- s:messagePointer(java.lang.String,java.lang.Object[]):java.util.function.Supplier
|
||||
a:com.intellij.history.integration.LocalHistoryEx
|
||||
- com.intellij.history.LocalHistory
|
||||
- com.intellij.openapi.Disposable
|
||||
- <init>():V
|
||||
- a:getFacade():com.intellij.history.core.LocalHistoryFacade
|
||||
f:com.intellij.history.integration.revertion.DifferenceReverter
|
||||
- com.intellij.history.integration.revertion.Reverter
|
||||
- <init>(com.intellij.openapi.project.Project,com.intellij.history.core.LocalHistoryFacade,com.intellij.history.integration.IdeaGateway,java.util.List,com.intellij.history.core.revisions.Revision):V
|
||||
|
||||
@@ -81,7 +81,6 @@
|
||||
|
||||
<applicationService serviceInterface="com.intellij.history.LocalHistory"
|
||||
serviceImplementation="com.intellij.history.integration.LocalHistoryImpl"/>
|
||||
<applicationService serviceImplementation="com.intellij.history.core.LocalHistoryFacade"/>
|
||||
<applicationService serviceImplementation="com.intellij.history.integration.IdeaGateway"/>
|
||||
|
||||
<virtualFileManagerListener
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.intellij.history.integration.IdeaGateway
|
||||
import com.intellij.history.utils.LocalHistoryLog
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.application.PathManager
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.progress.ProcessCanceledException
|
||||
import com.intellij.openapi.progress.ProgressManager
|
||||
import com.intellij.openapi.project.Project
|
||||
@@ -19,31 +18,22 @@ import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.openapi.util.NlsContexts
|
||||
import com.intellij.psi.codeStyle.MinusculeMatcher
|
||||
import com.intellij.psi.codeStyle.NameUtil
|
||||
import com.intellij.util.application
|
||||
import com.intellij.util.containers.ContainerUtil
|
||||
import com.intellij.util.io.delete
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
import java.nio.file.Path
|
||||
|
||||
open class LocalHistoryFacade {
|
||||
open class LocalHistoryFacade internal constructor() {
|
||||
|
||||
private val storageDir: Path
|
||||
internal val storageDir: Path
|
||||
get() = Path.of(PathManager.getSystemPath(), "LocalHistory")
|
||||
|
||||
internal var changeList: ChangeList
|
||||
private set
|
||||
internal val changeList: ChangeList
|
||||
|
||||
init {
|
||||
changeList = ChangeList(createStorage())
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
internal fun reset() {
|
||||
storageDir.delete()
|
||||
changeList = ChangeList(createStorage())
|
||||
}
|
||||
|
||||
protected open fun createStorage(): ChangeListStorage {
|
||||
var storage: ChangeListStorage
|
||||
try {
|
||||
@@ -210,11 +200,6 @@ open class LocalHistoryFacade {
|
||||
open fun changeAdded(c: Change) = Unit
|
||||
open fun changeSetFinished(changeSet: ChangeSet) = Unit
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun getInstance(): LocalHistoryFacade = application.service()
|
||||
}
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.history.integration
|
||||
|
||||
import com.intellij.history.LocalHistory
|
||||
import com.intellij.history.core.LocalHistoryFacade
|
||||
import com.intellij.openapi.Disposable
|
||||
|
||||
abstract class LocalHistoryEx : LocalHistory(), Disposable {
|
||||
abstract val facade: LocalHistoryFacade?
|
||||
}
|
||||
@@ -24,6 +24,7 @@ import com.intellij.platform.lvcs.impl.RevisionId
|
||||
import com.intellij.platform.lvcs.impl.diff.findEntry
|
||||
import com.intellij.platform.lvcs.impl.operations.getRevertCommandName
|
||||
import com.intellij.util.SystemProperties
|
||||
import com.intellij.util.io.delete
|
||||
import kotlinx.coroutines.*
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
@@ -32,13 +33,13 @@ import kotlin.Throws
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
@ApiStatus.Internal
|
||||
class LocalHistoryImpl(private val coroutineScope: CoroutineScope) : LocalHistory(), Disposable {
|
||||
class LocalHistoryImpl(private val coroutineScope: CoroutineScope) : LocalHistoryEx() {
|
||||
companion object {
|
||||
private const val DAYS_TO_KEEP = "localHistory.daysToKeep"
|
||||
|
||||
/**
|
||||
* @see [LocalHistory.getInstance]
|
||||
* @see [LocalHistoryFacade.getInstance]
|
||||
* @see [LocalHistoryEx.facade]
|
||||
* @see [IdeaGateway.getInstance]
|
||||
*/
|
||||
@JvmStatic
|
||||
@@ -54,8 +55,7 @@ class LocalHistoryImpl(private val coroutineScope: CoroutineScope) : LocalHistor
|
||||
|
||||
private var isDisabled: Boolean = false
|
||||
|
||||
var facade: LocalHistoryFacade? = null
|
||||
private set
|
||||
override var facade: LocalHistoryFacade? = null
|
||||
|
||||
val gateway: IdeaGateway = IdeaGateway.getInstance()
|
||||
|
||||
@@ -114,7 +114,7 @@ class LocalHistoryImpl(private val coroutineScope: CoroutineScope) : LocalHistor
|
||||
}
|
||||
|
||||
private fun initHistory() {
|
||||
facade = LocalHistoryFacade.getInstance()
|
||||
facade = LocalHistoryFacade()
|
||||
eventDispatcher = LocalHistoryEventDispatcher(facade!!, gateway)
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ class LocalHistoryImpl(private val coroutineScope: CoroutineScope) : LocalHistor
|
||||
@TestOnly
|
||||
fun cleanupForNextTest() {
|
||||
doDispose()
|
||||
facade?.reset()
|
||||
facade?.storageDir?.delete()
|
||||
init()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user