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);
}
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)));
}
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)));
}
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);
}
Aggregations