From f4759059d4c363f5bd42550c9c35dd21f4d2bf41 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Sat, 17 Dec 2011 14:03:35 -0500
Subject: [PATCH] Fixed sendemail script to list all commits in a push.

---
 src/com/gitblit/utils/JGitUtils.java |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/src/com/gitblit/utils/JGitUtils.java b/src/com/gitblit/utils/JGitUtils.java
index 99c2d0a..31fd08f 100644
--- a/src/com/gitblit/utils/JGitUtils.java
+++ b/src/com/gitblit/utils/JGitUtils.java
@@ -965,6 +965,43 @@
 	}
 
 	/**
+	 * Returns a list of commits for the repository within the range specified
+	 * by startRangeId and endRangeId. If the repository does not exist or is
+	 * empty, an empty list is returned.
+	 * 
+	 * @param repository
+	 * @param startRangeId
+	 *            the first commit (not included in results)
+	 * @param endRangeId
+	 *            the end commit (included in results)
+	 * @return a list of commits
+	 */
+	public static List<RevCommit> getRevLog(Repository repository, String startRangeId,
+			String endRangeId) {
+		List<RevCommit> list = new ArrayList<RevCommit>();
+		if (!hasCommits(repository)) {
+			return list;
+		}
+		try {
+			ObjectId endRange = repository.resolve(endRangeId);
+			ObjectId startRange = repository.resolve(startRangeId);
+
+			RevWalk rw = new RevWalk(repository);
+			rw.markStart(rw.parseCommit(endRange));
+			rw.markUninteresting(rw.parseCommit(startRange));
+
+			Iterable<RevCommit> revlog = rw;
+			for (RevCommit rev : revlog) {
+				list.add(rev);
+			}
+			rw.dispose();
+		} catch (Throwable t) {
+			error(t, repository, "{0} failed to get revlog for {1}..{2}", startRangeId, endRangeId);
+		}
+		return list;
+	}
+
+	/**
 	 * Search the commit history for a case-insensitive match to the value.
 	 * Search results require a specified SearchType of AUTHOR, COMMITTER, or
 	 * COMMIT. Results may be paginated using offset and maxCount. If the

--
Gitblit v1.9.1