mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-348926 git: better handle changelists during unshelve with an unfinished CLM refresh in progress
Fix the case when the file modification inside 'computeUnderChangeListSync' is picked up by an prior-started CLM refresh, and is being processed before the 'setDefaultList' command reaches the updater ChangeListWorker(myMainWorker = false). GitOrigin-RevId: d95c2a0fb5bd3e9821365e93eb00964ff33692c8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
29216b28d7
commit
f23467a1be
@@ -157,6 +157,7 @@ object PartialChangesUtil {
|
||||
val changeListManager = ChangeListManagerEx.getInstanceEx(project)
|
||||
val oldDefaultList = changeListManager.defaultChangeList
|
||||
if (targetChangeList == null ||
|
||||
targetChangeList == oldDefaultList ||
|
||||
!changeListManager.areChangeListsEnabled()) {
|
||||
if (targetChangeList != null) {
|
||||
LOG.debug("Active changelist unchanged: ${targetChangeList.name}")
|
||||
@@ -164,6 +165,8 @@ object PartialChangesUtil {
|
||||
return task.compute()
|
||||
}
|
||||
|
||||
waitForChangeListManagerUpdate(project)
|
||||
|
||||
switchChangeList(changeListManager, targetChangeList, oldDefaultList)
|
||||
val clmConflictTracker = ChangelistConflictTracker.getInstance(project)
|
||||
try {
|
||||
@@ -172,16 +175,20 @@ object PartialChangesUtil {
|
||||
}
|
||||
finally {
|
||||
clmConflictTracker.setIgnoreModifications(false)
|
||||
if (ApplicationManager.getApplication().isReadAccessAllowed) {
|
||||
LOG.warn("Can't wait till changes are applied while holding read lock", Throwable())
|
||||
}
|
||||
else {
|
||||
ChangeListManagerEx.getInstanceEx(project).waitForUpdate()
|
||||
}
|
||||
waitForChangeListManagerUpdate(project)
|
||||
restoreChangeList(changeListManager, targetChangeList, oldDefaultList)
|
||||
}
|
||||
}
|
||||
|
||||
private fun waitForChangeListManagerUpdate(project: Project) {
|
||||
if (ApplicationManager.getApplication().isReadAccessAllowed) {
|
||||
LOG.warn("Can't wait till changes are applied while holding read lock", Throwable())
|
||||
}
|
||||
else {
|
||||
ChangeListManagerEx.getInstanceEx(project).waitForUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
private fun switchChangeList(clm: ChangeListManagerEx,
|
||||
targetChangeList: LocalChangeList,
|
||||
oldDefaultList: LocalChangeList) {
|
||||
|
||||
Reference in New Issue
Block a user