本文整理汇总了Java中org.eclipse.jgit.dircache.DirCacheEditor.PathEdit方法的典型用法代码示例。如果您正苦于以下问题:Java DirCacheEditor.PathEdit方法的具体用法?Java DirCacheEditor.PathEdit怎么用?Java DirCacheEditor.PathEdit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jgit.dircache.DirCacheEditor
的用法示例。
在下文中一共展示了DirCacheEditor.PathEdit方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPathEdits
import org.eclipse.jgit.dircache.DirCacheEditor; //导入方法依赖的package包/类
@Override
public List<DirCacheEditor.PathEdit> getPathEdits(Repository repository, RevCommit baseCommit)
throws IOException {
try (RevWalk revWalk = new RevWalk(repository)) {
revWalk.parseHeaders(baseCommit);
try (TreeWalk treeWalk =
TreeWalk.forPath(revWalk.getObjectReader(), currentFilePath, baseCommit.getTree())) {
if (treeWalk == null) {
return Collections.emptyList();
}
DirCacheEditor.DeletePath deletePathEdit = new DirCacheEditor.DeletePath(currentFilePath);
AddPath addPathEdit =
new AddPath(newFilePath, treeWalk.getFileMode(0), treeWalk.getObjectId(0));
return Arrays.asList(deletePathEdit, addPathEdit);
}
}
}
示例2: getPathEdits
import org.eclipse.jgit.dircache.DirCacheEditor; //导入方法依赖的package包/类
private List<DirCacheEditor.PathEdit> getPathEdits(Repository repository) throws IOException {
List<DirCacheEditor.PathEdit> pathEdits = new ArrayList<>();
for (TreeModification treeModification : treeModifications) {
pathEdits.addAll(treeModification.getPathEdits(repository, baseCommit));
}
return pathEdits;
}
示例3: getPathEdits
import org.eclipse.jgit.dircache.DirCacheEditor; //导入方法依赖的package包/类
@Override
public List<DirCacheEditor.PathEdit> getPathEdits(Repository repository, RevCommit baseCommit) {
DirCacheEditor.PathEdit changeContentEdit = new ChangeContent(filePath, newContent, repository);
return Collections.singletonList(changeContentEdit);
}
示例4: getPathEdits
import org.eclipse.jgit.dircache.DirCacheEditor; //导入方法依赖的package包/类
@Override
public List<DirCacheEditor.PathEdit> getPathEdits(Repository repository, RevCommit baseCommit) {
DirCacheEditor.DeletePath deletePathEdit = new DirCacheEditor.DeletePath(filePath);
return Collections.singletonList(deletePathEdit);
}
示例5: createNewTree
import org.eclipse.jgit.dircache.DirCacheEditor; //导入方法依赖的package包/类
private DirCache createNewTree(Repository repository) throws IOException {
DirCache newTree = readBaseTree(repository);
List<DirCacheEditor.PathEdit> pathEdits = getPathEdits(repository);
applyPathEdits(newTree, pathEdits);
return newTree;
}
示例6: applyPathEdits
import org.eclipse.jgit.dircache.DirCacheEditor; //导入方法依赖的package包/类
private static void applyPathEdits(DirCache tree, List<DirCacheEditor.PathEdit> pathEdits) {
DirCacheEditor dirCacheEditor = tree.editor();
pathEdits.forEach(dirCacheEditor::add);
dirCacheEditor.finish();
}
示例7: getPathEdits
import org.eclipse.jgit.dircache.DirCacheEditor; //导入方法依赖的package包/类
/**
* Returns a list of {@code PathEdit}s which are necessary in order to achieve the desired
* modification of the Git tree. The order of the {@code PathEdit}s can be crucial and hence
* shouldn't be changed.
*
* @param repository the affected Git repository
* @param baseCommit the commit to whose tree this modification is applied
* @return an ordered list of necessary {@code PathEdit}s
* @throws IOException if problems arise when accessing the repository
*/
List<DirCacheEditor.PathEdit> getPathEdits(Repository repository, RevCommit baseCommit)
throws IOException;