Search in sources :

Example 6 with LocalChangeList

use of com.intellij.openapi.vcs.changes.LocalChangeList 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());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList) ChangeListManager(com.intellij.openapi.vcs.changes.ChangeListManager) Test(org.junit.Test)

Example 7 with LocalChangeList

use of com.intellij.openapi.vcs.changes.LocalChangeList 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);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList) ChangeListManager(com.intellij.openapi.vcs.changes.ChangeListManager) Test(org.junit.Test)

Example 8 with LocalChangeList

use of com.intellij.openapi.vcs.changes.LocalChangeList 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());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList) ChangeListManager(com.intellij.openapi.vcs.changes.ChangeListManager) Test(org.junit.Test)

Example 9 with LocalChangeList

use of com.intellij.openapi.vcs.changes.LocalChangeList in project intellij-community by JetBrains.

the class AddChangeListAction method actionPerformed.

public void actionPerformed(AnActionEvent e) {
    Project project = e.getData(CommonDataKeys.PROJECT);
    NewChangelistDialog dlg = new NewChangelistDialog(project);
    dlg.show();
    if (dlg.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
        String name = dlg.getName();
        if (name.length() == 0) {
            name = getUniqueName(project);
        }
        final LocalChangeList list = ChangeListManager.getInstance(project).addChangeList(name, dlg.getDescription());
        if (dlg.isNewChangelistActive()) {
            ChangeListManager.getInstance(project).setDefaultChangeList(list);
        }
        dlg.getPanel().changelistCreatedOrChanged(list);
    }
}
Also used : Project(com.intellij.openapi.project.Project) NewChangelistDialog(com.intellij.openapi.vcs.changes.ui.NewChangelistDialog) LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList)

Example 10 with LocalChangeList

use of com.intellij.openapi.vcs.changes.LocalChangeList in project intellij-community by JetBrains.

the class ChangeListChooserPanel method updateDescription.

private void updateDescription() {
    LocalChangeList list = getExistingChangelistByName(myListPanel.getChangeListName());
    String newText = list != null ? list.getComment() : myLastTypedDescription;
    if (!StringUtil.equals(myListPanel.getDescription(), newText)) {
        myListPanel.setDescription(newText);
    }
}
Also used : LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList)

Aggregations

LocalChangeList (com.intellij.openapi.vcs.changes.LocalChangeList)44 ChangeListManager (com.intellij.openapi.vcs.changes.ChangeListManager)25 VirtualFile (com.intellij.openapi.vfs.VirtualFile)23 Test (org.junit.Test)20 Project (com.intellij.openapi.project.Project)8 Change (com.intellij.openapi.vcs.changes.Change)7 ChangeList (com.intellij.openapi.vcs.changes.ChangeList)5 TaskManager (com.intellij.tasks.TaskManager)3 List (java.util.List)3 Nullable (org.jetbrains.annotations.Nullable)3 ContentRevision (com.intellij.openapi.vcs.changes.ContentRevision)2 ChangeListInfo (com.intellij.tasks.ChangeListInfo)2 ArrayList (java.util.ArrayList)2 NotNull (org.jetbrains.annotations.NotNull)2 DataManager (com.intellij.ide.DataManager)1 Disposable (com.intellij.openapi.Disposable)1 com.intellij.openapi.actionSystem (com.intellij.openapi.actionSystem)1 Presentation (com.intellij.openapi.actionSystem.Presentation)1 ComboBoxAction (com.intellij.openapi.actionSystem.ex.ComboBoxAction)1 DumbAware (com.intellij.openapi.project.DumbAware)1