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));
}
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();
}
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);
}
Aggregations