Search in sources :

Example 1 with Repository

use of com.intellij.dvcs.repo.Repository in project intellij-community by JetBrains.

the class TaskBranchesTest method testBranchBloating.

public void testBranchBloating() throws Exception {
    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);
    repository.update();
    assertEquals(2, localTask.getBranches().size());
    assertEquals(1, defaultTask.getBranches().size());
    myTaskManager.activateTask(localTask, false);
    LocalTaskImpl bar = myTaskManager.createLocalTask("bar");
    LocalTask barTask = myTaskManager.activateTask(bar, false);
    myTaskManager.createBranch(localTask, defaultTask, myTaskManager.suggestBranchName(barTask), null);
    repository.update();
    assertEquals(1, defaultTask.getBranches().size());
}
Also used : Repository(com.intellij.dvcs.repo.Repository) LocalTaskImpl(com.intellij.tasks.impl.LocalTaskImpl) LocalTask(com.intellij.tasks.LocalTask)

Example 2 with Repository

use of com.intellij.dvcs.repo.Repository in project intellij-community by JetBrains.

the class TaskBranchesTest method testTaskManager.

public void testTaskManager() throws Exception {
    List<Repository> repositories = initRepositories("community", "idea");
    LocalTask defaultTask = myTaskManager.getActiveTask();
    assertNotNull(defaultTask);
    LocalTaskImpl foo = myTaskManager.createLocalTask("foo");
    LocalTask localTask = myTaskManager.activateTask(foo, false);
    myTaskManager.createBranch(localTask, defaultTask, myTaskManager.suggestBranchName(localTask), null);
    String defaultBranchName = getDefaultBranchName();
    assertEquals(4, localTask.getBranches().size());
    assertEquals(2, localTask.getBranches(true).size());
    assertEquals(2, localTask.getBranches(false).size());
    assertEquals(2, defaultTask.getBranches().size());
    myTaskManager.activateTask(defaultTask, false);
    Repository repository = repositories.get(0);
    assertEquals(defaultBranchName, repository.getCurrentBranchName());
    foo = myTaskManager.createLocalTask("foo");
    localTask = myTaskManager.activateTask(foo, false);
    myTaskManager.createBranch(localTask, defaultTask, myTaskManager.suggestBranchName(localTask), null);
    assertEquals("foo", repository.getCurrentBranchName());
    createAndCommitChanges(repository);
    myTaskManager.mergeBranch(localTask);
    repository.update();
    assertEquals(defaultBranchName, repository.getCurrentBranchName());
    assertEquals(1, getNumberOfBranches(repository));
    myTaskManager.activateTask(defaultTask, false);
    myTaskManager.activateTask(foo, false);
}
Also used : Repository(com.intellij.dvcs.repo.Repository) LocalTaskImpl(com.intellij.tasks.impl.LocalTaskImpl) LocalTask(com.intellij.tasks.LocalTask)

Example 3 with Repository

use of com.intellij.dvcs.repo.Repository in project intellij-community by JetBrains.

the class TaskBranchesTest method testCommit.

public void testCommit() throws Exception {
    Repository repository = initRepository("foo");
    LocalTask defaultTask = myTaskManager.getActiveTask();
    LocalTaskImpl foo = myTaskManager.createLocalTask("foo");
    final LocalTask localTask = myTaskManager.activateTask(foo, false);
    myTaskManager.createBranch(localTask, defaultTask, myTaskManager.suggestBranchName(localTask), null);
    createAndCommitChanges(repository);
    myTaskManager.mergeBranch(localTask);
    repository.update();
    assertEquals(getDefaultBranchName(), repository.getCurrentBranchName());
    assertEquals(1, getNumberOfBranches(repository));
}
Also used : Repository(com.intellij.dvcs.repo.Repository) LocalTaskImpl(com.intellij.tasks.impl.LocalTaskImpl) LocalTask(com.intellij.tasks.LocalTask)

Example 4 with Repository

use of com.intellij.dvcs.repo.Repository 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 5 with Repository

use of com.intellij.dvcs.repo.Repository in project intellij-community by JetBrains.

the class PushController method startLoadingCommits.

private void startLoadingCommits() {
    Map<RepositoryNode, MyRepoModel> priorityLoading = ContainerUtil.newLinkedHashMap();
    Map<RepositoryNode, MyRepoModel> others = ContainerUtil.newLinkedHashMap();
    RepositoryNode nodeForCurrentEditor = findNodeByRepo(myCurrentlyOpenedRepository);
    for (Map.Entry<RepositoryNode, MyRepoModel<?, ?, ?>> entry : myView2Model.entrySet()) {
        MyRepoModel model = entry.getValue();
        Repository repository = model.getRepository();
        RepositoryNode repoNode = entry.getKey();
        if (preselectByUser(repository)) {
            priorityLoading.put(repoNode, model);
        } else if (model.getSupport().shouldRequestIncomingChangesForNotCheckedRepositories() && !repoNode.equals(nodeForCurrentEditor)) {
            others.put(repoNode, model);
        }
        if (shouldPreSelect(model)) {
            model.setChecked(true);
        }
    }
    if (nodeForCurrentEditor != null) {
        //add repo for currently opened editor to the end of priority queue
        priorityLoading.put(nodeForCurrentEditor, myView2Model.get(nodeForCurrentEditor));
    }
    loadCommitsFromMap(priorityLoading);
    loadCommitsFromMap(others);
}
Also used : Repository(com.intellij.dvcs.repo.Repository)

Aggregations

Repository (com.intellij.dvcs.repo.Repository)9 LocalTask (com.intellij.tasks.LocalTask)4 LocalTaskImpl (com.intellij.tasks.impl.LocalTaskImpl)4 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 VcsPushDialog (com.intellij.dvcs.push.ui.VcsPushDialog)1 VcsRepositoryManager (com.intellij.dvcs.repo.VcsRepositoryManager)1 Project (com.intellij.openapi.project.Project)1 VcsTaskHandler (com.intellij.openapi.vcs.VcsTaskHandler)1 BranchInfo (com.intellij.tasks.BranchInfo)1 GitRepository (git4idea.repo.GitRepository)1 FutureTask (java.util.concurrent.FutureTask)1