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


Java CanonicalTreeParser.getEntryPathString方法代碼示例

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


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

示例1: 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

示例2: 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


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