From 9359865cf1571d69a464387abb2b0b2c4982580d Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Wed, 24 Jul 2013 11:50:50 -0400
Subject: [PATCH] Documentation
---
src/main/java/com/gitblit/utils/ActivityUtils.java | 21 ++++++++-------------
1 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/src/main/java/com/gitblit/utils/ActivityUtils.java b/src/main/java/com/gitblit/utils/ActivityUtils.java
index edeb01a..c4e9587 100644
--- a/src/main/java/com/gitblit/utils/ActivityUtils.java
+++ b/src/main/java/com/gitblit/utils/ActivityUtils.java
@@ -32,9 +32,7 @@
import java.util.TreeSet;
import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.revwalk.RevCommit;
import com.gitblit.GitBlit;
import com.gitblit.Keys;
@@ -107,27 +105,28 @@
if (StringUtils.isEmpty(objectId)) {
for (RefModel local : JGitUtils.getLocalBranches(
repository, true, -1)) {
+ if (!local.getDate().after(thresholdDate)) {
+ // branch not recently updated
+ continue;
+ }
branches.add(local.getName());
}
} else {
branches.add(objectId);
}
- Map<ObjectId, List<RefModel>> allRefs = JGitUtils
- .getAllRefs(repository, model.showRemoteBranches);
for (String branch : branches) {
String shortName = branch;
if (shortName.startsWith(Constants.R_HEADS)) {
shortName = shortName.substring(Constants.R_HEADS.length());
}
- List<RevCommit> commits = JGitUtils.getRevLog(repository,
- branch, thresholdDate);
+ List<RepositoryCommit> commits = CommitCache.instance().getCommits(model.name, repository, branch, thresholdDate);
if (model.maxActivityCommits > 0 && commits.size() > model.maxActivityCommits) {
// trim commits to maximum count
commits = commits.subList(0, model.maxActivityCommits);
}
- for (RevCommit commit : commits) {
- Date date = JGitUtils.getCommitDate(commit);
+ for (RepositoryCommit commit : commits) {
+ Date date = commit.getCommitDate();
String dateStr = df.format(date);
if (!activity.containsKey(dateStr)) {
// Normalize the date to midnight
@@ -140,11 +139,7 @@
a.excludeAuthors(authorExclusions);
activity.put(dateStr, a);
}
- RepositoryCommit commitModel = activity.get(dateStr)
- .addCommit(model.name, shortName, commit);
- if (commitModel != null) {
- commitModel.setRefs(allRefs.get(commit.getId()));
- }
+ activity.get(dateStr).addCommit(commit);
}
}
--
Gitblit v1.9.1