Search in sources :

Example 1 with VcsDirtyScopeManagerImpl

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

the class SvnTestDirtyScopeStateTest method testOkToAddScopeUnderWriteAction.

@Test
public void testOkToAddScopeUnderWriteAction() throws Exception {
    enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    final VcsDirtyScopeManagerImpl vcsDirtyScopeManager = (VcsDirtyScopeManagerImpl) VcsDirtyScopeManager.getInstance(myProject);
    final VirtualFile file = createFileInCommand("a.txt", "old content");
    final VirtualFile fileB = createFileInCommand("b.txt", "old content");
    final VirtualFile fileC = createFileInCommand("c.txt", "old content");
    final VirtualFile fileD = createFileInCommand("d.txt", "old content");
    final List<FilePath> list = ObjectsConvertor.vf2fp(Arrays.asList(file, fileB, fileC, fileD));
    vcsDirtyScopeManager.retrieveScopes();
    vcsDirtyScopeManager.changesProcessed();
    new WriteCommandAction.Simple(myProject) {

        @Override
        protected void run() throws Throwable {
            vcsDirtyScopeManager.fileDirty(file);
            vcsDirtyScopeManager.fileDirty(fileB);
        }
    }.execute().throwException();
    final FilePath fp = VcsUtil.getFilePath(file);
    final FilePath fpB = VcsUtil.getFilePath(fileB);
    final long start = System.currentTimeMillis();
    while (System.currentTimeMillis() < (start + 3000)) {
        synchronized (this) {
            try {
                wait(50);
            } catch (InterruptedException e) {
            //
            }
        }
        final Collection<FilePath> dirty1 = vcsDirtyScopeManager.whatFilesDirty(list);
        if (dirty1.contains(fp) && dirty1.contains(fpB))
            return;
    }
    Assert.assertTrue(false);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) FilePath(com.intellij.openapi.vcs.FilePath) VcsDirtyScopeManagerImpl(com.intellij.openapi.vcs.changes.VcsDirtyScopeManagerImpl) Test(org.junit.Test)

Example 2 with VcsDirtyScopeManagerImpl

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

the class SvnTestDirtyScopeStateTest method testWhatIsDirty.

@Test
public void testWhatIsDirty() throws Exception {
    enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    final VcsDirtyScopeManagerImpl vcsDirtyScopeManager = (VcsDirtyScopeManagerImpl) VcsDirtyScopeManager.getInstance(myProject);
    final VirtualFile file = createFileInCommand("a.txt", "old content");
    final VirtualFile fileB = createFileInCommand("b.txt", "old content");
    final VirtualFile fileC = createFileInCommand("c.txt", "old content");
    final VirtualFile fileD = createFileInCommand("d.txt", "old content");
    final List<FilePath> list = ObjectsConvertor.vf2fp(Arrays.asList(file, fileB, fileC, fileD));
    vcsDirtyScopeManager.retrieveScopes();
    vcsDirtyScopeManager.changesProcessed();
    vcsDirtyScopeManager.fileDirty(file);
    vcsDirtyScopeManager.fileDirty(fileB);
    final Collection<FilePath> dirty1 = vcsDirtyScopeManager.whatFilesDirty(list);
    Assert.assertTrue(dirty1.contains(VcsUtil.getFilePath(file)));
    Assert.assertTrue(dirty1.contains(VcsUtil.getFilePath(fileB)));
    Assert.assertTrue(!dirty1.contains(VcsUtil.getFilePath(fileC)));
    Assert.assertTrue(!dirty1.contains(VcsUtil.getFilePath(fileD)));
    vcsDirtyScopeManager.retrieveScopes();
    final Collection<FilePath> dirty2 = vcsDirtyScopeManager.whatFilesDirty(list);
    Assert.assertTrue(dirty2.contains(VcsUtil.getFilePath(file)));
    Assert.assertTrue(dirty2.contains(VcsUtil.getFilePath(fileB)));
    Assert.assertTrue(!dirty2.contains(VcsUtil.getFilePath(fileC)));
    Assert.assertTrue(!dirty2.contains(VcsUtil.getFilePath(fileD)));
    vcsDirtyScopeManager.changesProcessed();
    final Collection<FilePath> dirty3 = vcsDirtyScopeManager.whatFilesDirty(list);
    Assert.assertTrue(!dirty3.contains(VcsUtil.getFilePath(file)));
    Assert.assertTrue(!dirty3.contains(VcsUtil.getFilePath(fileB)));
    Assert.assertTrue(!dirty3.contains(VcsUtil.getFilePath(fileC)));
    Assert.assertTrue(!dirty3.contains(VcsUtil.getFilePath(fileD)));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) FilePath(com.intellij.openapi.vcs.FilePath) VcsDirtyScopeManagerImpl(com.intellij.openapi.vcs.changes.VcsDirtyScopeManagerImpl) Test(org.junit.Test)

Example 3 with VcsDirtyScopeManagerImpl

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

the class SvnTestDirtyScopeStateTest method testWhatIsDirty.

@Test
public void testWhatIsDirty() throws Exception {
    enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    final VcsDirtyScopeManagerImpl vcsDirtyScopeManager = (VcsDirtyScopeManagerImpl) VcsDirtyScopeManager.getInstance(myProject);
    final VirtualFile file = createFileInCommand("a.txt", "old content");
    final VirtualFile fileB = createFileInCommand("b.txt", "old content");
    final VirtualFile fileC = createFileInCommand("c.txt", "old content");
    final VirtualFile fileD = createFileInCommand("d.txt", "old content");
    waitABit();
    final List<FilePath> list = ObjectsConvertor.vf2fp(Arrays.asList(file, fileB, fileC, fileD));
    vcsDirtyScopeManager.retrieveScopes();
    vcsDirtyScopeManager.changesProcessed();
    vcsDirtyScopeManager.fileDirty(file);
    vcsDirtyScopeManager.fileDirty(fileB);
    final Collection<FilePath> dirty1 = vcsDirtyScopeManager.whatFilesDirty(list);
    Assert.assertTrue(dirty1.contains(VcsUtil.getFilePath(file)));
    Assert.assertTrue(dirty1.contains(VcsUtil.getFilePath(fileB)));
    Assert.assertTrue(!dirty1.contains(VcsUtil.getFilePath(fileC)));
    Assert.assertTrue(!dirty1.contains(VcsUtil.getFilePath(fileD)));
    vcsDirtyScopeManager.retrieveScopes();
    final Collection<FilePath> dirty2 = vcsDirtyScopeManager.whatFilesDirty(list);
    Assert.assertTrue(dirty2.contains(VcsUtil.getFilePath(file)));
    Assert.assertTrue(dirty2.contains(VcsUtil.getFilePath(fileB)));
    Assert.assertTrue(!dirty2.contains(VcsUtil.getFilePath(fileC)));
    Assert.assertTrue(!dirty2.contains(VcsUtil.getFilePath(fileD)));
    vcsDirtyScopeManager.changesProcessed();
    final Collection<FilePath> dirty3 = vcsDirtyScopeManager.whatFilesDirty(list);
    Assert.assertTrue(!dirty3.contains(VcsUtil.getFilePath(file)));
    Assert.assertTrue(!dirty3.contains(VcsUtil.getFilePath(fileB)));
    Assert.assertTrue(!dirty3.contains(VcsUtil.getFilePath(fileC)));
    Assert.assertTrue(!dirty3.contains(VcsUtil.getFilePath(fileD)));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) FilePath(com.intellij.openapi.vcs.FilePath) VcsDirtyScopeManagerImpl(com.intellij.openapi.vcs.changes.VcsDirtyScopeManagerImpl) Test(org.junit.Test)

Example 4 with VcsDirtyScopeManagerImpl

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

the class SvnTestDirtyScopeStateTest method testOkToAddScopeUnderWriteAction.

@Test
public void testOkToAddScopeUnderWriteAction() throws Exception {
    enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    final VcsDirtyScopeManagerImpl vcsDirtyScopeManager = (VcsDirtyScopeManagerImpl) VcsDirtyScopeManager.getInstance(myProject);
    final VirtualFile file = createFileInCommand("a.txt", "old content");
    final VirtualFile fileB = createFileInCommand("b.txt", "old content");
    final VirtualFile fileC = createFileInCommand("c.txt", "old content");
    final VirtualFile fileD = createFileInCommand("d.txt", "old content");
    waitABit();
    final List<FilePath> list = ObjectsConvertor.vf2fp(Arrays.asList(file, fileB, fileC, fileD));
    vcsDirtyScopeManager.retrieveScopes();
    vcsDirtyScopeManager.changesProcessed();
    new WriteCommandAction.Simple(myProject) {

        @Override
        protected void run() throws Throwable {
            vcsDirtyScopeManager.fileDirty(file);
            vcsDirtyScopeManager.fileDirty(fileB);
        }
    }.execute().throwException();
    final FilePath fp = VcsUtil.getFilePath(file);
    final FilePath fpB = VcsUtil.getFilePath(fileB);
    final long start = System.currentTimeMillis();
    while (System.currentTimeMillis() < (start + 3000)) {
        synchronized (this) {
            try {
                wait(50);
            } catch (InterruptedException e) {
            //
            }
        }
        final Collection<FilePath> dirty1 = vcsDirtyScopeManager.whatFilesDirty(list);
        if (dirty1.contains(fp) && dirty1.contains(fpB))
            return;
    }
    Assert.assertTrue(false);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) FilePath(com.intellij.openapi.vcs.FilePath) VcsDirtyScopeManagerImpl(com.intellij.openapi.vcs.changes.VcsDirtyScopeManagerImpl) Test(org.junit.Test)

Aggregations

FilePath (com.intellij.openapi.vcs.FilePath)4 VcsDirtyScopeManagerImpl (com.intellij.openapi.vcs.changes.VcsDirtyScopeManagerImpl)4 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 Test (org.junit.Test)4