jgit如何获得两个日期之间发生的所有提交 [英] jgit how can i get all the commits that occurred between two dates

查看:506
本文介绍了jgit如何获得两个日期之间发生的所有提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

或者只是在两个日期之间发生的所有提交?在SVN中,你可以做一些像 svn diff -r {date}:{date} 来做到这一点!

解决方案

您可以参考 JGit测试类 RevWalkFilterTest.java

  Date since = getClock(); 
Date until = getClock();
RevFilter between = CommitTimeRevFilter.between(since,until);

它使用类 org.eclipse.jgit.revwalk.filter.CommitTimeRevFilter


Or just all the commits that occurred between two dates? In SVN, you could do something like svn diff -r{date}:{date} to do it!

解决方案

You can take example of this JGit test class RevWalkFilterTest.java:

Date since = getClock();
Date until = getClock();
RevFilter between = CommitTimeRevFilter.between(since, until);

It uses the class org.eclipse.jgit.revwalk.filter.CommitTimeRevFilter.

这篇关于jgit如何获得两个日期之间发生的所有提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆