Search in sources :

Example 1 with GitMultiRootBranchConfig

use of git4idea.ui.branch.GitMultiRootBranchConfig in project intellij-community by JetBrains.

the class GitBranchUtil method getCurrentBranchOrRev.

@NotNull
static String getCurrentBranchOrRev(@NotNull Collection<GitRepository> repositories) {
    if (repositories.size() > 1) {
        GitMultiRootBranchConfig multiRootBranchConfig = new GitMultiRootBranchConfig(repositories);
        String currentBranch = multiRootBranchConfig.getCurrentBranch();
        LOG.assertTrue(currentBranch != null, "Repositories have unexpectedly diverged. " + multiRootBranchConfig);
        return currentBranch;
    } else {
        assert !repositories.isEmpty() : "No repositories passed to GitBranchOperationsProcessor.";
        GitRepository repository = repositories.iterator().next();
        return getBranchNameOrRev(repository);
    }
}
Also used : GitRepository(git4idea.repo.GitRepository) GitMultiRootBranchConfig(git4idea.ui.branch.GitMultiRootBranchConfig) ObjectUtils.assertNotNull(com.intellij.util.ObjectUtils.assertNotNull) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ObjectUtils.assertNotNull (com.intellij.util.ObjectUtils.assertNotNull)1 GitRepository (git4idea.repo.GitRepository)1 GitMultiRootBranchConfig (git4idea.ui.branch.GitMultiRootBranchConfig)1 NotNull (org.jetbrains.annotations.NotNull)1