Search in sources :

Example 1 with BranchInfo

use of com.intellij.tasks.BranchInfo in project intellij-community by JetBrains.

the class TaskBranchesTest method testCleanupRemovedBranch.

public void testCleanupRemovedBranch() throws InterruptedException {
    Repository repository = initRepository("foo");
    LocalTask defaultTask = myTaskManager.getActiveTask();
    assertNotNull(defaultTask);
    assertEquals(0, defaultTask.getBranches().size());
    LocalTaskImpl foo = myTaskManager.createLocalTask("foo");
    LocalTask localTask = myTaskManager.activateTask(foo, false);
    myTaskManager.createBranch(localTask, defaultTask, myTaskManager.suggestBranchName(localTask), null);
    assertEquals(2, localTask.getBranches().size());
    assertEquals(1, defaultTask.getBranches().size());
    // let's add non-existing branch
    BranchInfo info = new BranchInfo();
    info.name = "non-existing";
    info.repository = defaultTask.getBranches().get(0).repository;
    defaultTask.addBranch(info);
    repository.update();
    assertEquals("foo", repository.getCurrentBranchName());
    myTaskManager.activateTask(defaultTask, false);
    repository.update();
    assertEquals(getDefaultBranchName(), repository.getCurrentBranchName());
    // do not re-create "non-existing"
    assertEquals(2, getNumberOfBranches(repository));
}
Also used : Repository(com.intellij.dvcs.repo.Repository) LocalTaskImpl(com.intellij.tasks.impl.LocalTaskImpl) BranchInfo(com.intellij.tasks.BranchInfo) LocalTask(com.intellij.tasks.LocalTask)

Example 2 with BranchInfo

use of com.intellij.tasks.BranchInfo in project intellij-community by JetBrains.

the class TaskBranchesTest method testOpenTaskDialog.

public void testOpenTaskDialog() throws Exception {
    initRepository("foo");
    String defaultBranchName = getDefaultBranchName();
    LocalTaskImpl task = myTaskManager.createLocalTask("foo");
    OpenTaskDialog dialog = new OpenTaskDialog(getProject(), task);
    Disposer.register(getTestRootDisposable(), dialog.getDisposable());
    try {
        dialog.createTask();
        assertEquals("foo", myTaskManager.getActiveTask().getSummary());
        List<BranchInfo> branches = task.getBranches(true);
        assertEquals(1, branches.size());
        assertEquals(defaultBranchName, branches.get(0).name);
        branches = task.getBranches(false);
        assertEquals(1, branches.size());
        assertEquals("foo", branches.get(0).name);
    } finally {
        dialog.close(DialogWrapper.OK_EXIT_CODE);
    }
    UIUtil.dispatchAllInvocationEvents();
}
Also used : OpenTaskDialog(com.intellij.tasks.actions.OpenTaskDialog) LocalTaskImpl(com.intellij.tasks.impl.LocalTaskImpl) BranchInfo(com.intellij.tasks.BranchInfo)

Example 3 with BranchInfo

use of com.intellij.tasks.BranchInfo in project intellij-community by JetBrains.

the class EditTaskDialog method doOKAction.

@Override
protected void doOKAction() {
    myTask.setSummary(mySummary.getText());
    if (myChangelist.isVisible()) {
        List<ChangeListInfo> changeLists = myTask.getChangeLists();
        changeLists.clear();
        LocalChangeList item = (LocalChangeList) myChangelist.getSelectedItem();
        if (item != null) {
            changeLists.add(new ChangeListInfo(item));
        }
    }
    if (myBranch.isVisible()) {
        List<BranchInfo> branches = myTask.getBranches();
        branches.clear();
        VcsTaskHandler.TaskInfo branch = (VcsTaskHandler.TaskInfo) myBranch.getSelectedItem();
        if (branch != null) {
            List<BranchInfo> infos = BranchInfo.fromTaskInfo(branch, false);
            branches.addAll(infos);
        }
    }
    close(OK_EXIT_CODE);
}
Also used : BranchInfo(com.intellij.tasks.BranchInfo) VcsTaskHandler(com.intellij.openapi.vcs.VcsTaskHandler) LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList) ChangeListInfo(com.intellij.tasks.ChangeListInfo)

Aggregations

BranchInfo (com.intellij.tasks.BranchInfo)3 LocalTaskImpl (com.intellij.tasks.impl.LocalTaskImpl)2 Repository (com.intellij.dvcs.repo.Repository)1 VcsTaskHandler (com.intellij.openapi.vcs.VcsTaskHandler)1 LocalChangeList (com.intellij.openapi.vcs.changes.LocalChangeList)1 ChangeListInfo (com.intellij.tasks.ChangeListInfo)1 LocalTask (com.intellij.tasks.LocalTask)1 OpenTaskDialog (com.intellij.tasks.actions.OpenTaskDialog)1