mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vcs] commit progress cancelling should cancel a commit task (IJPL-242092)
GitOrigin-RevId: 99272bc0160969609b845446202397d3ab7aa74b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
bc06d18dc3
commit
940e1f8fbf
@@ -3,6 +3,7 @@ package com.intellij.vcs.commit
|
||||
|
||||
import com.intellij.openapi.application.ModalityState
|
||||
import com.intellij.openapi.application.TransactionGuard
|
||||
import com.intellij.openapi.progress.runBlockingCancellable
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.NlsSafe
|
||||
import com.intellij.openapi.vcs.ProjectLevelVcsManager
|
||||
@@ -59,15 +60,19 @@ abstract class AbstractCommitter(
|
||||
suspendCancellableCoroutine { cont ->
|
||||
ChangeListManagerImpl.getInstanceImpl(project).executeOnUpdaterThread {
|
||||
progress(message("message.text.commit.progress"))
|
||||
try {
|
||||
// No ProgressManager.runProcess here — we are already inside a coroutine progress context with the `currentReporter`
|
||||
runCommitTask(useCustomPostRefresh) {
|
||||
commit()
|
||||
runBlockingCancellable {
|
||||
val job = launch {
|
||||
try {
|
||||
runCommitTask(useCustomPostRefresh) {
|
||||
commit()
|
||||
}
|
||||
cont.resume(Unit)
|
||||
}
|
||||
catch (t: Throwable) {
|
||||
cont.resumeWithException(t)
|
||||
}
|
||||
}
|
||||
cont.resume(Unit)
|
||||
}
|
||||
catch (t: Throwable) {
|
||||
cont.resumeWithException(t)
|
||||
cont.invokeOnCancellation { job.cancel() }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,4 +88,4 @@ abstract class AbstractCommitter(
|
||||
internal fun progress(message: @Nls String) = currentReporter?.also {
|
||||
it.text(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user