当前位置: 首页>>代码示例>>Java>>正文


Java DirCacheEditor.PathEdit方法代码示例

本文整理汇总了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);
    }
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:18,代码来源:RenameFileModification.java

示例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;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:8,代码来源:TreeCreator.java

示例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);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:6,代码来源:ChangeFileContentModification.java

示例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);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:6,代码来源:DeleteFileModification.java

示例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;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:7,代码来源:TreeCreator.java

示例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();
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:6,代码来源:TreeCreator.java

示例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;
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:13,代码来源:TreeModification.java


注:本文中的org.eclipse.jgit.dircache.DirCacheEditor.PathEdit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。