revcommit有一个getCommitTime()方法,但它返回int,并且没有作者时间。如何从revcomit中获取作者和提交日期?

最佳答案

就像这样:

RevCommit commit = ...;

PersonIdent authorIdent = commit.getAuthorIdent();
Date authorDate = authorIdent.getWhen();
TimeZone authorTimeZone = authorIdent.getTimeZone();

PersonIdent committerIdent = commit.getCommitterIdent();
...

另请参见API documentation

09-04 09:13