当前位置: 首页>>代码示例>>Java>>正文


Java GitRepository.isOnBranch方法代码示例

本文整理汇总了Java中git4idea.repo.GitRepository.isOnBranch方法的典型用法代码示例。如果您正苦于以下问题:Java GitRepository.isOnBranch方法的具体用法?Java GitRepository.isOnBranch怎么用?Java GitRepository.isOnBranch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在git4idea.repo.GitRepository的用法示例。


在下文中一共展示了GitRepository.isOnBranch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDetachedRoot

import git4idea.repo.GitRepository; //导入方法依赖的package包/类
/**
 * Scans the Git roots, selected for commit, for the root which is on a detached HEAD.
 * Returns null, if all repositories are on the branch.
 * There might be several detached repositories, - in that case only one is returned.
 * This is because the situation is very rare, while it requires a lot of additional effort of making a well-formed message.
 */
@Nullable
private DetachedRoot getDetachedRoot() {
  GitRepositoryManager repositoryManager = GitUtil.getRepositoryManager(myPanel.getProject());
  for (VirtualFile root : getSelectedRoots()) {
    GitRepository repository = repositoryManager.getRepositoryForRoot(root);
    if (repository == null) {
      continue;
    }
    if (!repository.isOnBranch()) {
      return new DetachedRoot(root, repository.isRebaseInProgress());
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:GitCheckinHandlerFactory.java

示例2: noBranchesToCompare

import git4idea.repo.GitRepository; //导入方法依赖的package包/类
private static boolean noBranchesToCompare(@NotNull GitRepository repository) {
  int locals = repository.getBranches().getLocalBranches().size();
  boolean haveRemotes = !repository.getBranches().getRemoteBranches().isEmpty();
  if (repository.isOnBranch()) {  // there are other branches to compare
    return locals < 2 && !haveRemotes;
  }
  return locals == 0 && !haveRemotes; // there are at least 1 branch to compare
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:GitCompareWithBranchAction.java


注:本文中的git4idea.repo.GitRepository.isOnBranch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。