當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。