mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
correctly refresh vfs in vcs tests
This commit is contained in:
@@ -88,6 +88,15 @@ public abstract class AbstractVcsTestCase {
|
||||
return result;
|
||||
}
|
||||
|
||||
protected static void refreshVfs() {
|
||||
UsefulTestCase.edt(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
LocalFileSystem.getInstance().refresh(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void initProject(final File clientRoot, String testName) throws Exception {
|
||||
String name = getClass().getName() + "." + testName;
|
||||
final TestFixtureBuilder<IdeaProjectTestFixture> testFixtureBuilder = IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(name);
|
||||
|
||||
@@ -41,7 +41,7 @@ public class HgDiffProviderTest extends HgSingleUserTest {
|
||||
runHgOnProjectRepo("rename", AFILE, BFILE);
|
||||
//don't commit
|
||||
|
||||
LocalFileSystem.getInstance().refresh(false);
|
||||
refreshVfs();
|
||||
ChangeListManager.getInstance(myProject).ensureUpToDate(false);
|
||||
|
||||
HgDiffProvider diffProvider = new HgDiffProvider(myProject);
|
||||
@@ -67,7 +67,7 @@ public class HgDiffProviderTest extends HgSingleUserTest {
|
||||
|
||||
|
||||
|
||||
LocalFileSystem.getInstance().refresh(false);
|
||||
refreshVfs();
|
||||
//ChangeListManager.getInstance(myProject).ensureUpToDate(false);
|
||||
|
||||
HgDiffProvider diffProvider = new HgDiffProvider(myProject);
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.intellij.openapi.vcs.VcsException;
|
||||
import com.intellij.openapi.vcs.changes.ChangeListManager;
|
||||
import com.intellij.openapi.vcs.history.VcsFileRevision;
|
||||
import com.intellij.openapi.vcs.history.VcsHistorySession;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.vcsUtil.VcsUtil;
|
||||
import org.testng.annotations.Test;
|
||||
import org.zmlx.hg4idea.HgVcs;
|
||||
@@ -98,7 +97,7 @@ public class HgHistoryTest extends HgSingleUserTest {
|
||||
runHgOnProjectRepo("rename", AFILE, BFILE);
|
||||
//don't commit
|
||||
|
||||
LocalFileSystem.getInstance().refresh(false);
|
||||
refreshVfs();
|
||||
ChangeListManager.getInstance(myProject).ensureUpToDate(false);
|
||||
|
||||
final VcsHistorySession session = getHistorySession(BFILE);
|
||||
|
||||
@@ -18,10 +18,8 @@ import com.intellij.openapi.vcs.AbstractVcsHelper;
|
||||
import com.intellij.openapi.vcs.VcsConfiguration;
|
||||
import com.intellij.openapi.vcs.VcsShowConfirmationOption;
|
||||
import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.testFramework.AbstractVcsTestCase;
|
||||
import com.intellij.testFramework.TestClientRunner;
|
||||
import com.intellij.ui.GuiUtils;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.vcsUtil.VcsUtil;
|
||||
@@ -176,7 +174,7 @@ public abstract class HgTest extends AbstractVcsTestCase {
|
||||
protected VirtualFile makeFile(File file) throws IOException {
|
||||
file.createNewFile();
|
||||
VcsDirtyScopeManager.getInstance(myProject).fileDirty(myWorkingCopyDir);
|
||||
LocalFileSystem.getInstance().refresh(false);
|
||||
refreshVfs();
|
||||
return VcsUtil.getVirtualFile(file);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.intellij.openapi.vcs.changes.Change;
|
||||
import com.intellij.openapi.vcs.changes.ChangeListManager;
|
||||
import com.intellij.openapi.vcs.changes.LocalChangeList;
|
||||
import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.idea.svn.integrate.AlienDirtyScope;
|
||||
import org.junit.Assert;
|
||||
@@ -34,7 +33,7 @@ public class SvnDeleteTest extends SvnTestCase {
|
||||
deleteFileInCommand(dir);
|
||||
verify(runSvn("status"), "D child", "D child" + File.separatorChar + "a.txt");
|
||||
|
||||
LocalFileSystem.getInstance().refresh(false);
|
||||
refreshVfs();
|
||||
|
||||
final AlienDirtyScope dirtyScope = new AlienDirtyScope();
|
||||
dirtyScope.addDir(new FilePathImpl(myWorkingCopyDir));
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.intellij.openapi.vcs.VcsException;
|
||||
import com.intellij.openapi.vcs.changes.Change;
|
||||
import com.intellij.openapi.vcs.changes.ChangeListManager;
|
||||
import com.intellij.openapi.vcs.rollback.RollbackProgressListener;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.junit.Assert;
|
||||
@@ -17,7 +16,10 @@ import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
@@ -81,7 +83,7 @@ public class SvnRenameTest extends SvnTestCase {
|
||||
final ProcessOutput result = runSvn("status");
|
||||
verify(result, "D child", "D child" + File.separatorChar + "grandChild", "D child" + File.separatorChar + "grandChild" + File.separatorChar + "b.txt", "D child" + File.separatorChar + "a.txt", "A + childnew");
|
||||
|
||||
LocalFileSystem.getInstance().refresh(false); // wait for end of refresh operations initiated from SvnFileSystemListener
|
||||
refreshVfs(); // wait for end of refresh operations initiated from SvnFileSystemListener
|
||||
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
|
||||
changeListManager.ensureUpToDate(false);
|
||||
List<Change> changes = new ArrayList<Change>(changeListManager.getDefaultChangeList().getChanges());
|
||||
@@ -163,7 +165,7 @@ public class SvnRenameTest extends SvnTestCase {
|
||||
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
|
||||
|
||||
moveFileInCommand(grandChild, myWorkingCopyDir);
|
||||
LocalFileSystem.getInstance().refresh(false); // wait for end of refresh operations initiated from SvnFileSystemListener
|
||||
refreshVfs(); // wait for end of refresh operations initiated from SvnFileSystemListener
|
||||
changeListManager.ensureUpToDate(false);
|
||||
final List<Change> changes = new ArrayList<Change>(changeListManager.getDefaultChangeList().getChanges());
|
||||
Assert.assertEquals(listToString(changes), 2, changes.size());
|
||||
@@ -199,7 +201,7 @@ public class SvnRenameTest extends SvnTestCase {
|
||||
Assert.assertTrue(new File(newChildPath, "u.txt").exists());
|
||||
Assert.assertFalse(new File(childPath, "u.txt").exists());
|
||||
|
||||
LocalFileSystem.getInstance().refresh(false);
|
||||
refreshVfs();
|
||||
changeListManager.ensureUpToDate(false);
|
||||
final List<Change> changes = new ArrayList<Change>();
|
||||
changes.add(ChangeListManager.getInstance(myProject).getChange(myWorkingCopyDir.findChild("newchild").findChild("a.txt")));
|
||||
@@ -235,7 +237,7 @@ public class SvnRenameTest extends SvnTestCase {
|
||||
"D child", "D child" + File.separatorChar + "a.txt", "D child" + File.separatorChar + "grandChild", "D child" + File.separatorChar + "grandChild" + File.separatorChar + "b.txt", "D + newchild" + File.separatorChar + "a.txt");
|
||||
|
||||
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
|
||||
LocalFileSystem.getInstance().refresh(false); // wait for end of refresh operations initiated from SvnFileSystemListener
|
||||
refreshVfs(); // wait for end of refresh operations initiated from SvnFileSystemListener
|
||||
changeListManager.ensureUpToDate(false);
|
||||
final List<Change> changes = new ArrayList<Change>(changeListManager.getDefaultChangeList().getChanges());
|
||||
final List<VcsException> list = SvnVcs.getInstance(myProject).getCheckinEnvironment().commit(changes, "test");
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.intellij.openapi.vcs.changes.Change;
|
||||
import com.intellij.openapi.vcs.changes.ChangeListManager;
|
||||
import com.intellij.openapi.vcs.changes.LocalChangeList;
|
||||
import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.idea.svn.integrate.AlienDirtyScope;
|
||||
import org.junit.Assert;
|
||||
@@ -34,7 +33,7 @@ public class SvnDeleteTest extends SvnTestCase {
|
||||
deleteFileInCommand(dir);
|
||||
verify(runSvn("status"), "D child", "D child" + File.separatorChar + "a.txt");
|
||||
|
||||
LocalFileSystem.getInstance().refresh(false);
|
||||
refreshVfs();
|
||||
|
||||
final AlienDirtyScope dirtyScope = new AlienDirtyScope();
|
||||
dirtyScope.addDir(new FilePathImpl(myWorkingCopyDir));
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.intellij.openapi.vcs.VcsException;
|
||||
import com.intellij.openapi.vcs.changes.Change;
|
||||
import com.intellij.openapi.vcs.changes.ChangeListManager;
|
||||
import com.intellij.openapi.vcs.rollback.RollbackProgressListener;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.idea.svn.SvnVcs;
|
||||
@@ -18,7 +17,10 @@ import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
@@ -82,7 +84,7 @@ public class SvnRenameTest extends SvnTestCase {
|
||||
final ProcessOutput result = runSvn("status");
|
||||
verify(result, "D child", "D child" + File.separatorChar + "grandChild", "D child" + File.separatorChar + "grandChild" + File.separatorChar + "b.txt", "D child" + File.separatorChar + "a.txt", "A + childnew");
|
||||
|
||||
LocalFileSystem.getInstance().refresh(false); // wait for end of refresh operations initiated from SvnFileSystemListener
|
||||
refreshVfs(); // wait for end of refresh operations initiated from SvnFileSystemListener
|
||||
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
|
||||
changeListManager.ensureUpToDate(false);
|
||||
List<Change> changes = new ArrayList<Change>(changeListManager.getDefaultChangeList().getChanges());
|
||||
@@ -159,7 +161,7 @@ public class SvnRenameTest extends SvnTestCase {
|
||||
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
|
||||
|
||||
moveFileInCommand(grandChild, myWorkingCopyDir);
|
||||
LocalFileSystem.getInstance().refresh(false); // wait for end of refresh operations initiated from SvnFileSystemListener
|
||||
refreshVfs(); // wait for end of refresh operations initiated from SvnFileSystemListener
|
||||
changeListManager.ensureUpToDate(false);
|
||||
final List<Change> changes = new ArrayList<Change>(changeListManager.getDefaultChangeList().getChanges());
|
||||
Assert.assertEquals(listToString(changes), 2, changes.size());
|
||||
@@ -195,7 +197,7 @@ public class SvnRenameTest extends SvnTestCase {
|
||||
Assert.assertTrue(new File(newChildPath, "u.txt").exists());
|
||||
Assert.assertFalse(new File(childPath, "u.txt").exists());
|
||||
|
||||
LocalFileSystem.getInstance().refresh(false);
|
||||
refreshVfs();
|
||||
changeListManager.ensureUpToDate(false);
|
||||
final List<Change> changes = new ArrayList<Change>();
|
||||
changes.add(ChangeListManager.getInstance(myProject).getChange(myWorkingCopyDir.findChild("newchild").findChild("a.txt")));
|
||||
@@ -231,7 +233,7 @@ public class SvnRenameTest extends SvnTestCase {
|
||||
"D child", "D child" + File.separatorChar + "a.txt", "D child" + File.separatorChar + "grandChild", "D child" + File.separatorChar + "grandChild" + File.separatorChar + "b.txt", "D + newchild" + File.separatorChar + "a.txt");
|
||||
|
||||
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
|
||||
LocalFileSystem.getInstance().refresh(false); // wait for end of refresh operations initiated from SvnFileSystemListener
|
||||
refreshVfs(); // wait for end of refresh operations initiated from SvnFileSystemListener
|
||||
changeListManager.ensureUpToDate(false);
|
||||
final List<Change> changes = new ArrayList<Change>(changeListManager.getDefaultChangeList().getChanges());
|
||||
final List<VcsException> list = SvnVcs.getInstance(myProject).getCheckinEnvironment().commit(changes, "test");
|
||||
|
||||
Reference in New Issue
Block a user