return list;\r
}\r
\r
+ /**\r
+ * Returns the list of files changed in a specified commit. If the\r
+ * repository does not exist or is empty, an empty list is returned.\r
+ *\r
+ * @param repository\r
+ * @param startCommit\r
+ * earliest commit\r
+ * @param endCommit\r
+ * most recent commit. if null, HEAD is assumed.\r
+ * @return list of files changed in a commit range\r
+ */\r
+ public static List<PathChangeModel> getFilesInRange(Repository repository, String startCommit, String endCommit) {\r
+ List<PathChangeModel> list = new ArrayList<PathChangeModel>();\r
+ if (!hasCommits(repository)) {\r
+ return list;\r
+ }\r
+ try {\r
+ ObjectId startRange = repository.resolve(startCommit);\r
+ ObjectId endRange = repository.resolve(endCommit);\r
+ RevWalk rw = new RevWalk(repository);\r
+ RevCommit start = rw.parseCommit(startRange);\r
+ RevCommit end = rw.parseCommit(endRange);\r
+ list.addAll(getFilesInRange(repository, start, end));\r
+ rw.release();\r
+ } catch (Throwable t) {\r
+ error(t, repository, "{0} failed to determine files in range {1}..{2}!", startCommit, endCommit);\r
+ }\r
+ return list;\r
+ }\r
+\r
/**\r
* Returns the list of files changed in a specified commit. If the\r
* repository does not exist or is empty, an empty list is returned.\r
\r
List<DiffEntry> diffEntries = df.scan(startCommit.getTree(), endCommit.getTree());\r
for (DiffEntry diff : diffEntries) {\r
- PathChangeModel pcm = PathChangeModel.from(diff, null);\r
+ PathChangeModel pcm = PathChangeModel.from(diff, endCommit.getName());\r
list.add(pcm);\r
}\r
Collections.sort(list);\r