From 4fcac9d2cbdafb51e3ee9ca3b3da64fd86103174 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Tue, 26 Nov 2013 15:58:15 -0500
Subject: [PATCH] Remove artifact setting from manager dialog

---
 src/main/java/com/gitblit/utils/ActivityUtils.java |   41 ++++++++++++++++++-----------------------
 1 files changed, 18 insertions(+), 23 deletions(-)

diff --git a/src/main/java/com/gitblit/utils/ActivityUtils.java b/src/main/java/com/gitblit/utils/ActivityUtils.java
index edeb01a..ddd7e37 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;
@@ -47,16 +45,16 @@
 
 /**
  * Utility class for building activity information from repositories.
- * 
+ *
  * @author James Moger
- * 
+ *
  */
 public class ActivityUtils {
 
 	/**
 	 * Gets the recent activity from the repositories for the last daysBack days
 	 * on the specified branch.
-	 * 
+	 *
 	 * @param models
 	 *            the list of repositories to query
 	 * @param daysBack
@@ -81,7 +79,7 @@
 		df.setTimeZone(timezone);
 		Calendar cal = Calendar.getInstance();
 		cal.setTimeZone(timezone);
-		
+
 		// aggregate author exclusions
 		Set<String> authorExclusions = new TreeSet<String>();
 		authorExclusions.addAll(GitBlit.getStrings(Keys.web.metricAuthorExclusions));
@@ -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,14 +139,10 @@
 							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);
 					}
 				}
-				
+
 				// close the repository
 				repository.close();
 			}
@@ -160,7 +155,7 @@
 	/**
 	 * Returns the Gravatar profile, if available, for the specified email
 	 * address.
-	 * 
+	 *
 	 * @param emailaddress
 	 * @return a Gravatar Profile
 	 * @throws IOException
@@ -172,7 +167,7 @@
 
 	/**
 	 * Creates a Gravatar thumbnail url from the specified email address.
-	 * 
+	 *
 	 * @param email
 	 *            address to query Gravatar
 	 * @param width
@@ -188,10 +183,10 @@
 				"https://www.gravatar.com/avatar/{0}?s={1,number,0}&d=identicon", emailHash, width);
 		return url;
 	}
-	
+
 	/**
 	 * Creates a Gravatar thumbnail url from the specified email address.
-	 * 
+	 *
 	 * @param email
 	 *            address to query Gravatar
 	 * @param width
@@ -211,7 +206,7 @@
 	/**
 	 * Returns the Gravatar profile, if available, for the specified hashcode.
 	 * address.
-	 * 
+	 *
 	 * @param hash
 	 *            the hash of the email address
 	 * @return a Gravatar Profile

--
Gitblit v1.9.1