diff --git a/platform/diff-impl/src/com/intellij/openapi/vcs/ex/DocumentTracker.kt b/platform/diff-impl/src/com/intellij/openapi/vcs/ex/DocumentTracker.kt index fbeca8817b57..c207298c581b 100644 --- a/platform/diff-impl/src/com/intellij/openapi/vcs/ex/DocumentTracker.kt +++ b/platform/diff-impl/src/com/intellij/openapi/vcs/ex/DocumentTracker.kt @@ -184,7 +184,7 @@ class DocumentTracker : Disposable { } } - private fun updateFrozenContentIfNeeded() { + fun updateFrozenContentIfNeeded() { // ensure blocks are up to date updateFrozenContentIfNeeded(Side.LEFT) updateFrozenContentIfNeeded(Side.RIGHT) diff --git a/platform/diff-impl/src/com/intellij/openapi/vcs/ex/LineStatusTrackerBase.kt b/platform/diff-impl/src/com/intellij/openapi/vcs/ex/LineStatusTrackerBase.kt index f2e476333cec..73c6806238f2 100644 --- a/platform/diff-impl/src/com/intellij/openapi/vcs/ex/LineStatusTrackerBase.kt +++ b/platform/diff-impl/src/com/intellij/openapi/vcs/ex/LineStatusTrackerBase.kt @@ -94,6 +94,11 @@ abstract class LineStatusTrackerBase { @CalledInAwt fun setBaseRevision(vcsContent: CharSequence) { + setBaseRevision(vcsContent, null) + } + + @CalledInAwt + protected fun setBaseRevision(vcsContent: CharSequence, beforeUnfreeze: (() -> Unit)?) { application.assertIsDispatchThread() if (isReleased) return @@ -101,6 +106,8 @@ abstract class LineStatusTrackerBase { updateDocument(Side.LEFT) { vcsDocument.setText(vcsContent) } + + beforeUnfreeze?.invoke() } if (!isInitialized) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/PartialLocalLineStatusTracker.kt b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/PartialLocalLineStatusTracker.kt index 66411bd141af..2da1ecef5e62 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/PartialLocalLineStatusTracker.kt +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/PartialLocalLineStatusTracker.kt @@ -144,15 +144,21 @@ class PartialLocalLineStatusTracker(project: Project, @CalledInAwt fun setBaseRevision(vcsContent: CharSequence, changelistId: String?) { - currentMarker = if (changelistId != null) ChangeListMarker(changelistId) else null - try { - setBaseRevision(vcsContent) - dropExistingUndoActions() - } - finally { - currentMarker = null + setBaseRevision(vcsContent) { + if (changelistId != null) { + changeListManager.executeUnderDataLock { + if (changeListManager.getChangeList(changelistId) != null) { + documentTracker.writeLock { + currentMarker = ChangeListMarker(changelistId) + documentTracker.updateFrozenContentIfNeeded() + currentMarker = null + } + } + } + } } + dropExistingUndoActions() if (isValid()) eventDispatcher.multicaster.onBecomingValid(this) }