org.eclipse.jgit.lib.Repository.getAllRefsByPeeledObjectId()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中org.eclipse.jgit.lib.Repository.getAllRefsByPeeledObjectId方法的一些代码示例,展示了Repository.getAllRefsByPeeledObjectId的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Repository.getAllRefsByPeeledObjectId方法的具体详情如下:
包路径:org.eclipse.jgit.lib.Repository
类名称:Repository
方法名:getAllRefsByPeeledObjectId

Repository.getAllRefsByPeeledObjectId介绍

[英]Get a map with all objects referenced by a peeled ref.
[中]获取一张地图,地图上的所有对象都被一个剥离的引用引用。

代码示例

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

private Ref[] getRefs(AnyObjectId commitId) {
  if (reverseRefMap == null) {
    reverseRefMap = repository.getAllRefsByPeeledObjectId();
    for (Map.Entry<AnyObjectId, Set<Ref>> entry : additionalRefMap
        .entrySet()) {
      Set<Ref> set = reverseRefMap.get(entry.getKey());
      Set<Ref> additional = entry.getValue();
      if (set != null) {
        if (additional.size() == 1) {
          // It's an unmodifiable singleton set...
          additional = new HashSet<>(additional);
        }
        additional.addAll(set);
      }
      reverseRefMap.put(entry.getKey(), additional);
    }
    additionalRefMap.clear();
    additionalRefMap = null;
  }
  Collection<Ref> list = reverseRefMap.get(commitId);
  if (list == null) {
    return PlotCommit.NO_REFS;
  } else {
    Ref[] tags = list.toArray(new Ref[0]);
    Arrays.sort(tags, new PlotRefComparator());
    return tags;
  }
}

代码示例来源:origin: sonia.jgit/org.eclipse.jgit

/**
 * Create a new revision walker for a given repository.
 *
 * @param repo
 *            the repository the walker will obtain data from.
 */
public PlotWalk(final Repository repo) {
  super(repo);
  super.sort(RevSort.TOPO, true);
  reverseRefMap = repo.getAllRefsByPeeledObjectId();
}

代码示例来源:origin: berlam/github-bucket

private Ref[] getRefs(AnyObjectId commitId) {
  if (reverseRefMap == null) {
    reverseRefMap = repository.getAllRefsByPeeledObjectId();
    for (Map.Entry<AnyObjectId, Set<Ref>> entry : additionalRefMap
        .entrySet()) {
      Set<Ref> set = reverseRefMap.get(entry.getKey());
      Set<Ref> additional = entry.getValue();
      if (set != null) {
        if (additional.size() == 1) {
          // It's an unmodifiable singleton set...
          additional = new HashSet<>(additional);
        }
        additional.addAll(set);
      }
      reverseRefMap.put(entry.getKey(), additional);
    }
    additionalRefMap.clear();
    additionalRefMap = null;
  }
  Collection<Ref> list = reverseRefMap.get(commitId);
  if (list == null) {
    return PlotCommit.NO_REFS;
  } else {
    Ref[] tags = list.toArray(new Ref[0]);
    Arrays.sort(tags, new PlotRefComparator());
    return tags;
  }
}

代码示例来源:origin: sonia.scm.plugins/scm-git-plugin

/**
 * Method description
 *
 *
 * @param commit
 *
 * @return
 *
 * @throws IOException
 */
public Changeset createChangeset(RevCommit commit) throws IOException
{
 List<String> branches = Lists.newArrayList();
 Set<Ref> refs = repository.getAllRefsByPeeledObjectId().get(commit.getId());
 if (Util.isNotEmpty(refs))
 {
  for (Ref ref : refs)
  {
   String branch = GitUtil.getBranch(ref);
   if (branch != null)
   {
    branches.add(branch);
   }
  }
 }
 return createChangeset(commit, branches);
}

代码示例来源:origin: com.madgag/org.eclipse.jgit.pgm

.getAllRefsByPeeledObjectId();

相关文章

Repository类方法