本文整理匯總了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()));
}
}
示例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);
}
}