當前位置: 首頁>>代碼示例>>Java>>正文


Java CanonicalTreeParser.next方法代碼示例

本文整理匯總了Java中org.eclipse.jgit.treewalk.CanonicalTreeParser.next方法的典型用法代碼示例。如果您正苦於以下問題:Java CanonicalTreeParser.next方法的具體用法?Java CanonicalTreeParser.next怎麽用?Java CanonicalTreeParser.next使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jgit.treewalk.CanonicalTreeParser的用法示例。


在下文中一共展示了CanonicalTreeParser.next方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processTreeParser

import org.eclipse.jgit.treewalk.CanonicalTreeParser; //導入方法依賴的package包/類
private void processTreeParser(CanonicalTreeParser treeParser)
		throws IOException {
	TreeParserTreeEntry treeParserEntry = new TreeParserTreeEntry(
			treeParser, objectReader);

	List<CanonicalTreeParser> subTrees = new ArrayList<CanonicalTreeParser>();
	while (!treeParser.eof()) {
		FileMode entryFileMode = treeParser.getEntryFileMode();
		if (FileMode.TREE.equals(entryFileMode)) {
			CanonicalTreeParser canonicalTreeParser = new CanonicalTreeParser();
			canonicalTreeParser.reset(objectReader,
					treeParser.getEntryObjectId());
			subTrees.add(canonicalTreeParser);
		} else {
			if (!filterPredicate.evaluate(treeParserEntry)) {
				treeEntryWalk.walk(treeParserEntry);
			}
		}
		treeParser.next();
	}
	for (CanonicalTreeParser subTreeParser : subTrees) {
		processTreeParser(subTreeParser);
	}
}
 
開發者ID:link-intersystems,項目名稱:GitDirStat,代碼行數:25,代碼來源:TreeParserTreeEntryWalkAdapter.java

示例2: loadTree

import org.eclipse.jgit.treewalk.CanonicalTreeParser; //導入方法依賴的package包/類
@NotNull
public Iterable<GitTreeEntry> loadTree(@Nullable GitTreeEntry tree) throws IOException {
  final GitObject<ObjectId> treeId = getTreeObject(tree);
  // Loading tree.
  if (treeId == null) {
    return Collections.emptyList();
  }
  final List<GitTreeEntry> result = new ArrayList<>();
  final Repository repo = treeId.getRepo();
  final CanonicalTreeParser treeParser = new CanonicalTreeParser(GitRepository.emptyBytes, repo.newObjectReader(), treeId.getObject());
  while (!treeParser.eof()) {
    result.add(new GitTreeEntry(
        treeParser.getEntryFileMode(),
        new GitObject<>(repo, treeParser.getEntryObjectId()),
        treeParser.getEntryPathString()
    ));
    treeParser.next();
  }
  return result;
}
 
開發者ID:bozaro,項目名稱:git-as-svn,代碼行數:21,代碼來源:GitRepository.java

示例3: loadOriginalCommit

import org.eclipse.jgit.treewalk.CanonicalTreeParser; //導入方法依賴的package包/類
@Nullable
public static RevCommit loadOriginalCommit(@NotNull ObjectReader reader, @Nullable ObjectId cacheCommit) throws IOException {
  final RevWalk revWalk = new RevWalk(reader);
  if (cacheCommit != null) {
    final RevCommit revCommit = revWalk.parseCommit(cacheCommit);
    revWalk.parseTree(revCommit.getTree());

    final CanonicalTreeParser treeParser = new CanonicalTreeParser(GitRepository.emptyBytes, reader, revCommit.getTree());
    while (!treeParser.eof()) {
      if (treeParser.getEntryPathString().equals(ENTRY_COMMIT_REF)) {
        return revWalk.parseCommit(treeParser.getEntryObjectId());
      }
      treeParser.next();
    }
  }
  return null;
}
 
開發者ID:bozaro,項目名稱:git-as-svn,代碼行數:18,代碼來源:LayoutHelper.java

示例4: useCanonicalTreeParser

import org.eclipse.jgit.treewalk.CanonicalTreeParser; //導入方法依賴的package包/類
private void useCanonicalTreeParser(ObjectId id) throws IOException {
    CanonicalTreeParser treeParser = new CanonicalTreeParser();
    RevTree tree = new RevWalk(repo).lookupTree(id);
    treeParser.reset(repo.getObjectDatabase().newReader(), tree);
    System.out.println("CanonicalTreeParser");
    for (; !treeParser.eof(); treeParser = treeParser.next()) {
        ObjectId newObjectId = treeParser.getEntryObjectId();
        String entryPath = treeParser.getEntryPathString();
        System.out.println(newObjectId + " entryPath=" + entryPath + " subTree=" + TREE.equals(treeParser
                .getEntryFileMode()));
    }
}
 
開發者ID:m4rzEE1,項目名稱:ninja_chic-,代碼行數:13,代碼來源:TreeSummaryViewTest.java

示例5: contentFromTree

import org.eclipse.jgit.treewalk.CanonicalTreeParser; //導入方法依賴的package包/類
private String contentFromTree(RevTree tree) {
    try {
        final ObjectReader reader = gitRepo.newObjectReader();
        CanonicalTreeParser parser = new CanonicalTreeParser();
        parser.reset(reader, tree);

        String lastPath = null;
        while (true) {
            final String path = parser.getEntryPathString();
            parser = parser.next();
            if (path.equals(lastPath)) {
                break;
            }

            lastPath = path;

            if (path.equals(CRUISE_CONFIG_XML)) {
                final ObjectId id = parser.getEntryObjectId();
                final ObjectLoader loader = reader.open(id);
                return new String(loader.getBytes());
            }
        }
        return null;
    } catch (IOException e) {
        LOGGER.error("Could not fetch content from the config repository found at path '{}'", workingDir.getAbsolutePath(), e);
        throw new RuntimeException("Error while fetching content from the config repository.", e);
    }
}
 
開發者ID:gocd,項目名稱:gocd,代碼行數:29,代碼來源:ConfigRepository.java

示例6: hasSingleTreeEntry

import org.eclipse.jgit.treewalk.CanonicalTreeParser; //導入方法依賴的package包/類
private boolean hasSingleTreeEntry(TreeWalk tw) throws IOException {
  if (count != 1 || !FileMode.TREE.equals(tw.getRawMode(0))) {
    return false;
  }
  CanonicalTreeParser p = new CanonicalTreeParser();
  p.reset(tw.getObjectReader(), tw.getObjectId(0));
  p.next();
  return p.eof();
}
 
開發者ID:afrojer,項目名稱:gitiles,代碼行數:10,代碼來源:PathServlet.java

示例7: getOnlyChildSubtree

import org.eclipse.jgit.treewalk.CanonicalTreeParser; //導入方法依賴的package包/類
private CanonicalTreeParser getOnlyChildSubtree(RevWalk rw, ObjectId id, byte[] prefix)
    throws IOException {
  CanonicalTreeParser p = new CanonicalTreeParser(prefix, rw.getObjectReader(), id);
  if (p.eof() || p.getEntryFileMode() != FileMode.TREE) {
    return null;
  }
  p.next(1);
  return p.eof() ? p : null;
}
 
開發者ID:afrojer,項目名稱:gitiles,代碼行數:10,代碼來源:PathServlet.java


注:本文中的org.eclipse.jgit.treewalk.CanonicalTreeParser.next方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。