throws IOException {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_YEAR, -1);
Date oneDayAgo = cal.getTime();
CommitService commits = new CommitService();
if (token != null)
commits.getClient().setOAuth2Token(token);
else
commits.getClient().setCredentials(username, password);
final List<Commit> ret = new ArrayList<Commit>();
RepositoryId repositoryId = new RepositoryId(owner, repository);
for (RepositoryCommit curCommit : commits.pageCommits(repositoryId, 30)
.next()) {
if (curCommit.getCommit().getCommitter().getDate().after(oneDayAgo)) {
RepositoryCommit fullCommit = fullCommits.get(curCommit
.getSha());
if (fullCommit == null) {
fullCommit = commits.getCommit(repositoryId,
curCommit.getSha());
fullCommits.put(curCommit.getSha(), fullCommit);
}
curCommit = fullCommit;
}