本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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;
}
示例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();
}