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


Java GitRepository.isFresh方法代码示例

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


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

示例1: getDefaultTarget

import git4idea.repo.GitRepository; //导入方法依赖的package包/类
@Nullable
@Override
public GitPushTarget getDefaultTarget(@NotNull GitRepository repository) {
  if (repository.isFresh()) {
    return null;
  }
  GitLocalBranch currentBranch = repository.getCurrentBranch();
  if (currentBranch == null) {
    return null;
  }

  GitPushTarget persistedTarget = getPersistedTarget(repository, currentBranch);
  if (persistedTarget != null) {
    return persistedTarget;
  }

  GitPushTarget pushSpecTarget = GitPushTarget.getFromPushSpec(repository, currentBranch);
  if (pushSpecTarget != null) {
    return pushSpecTarget;
  }

  GitBranchTrackInfo trackInfo = GitBranchUtil.getTrackInfoForBranch(repository, currentBranch);
  if (trackInfo != null) {
    return new GitPushTarget(trackInfo.getRemoteBranch(), false);
  }
  return proposeTargetForNewBranch(repository, currentBranch);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:GitPushSupport.java

示例2: isRepositoryReady

import git4idea.repo.GitRepository; //导入方法依赖的package包/类
private boolean isRepositoryReady(@NotNull VirtualFile root) {
  GitRepository repository = getRepository(root);
  if (repository == null) {
    LOG.error("Repository not found for root " + root);
    return false;
  }
  else if (repository.isFresh()) {
    LOG.info("Fresh repository: " + root);
    return false;
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:GitLogProvider.java

示例3: update

import git4idea.repo.GitRepository; //导入方法依赖的package包/类
@Override
public void update(@NotNull AnActionEvent e) {
  super.update(e);
  Presentation presentation = e.getPresentation();
  Project project = e.getProject();
  if (project == null) {
    presentation.setEnabled(false);
    presentation.setVisible(false);
    return;
  }

  VirtualFile[] vFiles = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
  if (vFiles == null || vFiles.length != 1 || vFiles[0] == null) { // only 1 file for now
    presentation.setEnabled(false);
    presentation.setVisible(true);
    return;
  }

  GitRepositoryManager manager = GitUtil.getRepositoryManager(project);

  GitRepository repository = manager.getRepositoryForFile(vFiles[0]);
  if (repository == null || repository.isFresh() || noBranchesToCompare(repository)) {
    presentation.setEnabled(false);
    presentation.setVisible(true);
    return;
  }

  presentation.setEnabled(true);
  presentation.setVisible(true);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:GitCompareWithBranchAction.java

示例4: isRebaseAllowed

import git4idea.repo.GitRepository; //导入方法依赖的package包/类
private static boolean isRebaseAllowed(@NotNull Project project, @NotNull Collection<GitRepository> repositories) {
  // TODO links to 'rebase', 'resolve conflicts', etc.
  for (GitRepository repository : repositories) {
    Repository.State state = repository.getState();
    String in = GitUtil.mention(repository);
    String message = null;
    switch (state) {
      case NORMAL:
        if (repository.isFresh()) {
          message = "Repository" + in + " is empty.";
        }
        break;
      case MERGING:
        message = "There is an unfinished merge process" + in + ".<br/>You should complete the merge before starting a rebase";
        break;
      case REBASING:
        message = "There is an unfinished rebase process" + in + ".<br/>You should complete it before starting another rebase";
        break;
      case GRAFTING:
        message = "There is an unfinished cherry-pick process" + in + ".<br/>You should finish it before starting a rebase.";
        break;
      case DETACHED:
        message = "You are in the detached HEAD state" + in + ".<br/>Rebase is not possible.";
        break;
      default:
        LOG.error("Unknown state [" + state.name() + "]");
        message = "Rebase is not possible" + in;
    }
    if (message != null) {
      VcsNotifier.getInstance(project).notifyError("Rebase not Allowed", message);
      return false;
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:GitRebaseUtils.java

示例5: canShowHistoryFor

import git4idea.repo.GitRepository; //导入方法依赖的package包/类
@Override
public boolean canShowHistoryFor(@NotNull VirtualFile file) {
  GitRepositoryManager manager = GitUtil.getRepositoryManager(myProject);
  GitRepository repository = manager.getRepositoryForFile(file);
  return repository != null && !repository.isFresh();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:GitHistoryProvider.java


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