use of org.jetbrains.idea.svn.SvnDiffProvider in project intellij-community by JetBrains.
the class SvnAnnotationIsClosedTest method testClosedByUpdateWithExternals.
@Test
public void testClosedByUpdateWithExternals() throws Exception {
prepareExternal();
final File sourceFile = new File(myWorkingCopyDir.getPath(), "source" + File.separator + "s1.txt");
final File externalFile = new File(myWorkingCopyDir.getPath(), "source" + File.separator + "external" + File.separator + "t12.txt");
final LocalFileSystem lfs = LocalFileSystem.getInstance();
final VirtualFile vf1 = lfs.refreshAndFindFileByIoFile(sourceFile);
final VirtualFile vf2 = lfs.refreshAndFindFileByIoFile(externalFile);
Assert.assertNotNull(vf1);
Assert.assertNotNull(vf2);
VcsTestUtil.editFileInCommand(myProject, vf1, "test externals 123" + System.currentTimeMillis());
VcsTestUtil.editFileInCommand(myProject, vf2, "test externals 123" + System.currentTimeMillis());
VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
myChangeListManager.ensureUpToDate(false);
final Change change1 = myChangeListManager.getChange(vf1);
final Change change2 = myChangeListManager.getChange(vf2);
Assert.assertNotNull(change1);
Assert.assertNotNull(change2);
final File sourceDir = new File(myWorkingCopyDir.getPath(), "source");
final File externalDir = new File(myWorkingCopyDir.getPath(), "source/external");
// #3
runInAndVerifyIgnoreOutput("ci", "-m", "test", sourceDir.getPath());
// #4
runInAndVerifyIgnoreOutput("ci", "-m", "test", externalDir.getPath());
VcsTestUtil.editFileInCommand(myProject, vf2, "test externals 12344444" + System.currentTimeMillis());
// #5
runInAndVerifyIgnoreOutput("ci", "-m", "test", externalDir.getPath());
final SvnDiffProvider diffProvider = (SvnDiffProvider) myVcs.getDiffProvider();
assertRevision(vf1, diffProvider, 3);
assertRevision(vf2, diffProvider, 5);
runInAndVerifyIgnoreOutput("up", "-r", "4", sourceDir.getPath());
runInAndVerifyIgnoreOutput("up", "-r", "4", externalDir.getPath());
assertRevision(vf1, diffProvider, 3);
assertRevision(vf2, diffProvider, 4);
// then annotate both
final VcsAnnotationLocalChangesListener listener = ProjectLevelVcsManager.getInstance(myProject).getAnnotationLocalChangesListener();
final FileAnnotation annotation = createTestAnnotation(myVcs.getAnnotationProvider(), vf1);
annotation.setCloser(() -> {
myIsClosed = true;
listener.unregisterAnnotation(vf1, annotation);
});
listener.registerAnnotation(vf1, annotation);
final FileAnnotation annotation1 = createTestAnnotation(myVcs.getAnnotationProvider(), vf2);
annotation1.setCloser(() -> {
myIsClosed1 = true;
listener.unregisterAnnotation(vf1, annotation1);
});
listener.registerAnnotation(vf1, annotation1);
//up
runInAndVerifyIgnoreOutput("up", sourceDir.getPath());
imitateEvent(lfs.refreshAndFindFileByIoFile(sourceDir));
imitateEvent(lfs.refreshAndFindFileByIoFile(externalDir));
myChangeListManager.ensureUpToDate(false);
// wait for after-events like annotations recalculation
myChangeListManager.ensureUpToDate(false);
// zipper updater
sleep(100);
//verify(runSvn("up", "-r", "3", externalDir.getPath()));
assertRevision(vf1, diffProvider, 3);
assertRevision(vf2, diffProvider, 5);
Assert.assertTrue(myIsClosed1);
// in source is not closed..
Assert.assertFalse(myIsClosed);
}
Aggregations