use of com.intellij.openapi.vcs.changes.ChangeListManager in project intellij-community by JetBrains.
the class SvnConcurrentChangeListManagerTest method testEditComment.
@Test
public void testEditComment() throws Exception {
enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
final VirtualFile file = createFileInCommand("a.txt", "old content");
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
changeListManager.ensureUpToDate(false);
final String listName = "test";
final LocalChangeList list = changeListManager.addChangeList(listName, null);
changeListManager.moveChangesTo(list, new Change[] { changeListManager.getChange(file) });
final String finalText = "final text";
myScheme.doTest(() -> {
final String intermediate = "intermediate text";
changeListManager.editComment(list.getName(), intermediate);
assert changeListManager.findChangeList(listName) != null;
LocalChangeList list1 = changeListManager.findChangeList(listName);
assert intermediate.equals(list1.getComment());
changeListManager.editComment(list1.getName(), finalText);
list1 = changeListManager.findChangeList(listName);
assert finalText.equals(list1.getComment());
});
LocalChangeList changedList = changeListManager.findChangeList(listName);
assert finalText.equals(changedList.getComment());
changeListManager.ensureUpToDate(false);
changedList = changeListManager.findChangeList(listName);
assert finalText.equals(changedList.getComment());
}
use of com.intellij.openapi.vcs.changes.ChangeListManager in project intellij-community by JetBrains.
the class SvnConcurrentChangeListManagerTest method testMove.
@Test
public void testMove() 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);
final LocalChangeList target = changeListManager.addChangeList("target", null);
changeListManager.moveChangesTo(list, new Change[] { changeListManager.getChange(file) });
myScheme.doTest(() -> {
changeListManager.moveChangesTo(target, new Change[] { changeListManager.getChange(file) });
checkFilesAreInList(new VirtualFile[] { file }, target.getName(), changeListManager);
});
checkFilesAreInList(new VirtualFile[] { file }, target.getName(), changeListManager);
changeListManager.ensureUpToDate(false);
checkFilesAreInList(new VirtualFile[] { file }, target.getName(), changeListManager);
}
use of com.intellij.openapi.vcs.changes.ChangeListManager in project intellij-community by JetBrains.
the class SvnConcurrentChangeListManagerTest method testSwitchedFileAndFolder.
@Test
public void testSwitchedFileAndFolder() throws Exception {
final String branchUrl = prepareBranchesStructure();
final SubTree tree = new SubTree(myWorkingCopyDir);
runInAndVerifyIgnoreOutput("switch", branchUrl + "/root/source/s1.txt", tree.myS1File.getPath());
runInAndVerifyIgnoreOutput("switch", branchUrl + "/root/target", tree.myTargetDir.getPath());
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
changeListManager.ensureUpToDate(false);
final Runnable check = () -> {
Assert.assertEquals(FileStatus.SWITCHED, changeListManager.getStatus(tree.myS1File));
Assert.assertEquals(FileStatus.NOT_CHANGED, changeListManager.getStatus(tree.myS2File));
Assert.assertEquals(FileStatus.NOT_CHANGED, changeListManager.getStatus(tree.mySourceDir));
Assert.assertEquals(FileStatus.SWITCHED, changeListManager.getStatus(tree.myTargetDir));
Assert.assertEquals(FileStatus.SWITCHED, changeListManager.getStatus(tree.myTargetFiles.get(1)));
};
// do before refresh check
check.run();
myScheme.doTest(check);
changeListManager.ensureUpToDate(false);
check.run();
VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1234543534543 3543 ");
VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
changeListManager.ensureUpToDate(false);
final Runnable check2 = () -> {
Assert.assertEquals(FileStatus.MODIFIED, changeListManager.getStatus(tree.myS1File));
Assert.assertEquals(FileStatus.NOT_CHANGED, changeListManager.getStatus(tree.myS2File));
Assert.assertEquals(FileStatus.NOT_CHANGED, changeListManager.getStatus(tree.mySourceDir));
Assert.assertEquals(FileStatus.SWITCHED, changeListManager.getStatus(tree.myTargetDir));
Assert.assertEquals(FileStatus.SWITCHED, changeListManager.getStatus(tree.myTargetFiles.get(1)));
};
myScheme.doTest(check2);
changeListManager.ensureUpToDate(false);
check2.run();
}
use of com.intellij.openapi.vcs.changes.ChangeListManager in project intellij-community by JetBrains.
the class SvnConcurrentChangeListManagerTest method testSetActive.
@Test
public void testSetActive() 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);
final LocalChangeList target = changeListManager.addChangeList("target", null);
changeListManager.moveChangesTo(list, new Change[] { changeListManager.getChange(file) });
myScheme.doTest(() -> {
changeListManager.setDefaultChangeList(target);
assert changeListManager.getDefaultChangeList().getName().equals(target.getName());
});
assert changeListManager.getDefaultChangeList().getName().equals(target.getName());
changeListManager.ensureUpToDate(false);
assert changeListManager.getDefaultChangeList().getName().equals(target.getName());
}
use of com.intellij.openapi.vcs.changes.ChangeListManager 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());
});
}
Aggregations