mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
lst: update affected changelists if initialisation produced no new changes
If base content is the same as it was before (at tracker initialisation),
there are would be no events fired by `DocumentTrackerHandler`.
But we cleared `initialChangeListId` field, so affected changelists
could have been modified.
follow-up: 33806f068e
This commit is contained in:
@@ -165,6 +165,8 @@ class PartialLocalLineStatusTracker(project: Project,
|
||||
}
|
||||
}
|
||||
|
||||
updateAffectedChangeLists()
|
||||
|
||||
dropExistingUndoActions()
|
||||
if (isValid()) eventDispatcher.multicaster.onBecomingValid(this)
|
||||
}
|
||||
|
||||
+52
-2
@@ -230,7 +230,7 @@ class LineStatusTrackerManagerTest : BaseLineStatusTrackerManagerTest() {
|
||||
}
|
||||
}
|
||||
|
||||
fun `test tracker changes moves - before initialisation`() {
|
||||
fun `test tracker before initialisation - no changed lines in vcs, local changes reverted`() {
|
||||
createChangelist("Test")
|
||||
|
||||
val file = addLocalFile(FILE_1, "a_b_c_d_e")
|
||||
@@ -258,7 +258,7 @@ class LineStatusTrackerManagerTest : BaseLineStatusTrackerManagerTest() {
|
||||
}
|
||||
}
|
||||
|
||||
fun `test tracker changes moves - before initialisation 2`() {
|
||||
fun `test tracker before initialisation - typing`() {
|
||||
createChangelist("Test")
|
||||
|
||||
val file = addLocalFile(FILE_1, "a_b_c_d_e")
|
||||
@@ -282,4 +282,54 @@ class LineStatusTrackerManagerTest : BaseLineStatusTrackerManagerTest() {
|
||||
tracker.assertAffectedChangeLists("Default", "Test")
|
||||
}
|
||||
}
|
||||
|
||||
fun `test tracker before initialisation - no changed lines in vcs`() {
|
||||
createChangelist("Test")
|
||||
|
||||
val file = addLocalFile(FILE_1, "a_b_c_d_e")
|
||||
setBaseVersion(FILE_1, "a_b_c_d_e")
|
||||
refreshCLM()
|
||||
file.moveAllChangesTo("Test")
|
||||
|
||||
file.withOpenedEditor {
|
||||
val tracker = file.tracker as PartialLocalLineStatusTracker
|
||||
|
||||
tracker.assertAffectedChangeLists("Test")
|
||||
|
||||
runCommand { tracker.document.replaceString(0, 1, "a2") }
|
||||
tracker.assertAffectedChangeLists("Default", "Test")
|
||||
|
||||
assertFalse(tracker.isOperational())
|
||||
assertNull(tracker.getRanges())
|
||||
|
||||
lstm.waitUntilBaseContentsLoaded()
|
||||
assertEquals(1, tracker.getRanges()!!.size)
|
||||
tracker.assertAffectedChangeLists("Default")
|
||||
}
|
||||
}
|
||||
|
||||
fun `test tracker before initialisation - old local changes reverted`() {
|
||||
createChangelist("Test")
|
||||
|
||||
val file = addLocalFile(FILE_1, "a2_b_c_d_e")
|
||||
setBaseVersion(FILE_1, "a_b_c_d_e")
|
||||
refreshCLM()
|
||||
file.moveAllChangesTo("Test")
|
||||
|
||||
file.withOpenedEditor {
|
||||
val tracker = file.tracker as PartialLocalLineStatusTracker
|
||||
|
||||
tracker.assertAffectedChangeLists("Test")
|
||||
|
||||
runCommand { tracker.document.replaceString(0, 2, "a") }
|
||||
tracker.assertAffectedChangeLists("Default", "Test")
|
||||
|
||||
assertFalse(tracker.isOperational())
|
||||
assertNull(tracker.getRanges())
|
||||
|
||||
lstm.waitUntilBaseContentsLoaded()
|
||||
assertEquals(0, tracker.getRanges()!!.size)
|
||||
tracker.assertAffectedChangeLists("Default")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user