use of com.intellij.openapi.vcs.changes.ChangeListManager in project intellij-community by JetBrains.
the class SvnConcurrentChangeListManagerTest method testComplex.
@Test
public void testComplex() throws Exception {
enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
final VirtualFile file = createFileInCommand("a.txt", "old content");
final VirtualFile fileB = createFileInCommand("b.txt", "old content");
final VirtualFile fileC = createFileInCommand("c.txt", "old content");
final VirtualFile fileD = createFileInCommand("d.txt", "old content");
final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
final LocalChangeList list = changeListManager.addChangeList("test", null);
final LocalChangeList toBeDeletedList = changeListManager.addChangeList("toBeDeletedList", null);
changeListManager.moveChangesTo(list, new Change[] { changeListManager.getChange(file), changeListManager.getChange(fileB) });
changeListManager.moveChangesTo(toBeDeletedList, new Change[] { changeListManager.getChange(fileC), changeListManager.getChange(fileD) });
changeListManager.ensureUpToDate(false);
final String targetName = "target";
final String finalName = "final list name";
myScheme.doTest(() -> {
final LocalChangeList target = changeListManager.addChangeList(targetName, null);
changeListManager.moveChangesTo(target, new Change[] { changeListManager.getChange(file), changeListManager.getChange(fileB) });
checkFilesAreInList(new VirtualFile[] { file, fileB }, targetName, changeListManager);
changeListManager.editName(targetName, finalName);
checkFilesAreInList(new VirtualFile[] { file, fileB }, finalName, changeListManager);
changeListManager.removeChangeList(toBeDeletedList.getName());
checkFilesAreInList(new VirtualFile[] { fileC, fileD }, myDefaulListName, changeListManager);
changeListManager.moveChangesTo(LocalChangeList.createEmptyChangeList(myProject, finalName), new Change[] { changeListManager.getChange(fileC) });
checkFilesAreInList(new VirtualFile[] { file, fileB, fileC }, finalName, changeListManager);
checkFilesAreInList(new VirtualFile[] { fileD }, myDefaulListName, changeListManager);
});
checkFilesAreInList(new VirtualFile[] { file, fileB, fileC }, finalName, changeListManager);
checkFilesAreInList(new VirtualFile[] { fileD }, myDefaulListName, changeListManager);
changeListManager.ensureUpToDate(false);
checkFilesAreInList(new VirtualFile[] { file, fileB, fileC }, finalName, changeListManager);
checkFilesAreInList(new VirtualFile[] { fileD }, myDefaulListName, changeListManager);
}
use of com.intellij.openapi.vcs.changes.ChangeListManager in project intellij-community by JetBrains.
the class SvnConcurrentChangeListManagerTest method testRemove.
@Test
public void testRemove() throws Exception {
enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
final VirtualFile file = createFileInCommand("a.txt", "old content");
final VirtualFile fileB = createFileInCommand("b.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) });
myScheme.doTest(() -> {
changeListManager.removeChangeList(list.getName());
assert changeListManager.findChangeList(list.getName()) == null;
checkFilesAreInList(new VirtualFile[] { file, fileB }, myDefaulListName, changeListManager);
});
assert changeListManager.findChangeList(list.getName()) == null;
checkFilesAreInList(new VirtualFile[] { file, fileB }, myDefaulListName, changeListManager);
changeListManager.ensureUpToDate(false);
assert changeListManager.findChangeList(list.getName()) == null;
checkFilesAreInList(new VirtualFile[] { file, fileB }, myDefaulListName, changeListManager);
}
Aggregations