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


Java HgUtil.getRepositoryForFile方法代码示例

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


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

示例1: addFile

import org.zmlx.hg4idea.util.HgUtil; //导入方法依赖的package包/类
private void addFile(Map<HgRepository, Set<HgFile>> result, ContentRevision contentRevision) {
  FilePath filePath = contentRevision.getFile();
  // try to find repository from hgFile from change: to be able commit sub repositories as expected
  HgRepository repo = HgUtil.getRepositoryForFile(myProject, contentRevision instanceof HgCurrentBinaryContentRevision
                                                             ? ((HgCurrentBinaryContentRevision)contentRevision).getRepositoryRoot()
                                                             : ChangesUtil.findValidParentAccurately(filePath));
  if (repo == null) {
    return;
  }

  Set<HgFile> hgFiles = result.get(repo);
  if (hgFiles == null) {
    hgFiles = new HashSet<HgFile>();
    result.put(repo, hgFiles);
  }

  hgFiles.add(new HgFile(repo.getRoot(), filePath));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:HgCheckinEnvironment.java

示例2: commitOrWarnAboutConflicts

import org.zmlx.hg4idea.util.HgUtil; //导入方法依赖的package包/类
private void commitOrWarnAboutConflicts(List<VcsException> exceptions, HgCommandResult mergeResult) throws VcsException {
  if (mergeResult.getExitValue() == 0) { //operation successful and no conflicts
    try {
      HgRepository hgRepository = HgUtil.getRepositoryForFile(project, repoRoot);
      if (hgRepository == null) {
        LOG.warn("Couldn't find repository info for " + repoRoot.getName());
        return;
      }
      new HgCommitCommand(project, hgRepository, "Automated merge").execute();
    }
    catch (HgCommandException e) {
      throw new VcsException(e);
    }
  }
  else {
    reportWarning(exceptions, HgVcsMessages.message("hg4idea.update.warning.merge.conflicts", repoRoot.getPath()));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:HgRegularUpdater.java

示例3: process

import org.zmlx.hg4idea.util.HgUtil; //导入方法依赖的package包/类
private Collection<HgChange> process(ChangelistBuilder builder, Collection<FilePath> files) {
  final Set<HgChange> hgChanges = new HashSet<HgChange>();
  for (Map.Entry<VirtualFile, Collection<FilePath>> entry : HgUtil.groupFilePathsByHgRoots(myProject, files).entrySet()) {
    VirtualFile repo = entry.getKey();

    final HgRevisionNumber workingRevision = new HgWorkingCopyRevisionsCommand(myProject).identify(repo).getFirst();
    final HgRevisionNumber parentRevision = new HgWorkingCopyRevisionsCommand(myProject).firstParent(repo);
    final Map<HgFile, HgResolveStatusEnum> list = new HgResolveCommand(myProject).getListSynchronously(repo);

    hgChanges.addAll(new HgStatusCommand.Builder(true).build(myProject).execute(repo, entry.getValue()));
    final HgRepository hgRepo = HgUtil.getRepositoryForFile(myProject, repo);
    if (hgRepo != null && hgRepo.hasSubrepos()) {
      hgChanges.addAll(ContainerUtil.mapNotNull(hgRepo.getSubrepos(), new Function<HgNameWithHashInfo, HgChange>() {
        @Override
        public HgChange fun(HgNameWithHashInfo info) {
          return findChange(hgRepo, info);
        }
      }));
    }

    sendChanges(builder, hgChanges, list, workingRevision, parentRevision);
  }
  return hgChanges;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:HgChangeProvider.java

示例4: findChange

import org.zmlx.hg4idea.util.HgUtil; //导入方法依赖的package包/类
@Nullable
private HgChange findChange(@NotNull HgRepository hgRepo, @NotNull HgNameWithHashInfo info) {
  File file = new File(hgRepo.getRoot().getPath(), info.getName());
  VirtualFile virtualSubrepoFile = VfsUtil.findFileByIoFile(file, false);
  HgRepository subrepo = HgUtil.getRepositoryForFile(myProject, virtualSubrepoFile);
  if (subrepo != null && !info.getHash().asString().equals(subrepo.getCurrentRevision())) {
    return new HgChange(new HgFile(hgRepo.getRoot(), VcsUtil.getFilePath(virtualSubrepoFile)), HgFileStatusEnum.MODIFIED);
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:HgChangeProvider.java


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