use of com.intellij.openapi.vcs.changes.ChangeListManager in project intellij-community by JetBrains.
the class SvnRenameTest method testRenamePackageWithChildren.
// IDEADEV-15876
@Test
public void testRenamePackageWithChildren() throws Exception {
final VirtualFile child = prepareDirectoriesForRename();
renameFileInCommand(child, "childnew");
final ProcessOutput result = runSvn("status");
verifySorted(result, "A + childnew", "D child", "D child" + File.separatorChar + "a.txt", "D child" + File.separatorChar + "grandChild", "D child" + File.separatorChar + "grandChild" + File.separatorChar + "b.txt");
// wait for end of refresh operations initiated from SvnFileSystemListener
refreshVfs();
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
insideInitializedChangeListManager(changeListManager, () -> {
changeListManager.ensureUpToDate(false);
List<Change> changes = new ArrayList<>(changeListManager.getDefaultChangeList().getChanges());
Assert.assertEquals(4, changes.size());
sortChanges(changes);
verifyChange(changes.get(0), "child", "childnew");
verifyChange(changes.get(1), "child" + File.separatorChar + "a.txt", "childnew" + File.separatorChar + "a.txt");
verifyChange(changes.get(2), "child" + File.separatorChar + "grandChild", "childnew" + File.separatorChar + "grandChild");
verifyChange(changes.get(3), "child" + File.separatorChar + "grandChild" + File.separatorChar + "b.txt", "childnew" + File.separatorChar + "grandChild" + File.separatorChar + "b.txt");
});
// there is no such directory any more
/*VirtualFile oldChild = myWorkingCopyDir.findChild("child");
if (oldChild == null) {
myWorkingCopyDir.refresh(false, true);
oldChild = myWorkingCopyDir.findChild("child");
}
Assert.assertEquals(FileStatus.DELETED, changeListManager.getStatus(oldChild));*/
}
use of com.intellij.openapi.vcs.changes.ChangeListManager 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.changes.ChangeListManager in project intellij-community by JetBrains.
the class SvnConcurrentChangeListManagerTest method testAddPlusMove.
@Test
public void testAddPlusMove() throws Exception {
enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
final VirtualFile file = createFileInCommand("a.txt", "old content");
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
changeListManager.ensureUpToDate(false);
final LocalChangeList list = changeListManager.addChangeList("test", null);
changeListManager.moveChangesTo(list, new Change[] { changeListManager.getChange(file) });
final String targetName = "target";
myScheme.doTest(() -> {
final LocalChangeList target = changeListManager.addChangeList(targetName, null);
changeListManager.moveChangesTo(target, new Change[] { changeListManager.getChange(file) });
checkFilesAreInList(new VirtualFile[] { file }, targetName, changeListManager);
});
checkFilesAreInList(new VirtualFile[] { file }, targetName, changeListManager);
changeListManager.ensureUpToDate(false);
checkFilesAreInList(new VirtualFile[] { file }, targetName, changeListManager);
}
use of com.intellij.openapi.vcs.changes.ChangeListManager in project intellij-community by JetBrains.
the class SvnDeleteTest method testDeletePackage.
// IDEADEV-16066
@Test
public void testDeletePackage() throws Exception {
enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);
VirtualFile dir = createDirInCommand(myWorkingCopyDir, "child");
createFileInCommand(dir, "a.txt", "content");
runAndVerifyStatus("A child", "A child" + File.separatorChar + "a.txt");
checkin();
deleteFileInCommand(dir);
runAndVerifyStatus("D child", "D child" + File.separatorChar + "a.txt");
refreshVfs();
final AlienDirtyScope dirtyScope = new AlienDirtyScope();
dirtyScope.addDir(VcsUtil.getFilePath(myWorkingCopyDir));
final List<Change> changesManually = getChangesInScope(dirtyScope);
Assert.assertEquals(2, changesManually.size());
VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
// since ChangeListManager is runnning, it can take dirty scope itself;... it's easier to just take changes from it
final ChangeListManager clManager = ChangeListManager.getInstance(myProject);
clManager.ensureUpToDate(false);
final List<LocalChangeList> lists = clManager.getChangeListsCopy();
Assert.assertEquals(1, lists.size());
final Collection<Change> changes = lists.get(0).getChanges();
Assert.assertEquals(2, changes.size());
}
use of com.intellij.openapi.vcs.changes.ChangeListManager in project intellij-community by JetBrains.
the class SvnConcurrentChangeListManagerTest method testAddListBySvn.
@Test
public void testAddListBySvn() throws Exception {
enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
final VirtualFile file = createFileInCommand("a.txt", "old content");
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
final String targetName = "target";
// not parralel, just test of correct detection
runSvn("changelist", targetName, file.getPath());
VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
changeListManager.ensureUpToDate(false);
checkFilesAreInList(new VirtualFile[] { file }, targetName, changeListManager);
}
Aggregations