Search in sources :

Example 26 with RollbackWorker

use of com.intellij.openapi.vcs.changes.ui.RollbackWorker in project intellij-community by JetBrains.

the class SvnChangesCorrectlyRefreshedNativeTest method testRenameDirAndAfterRevert.

@Test
public void testRenameDirAndAfterRevert() throws Throwable {
    final SubTree subTree = new SubTree(myWorkingCopyDir);
    checkin();
    final String newName = "newName";
    renameFileInCommand(subTree.mySourceDir, newName);
    assertVF(subTree.myRootDir, newName);
    assertVF(subTree.mySourceDir, "s1.txt");
    assertVF(subTree.mySourceDir, "s2.txt");
    sleep(300);
    VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
    clManager.ensureUpToDate(false);
    DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] { subTree.mySourceDir, subTree.myS1File, subTree.myS2File }, clManager.getDefaultListName(), clManager);
    final Collection<Change> changes = clManager.getDefaultChangeList().getChanges();
    final RollbackWorker worker = new RollbackWorker(myProject);
    worker.doRollback(changes, false, null, null);
    subTree.mySourceDir = assertVF(subTree.myRootDir, "source");
    Assert.assertTrue(subTree.mySourceDir.getPath().endsWith("/root/source"));
    assertVF(subTree.mySourceDir, "s1.txt");
    assertVF(subTree.mySourceDir, "s2.txt");
    clManager.ensureUpToDate(false);
    DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
Also used : Change(com.intellij.openapi.vcs.changes.Change) RollbackWorker(com.intellij.openapi.vcs.changes.ui.RollbackWorker) Test(org.junit.Test)

Example 27 with RollbackWorker

use of com.intellij.openapi.vcs.changes.ui.RollbackWorker in project intellij-community by JetBrains.

the class SvnChangesCorrectlyRefreshedTest method testRenameFileAndAfterRevert.

@Test
public void testRenameFileAndAfterRevert() throws Throwable {
    final SubTree subTree = new SubTree(myWorkingCopyDir);
    checkin();
    final String newName = "newName";
    renameFileInCommand(subTree.myS1File, newName);
    assertVF(subTree.mySourceDir, newName);
    sleep(300);
    VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
    clManager.ensureUpToDate(false);
    DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] { subTree.myS1File }, clManager.getDefaultListName(), clManager);
    final Collection<Change> changes = clManager.getDefaultChangeList().getChanges();
    final RollbackWorker worker = new RollbackWorker(myProject);
    worker.doRollback(changes, false, null, null);
    assertVF(subTree.mySourceDir, "s1.txt");
    clManager.ensureUpToDate(false);
    DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
Also used : Change(com.intellij.openapi.vcs.changes.Change) RollbackWorker(com.intellij.openapi.vcs.changes.ui.RollbackWorker) Test(org.junit.Test)

Example 28 with RollbackWorker

use of com.intellij.openapi.vcs.changes.ui.RollbackWorker in project intellij-community by JetBrains.

the class SvnChangesCorrectlyRefreshedTest method testModificationAndAfterRevert.

@Test
public void testModificationAndAfterRevert() throws Exception {
    final SubTree subTree = new SubTree(myWorkingCopyDir);
    checkin();
    sleep(100);
    VcsTestUtil.editFileInCommand(myProject, subTree.myS1File, "new content");
    final CharSequence text1 = LoadTextUtil.loadText(subTree.myS1File);
    Assert.assertEquals("new content", text1.toString());
    sleep(100);
    LocalFileSystem.getInstance().refreshAndFindFileByIoFile(virtualToIoFile(subTree.myS1File));
    VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
    clManager.ensureUpToDate(false);
    final VcsException updateException = ((ChangeListManagerImpl) clManager).getUpdateException();
    if (updateException != null) {
        updateException.printStackTrace();
    }
    if (!RepeatSvnActionThroughBusy.ourBusyExceptionProcessor.process(updateException)) {
        Assert.assertNull(updateException == null ? null : updateException.getMessage(), updateException);
    }
    DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] { subTree.myS1File }, clManager.getDefaultListName(), clManager);
    final Collection<Change> changes = clManager.getDefaultChangeList().getChanges();
    final RollbackWorker worker = new RollbackWorker(myProject);
    worker.doRollback(changes, false, null, null);
    final CharSequence text = LoadTextUtil.loadText(subTree.myS1File);
    Assert.assertEquals(SubTree.ourS1Contents, text.toString());
    VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
    clManager.ensureUpToDate(false);
    DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
Also used : ChangeListManagerImpl(com.intellij.openapi.vcs.changes.ChangeListManagerImpl) VcsException(com.intellij.openapi.vcs.VcsException) Change(com.intellij.openapi.vcs.changes.Change) RollbackWorker(com.intellij.openapi.vcs.changes.ui.RollbackWorker) Test(org.junit.Test)

Example 29 with RollbackWorker

use of com.intellij.openapi.vcs.changes.ui.RollbackWorker in project intellij-community by JetBrains.

the class SvnChangesCorrectlyRefreshedTest method testRenameDirAndAfterRevert.

@Test
public void testRenameDirAndAfterRevert() throws Throwable {
    final SubTree subTree = new SubTree(myWorkingCopyDir);
    checkin();
    final String newName = "newName";
    renameFileInCommand(subTree.mySourceDir, newName);
    assertVF(subTree.myRootDir, newName);
    assertVF(subTree.mySourceDir, "s1.txt");
    assertVF(subTree.mySourceDir, "s2.txt");
    sleep(300);
    VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
    clManager.ensureUpToDate(false);
    DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(new VirtualFile[] { subTree.mySourceDir, subTree.myS1File, subTree.myS2File }, clManager.getDefaultListName(), clManager);
    final Collection<Change> changes = clManager.getDefaultChangeList().getChanges();
    final RollbackWorker worker = new RollbackWorker(myProject);
    worker.doRollback(changes, false, null, null);
    subTree.mySourceDir = assertVF(subTree.myRootDir, "source");
    Assert.assertTrue(subTree.mySourceDir.getPath().endsWith("/root/source"));
    assertVF(subTree.mySourceDir, "s1.txt");
    assertVF(subTree.mySourceDir, "s2.txt");
    clManager.ensureUpToDate(false);
    DuringChangeListManagerUpdateTestScheme.checkFilesAreInList(VirtualFile.EMPTY_ARRAY, clManager.getDefaultListName(), clManager);
}
Also used : Change(com.intellij.openapi.vcs.changes.Change) RollbackWorker(com.intellij.openapi.vcs.changes.ui.RollbackWorker) Test(org.junit.Test)

Aggregations

RollbackWorker (com.intellij.openapi.vcs.changes.ui.RollbackWorker)29 Change (com.intellij.openapi.vcs.changes.Change)28 Test (org.junit.Test)28 VirtualFile (com.intellij.openapi.vfs.VirtualFile)9 VcsException (com.intellij.openapi.vcs.VcsException)4 ChangeListManagerImpl (com.intellij.openapi.vcs.changes.ChangeListManagerImpl)4 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 File (java.io.File)1 SvnTestCase (org.jetbrains.idea.SvnTestCase)1