简体   繁体   English

由于在jGit中进行了某些提交,如何获取所有更改的文件?

[英]How to get all changed files since some commit in jGit?

TreeWalk allows to get all changes in single commit or in whole repository and checking changed files for each commit (by RevWalk) works really slow, about 2 minutes. TreeWalk允许在单个提交或整个存储库中获取所有更改,并且检查每个提交的更改文件(由RevWalk进行)的工作确实很慢,大约需要2分钟。 Is there any method to walk through changed files and check in which commit they has been changed last time? 有什么方法可以浏览更改的文件并检查上次更改的提交? Or other faster solution? 还是其他更快的解决方案? Here is my code for getting changed files from commit: 这是我的从提交获取更改文件的代码:

TreeWalk treeWalk = prepareTreeWalk(commit, git.getRepository());
List<String> files = new ArrayList<>();
while (treeWalk.next()) {
  if (!hasSimilar(treeWalk)) {
    files.add(treeWalk.getPathString());
  }
}

and for selecting commits (since some special): 和选择提交(因为有些特殊):

return Lists.reverse(StreamSupport.stream(
  git.log()
  .add(git.getRepository().resolve(branch.getName()))
  .call()
  .spliterator(), false)
    .filter(since(sinceCommit::equals))
    .collect(Collectors.toList()));

I know command line below, it will print the output within ms 我知道下面的命令行,它将在ms内打印输出

git format-patch initial-commit --stdout > output.patch git format-patch初始提交--stdout> output.patch

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM