/** * Search the commits starting at the commit that each tag is referencing. * <p> * Repositories that have no tags will be ignored. * * @return this finder */ public CommitFinder findInTags() { final Repository[] repos = repositories; final int repoCount = repositories.length; Repository repo; for (int i = 0; i < repoCount; i++) { repo = repos[i]; final Collection<RevCommit> commits = CommitUtils.getTags(repo); if (commits.isEmpty()) continue; final RevWalk walk = createWalk(repo); try { walk.markStart(commits); walk(walk); } catch (IOException e) { throw new GitException(e, repo); } finally { walk.close(); } } return this; }
/** * Search the commits starting at the commit that each branch is * referencing. * <p> * Repositories that have no branches will be ignored. * * @return this finder */ public CommitFinder findInBranches() { final Repository[] repos = repositories; final int repoCount = repositories.length; Repository repo; for (int i = 0; i < repoCount; i++) { repo = repos[i]; final Collection<RevCommit> commits = CommitUtils.getBranches(repo); if (commits.isEmpty()) continue; final RevWalk walk = createWalk(repo); try { walk.markStart(commits); walk(walk); } catch (IOException e) { throw new GitException(e, repo); } finally { walk.close(); } } return this; }
/** * Walk the commits between the start commit id and end commit id. * * @param repository * @param start * must be non-null * @param end * @return this service */ protected CommitFinder walk(final Repository repository, final ObjectId start, final ObjectId end) { if (start == null) throw new IllegalArgumentException( Assert.formatNotNull("Starting commit id")); final RevWalk walk = createWalk(repository); try { walk.markStart(walk.parseCommit(start)); if (end != null) walk.markUninteresting(walk.parseCommit(end)); walk(walk); } catch (IOException e) { throw new GitException(e, repository); } finally { walk.close(); } return this; }