use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class SvnProtocolsTest method testCommitImpl.
private File testCommitImpl(File wc1) throws IOException {
Assert.assertTrue(wc1.isDirectory());
final File file = FileUtil.createTempFile(wc1, "file", ".txt");
final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file);
Assert.assertNotNull(vf);
final ArrayList<VirtualFile> files = new ArrayList<>();
files.add(vf);
final List<VcsException> exceptions = myVcs.getCheckinEnvironment().scheduleUnversionedFilesForAddition(files);
Assert.assertTrue(exceptions.isEmpty());
final Change change = new Change(null, new CurrentContentRevision(VcsUtil.getFilePath(vf)));
final List<VcsException> commit = myVcs.getCheckinEnvironment().commit(Collections.singletonList(change), "commit");
Assert.assertTrue(commit.isEmpty());
return file;
}
use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class SvnCommitTest method checkinFiles.
private HashSet<String> checkinFiles(VirtualFile... files) {
final List<Change> changes = new ArrayList<>();
for (VirtualFile file : files) {
final Change change = myChangeListManager.getChange(file);
Assert.assertNotNull(change);
changes.add(change);
}
final HashSet<String> feedback = new HashSet<>();
final List<VcsException> exceptions = myVcs.getCheckinEnvironment().commit(changes, "test comment list", o -> null, feedback);
if (exceptions != null && !exceptions.isEmpty()) {
exceptions.get(0).printStackTrace();
}
Assert.assertTrue(exceptions == null || exceptions.isEmpty());
myDirtyScopeManager.markEverythingDirty();
myChangeListManager.ensureUpToDate(false);
for (VirtualFile file : files) {
final Change changeA = myChangeListManager.getChange(file);
Assert.assertNull(changeA);
}
return feedback;
}
use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class SvnRenameTest method testRenameFileRenameDir.
// IDEA-13824
@Test
public void testRenameFileRenameDir() throws Exception {
//todo debug
setNativeAcceleration(true);
final VirtualFile child = prepareDirectoriesForRename();
final VirtualFile f = child.findChild("a.txt");
renameFileInCommand(f, "anew.txt");
renameFileInCommand(child, "newchild");
verifySorted(runSvn("status"), "A + newchild", "A + newchild" + File.separatorChar + "anew.txt", "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);
insideInitializedChangeListManager(changeListManager, () -> {
// wait for end of refresh operations initiated from SvnFileSystemListener
refreshVfs();
changeListManager.ensureUpToDate(false);
final List<Change> changes = new ArrayList<>(changeListManager.getDefaultChangeList().getChanges());
final List<VcsException> list = SvnVcs.getInstance(myProject).getCheckinEnvironment().commit(changes, "test");
Assert.assertEquals(0, list.size());
});
}
use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class SvnRenameTest method testRollbackRenameDir.
// todo - undo; undo after commit
// IDEADEV-9755
@Test
public void testRollbackRenameDir() throws Exception {
final VirtualFile child = prepareDirectoriesForRename();
renameFileInCommand(child, "newchild");
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
insideInitializedChangeListManager(changeListManager, () -> {
changeListManager.ensureUpToDate(false);
final Change change = changeListManager.getChange(myWorkingCopyDir.findChild("newchild"));
Assert.assertNotNull(change);
final List<VcsException> exceptions = new ArrayList<>();
SvnVcs.getInstance(myProject).getRollbackEnvironment().rollbackChanges(Collections.singletonList(change), exceptions, RollbackProgressListener.EMPTY);
Assert.assertTrue(exceptions.isEmpty());
Assert.assertFalse(new File(myWorkingCopyDir.getPath(), "newchild").exists());
Assert.assertTrue(new File(myWorkingCopyDir.getPath(), "child").exists());
});
}
use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class SvnRenameTest method testRollbackRenameWithUnversioned.
// IDEADEV-19223
@Test
public void testRollbackRenameWithUnversioned() throws Exception {
enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
final VirtualFile child = createDirInCommand(myWorkingCopyDir, "child");
createFileInCommand(child, "a.txt", "a");
checkin();
disableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
final VirtualFile unversioned = createFileInCommand(child, "u.txt", "u");
final VirtualFile unversionedDir = createDirInCommand(child, "uc");
createFileInCommand(unversionedDir, "c.txt", "c");
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
insideInitializedChangeListManager(changeListManager, () -> {
changeListManager.ensureUpToDate(false);
Assert.assertEquals(FileStatus.UNKNOWN, changeListManager.getStatus(unversioned));
renameFileInCommand(child, "newchild");
File childPath = new File(myWorkingCopyDir.getPath(), "child");
File newChildPath = new File(myWorkingCopyDir.getPath(), "newchild");
Assert.assertTrue(new File(newChildPath, "a.txt").exists());
Assert.assertTrue(new File(newChildPath, "u.txt").exists());
Assert.assertFalse(new File(childPath, "u.txt").exists());
refreshVfs();
changeListManager.ensureUpToDate(false);
final List<Change> changes = new ArrayList<>();
changes.add(ChangeListManager.getInstance(myProject).getChange(myWorkingCopyDir.findChild("newchild").findChild("a.txt")));
changes.add(ChangeListManager.getInstance(myProject).getChange(myWorkingCopyDir.findChild("newchild")));
final List<VcsException> exceptions = new ArrayList<>();
SvnVcs.getInstance(myProject).getRollbackEnvironment().rollbackChanges(changes, exceptions, RollbackProgressListener.EMPTY);
TimeoutUtil.sleep(300);
Assert.assertTrue(exceptions.isEmpty());
final File fileA = new File(childPath, "a.txt");
Assert.assertTrue(fileA.getAbsolutePath(), fileA.exists());
final File fileU = new File(childPath, "u.txt");
Assert.assertTrue(fileU.getAbsolutePath(), fileU.exists());
final File unversionedDirFile = new File(childPath, "uc");
Assert.assertTrue(unversionedDirFile.exists());
Assert.assertTrue(new File(unversionedDirFile, "c.txt").exists());
});
}
Aggregations