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());
});
}
use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class HgUpdateTest method updateShouldMergeButNotCommitWithConflicts.
@Test
public void updateShouldMergeButNotCommitWithConflicts() throws Exception {
changeFile_A_AndCommitInRemoteRepository();
VirtualFile commonFile = projectRepoVirtualFile.findChild("com").findChild("a.txt");
assertNotNull(commonFile);
VcsTestUtil.editFileInCommand(myProject, commonFile, "conflicting content");
runHg(projectRepo, "commit", "-m", "adding conflicting history to local repository");
PreUpdateInformation preUpdateInformation = new PreUpdateInformation().getPreUpdateInformation();
HgRevisionNumber incomingHead = preUpdateInformation.getIncomingHead();
HgRevisionNumber headBeforeUpdate = preUpdateInformation.getHeadBeforeUpdate();
List<VcsException> warnings = updateThroughPlugin();
assertFalse(warnings.isEmpty());
assertTrue(warnings.get(warnings.size() - 1).getMessage().contains("conflicts"));
assertTrue(warnings.get(warnings.size() - 1).getMessage().contains("commit"));
List<HgRevisionNumber> parents = new HgWorkingCopyRevisionsCommand(myProject).parents(projectRepoVirtualFile);
assertEquals(parents.size(), 2);
assertTrue(parents.contains(incomingHead));
assertTrue(parents.contains(headBeforeUpdate));
}
use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class HgUpdateTest method localChangesShouldBeAllowedWithFastForwardUpdate.
@Test
public void localChangesShouldBeAllowedWithFastForwardUpdate() throws Exception {
createFileInCommand(projectRepoVirtualFile.findChild("com"), "b.txt", "other file");
runHg(projectRepo, "commit", "-m", "adding second file");
runHg(projectRepo, "push");
runHg(remoteRepo, "update");
changeFile_A_AndCommitInRemoteRepository();
fillFile(projectRepo, new String[] { "com", "b.txt" }, "local change");
createFileInCommand(projectRepoVirtualFile.findChild("com"), "c.txt", "other file");
assertIsChanged(HgFileStatusEnum.MODIFIED, "com", "b.txt");
assertIsChanged(HgFileStatusEnum.ADDED, "com", "c.txt");
PreUpdateInformation information = new PreUpdateInformation().getPreUpdateInformation();
HgRevisionNumber incomingHead = information.getIncomingHead();
List<VcsException> nonFatalWarnings = updateThroughPlugin();
assertTrue(nonFatalWarnings.isEmpty());
HgRevisionNumber parentAfterUpdate = new HgParentsCommand(myProject).executeInCurrentThread(projectRepoVirtualFile).get(0);
assertEquals(incomingHead, parentAfterUpdate);
assertIsChanged(HgFileStatusEnum.MODIFIED, "com", "b.txt");
assertIsChanged(HgFileStatusEnum.ADDED, "com", "c.txt");
}
use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class SvnKitDeleteClient method delete.
@Override
public void delete(@NotNull File path, boolean force, boolean dryRun, @Nullable ProgressTracker handler) throws VcsException {
SVNWCClient client = myVcs.getSvnKitManager().createWCClient();
client.setEventHandler(toEventHandler(handler));
try {
client.doDelete(path, force, dryRun);
} catch (SVNException e) {
throw new VcsException(e);
}
}
Aggregations