From 077d23176a8f098766bf492081ae5ab9acb2d285 Mon Sep 17 00:00:00 2001 From: Carsten Lenz <clenz2@csc.com> Date: Fri, 13 Jun 2014 08:26:23 -0400 Subject: [PATCH] Add german translation of welcome.mkd --- src/main/java/com/gitblit/models/Activity.java | 42 ++++++++++++++++++++++++++++-------------- 1 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/gitblit/models/Activity.java b/src/main/java/com/gitblit/models/Activity.java index 547c348..ff0920c 100644 --- a/src/main/java/com/gitblit/models/Activity.java +++ b/src/main/java/com/gitblit/models/Activity.java @@ -35,7 +35,7 @@ /** * Model class to represent the commit activity across many repositories. This * class is used by the Activity page. - * + * * @author James Moger */ public class Activity implements Serializable, Comparable<Activity> { @@ -45,7 +45,7 @@ public final Date startDate; public final Date endDate; - + private final Set<RepositoryCommit> commits; private final Map<String, Metric> authorMetrics; @@ -56,7 +56,7 @@ /** * Constructor for one day of activity. - * + * * @param date */ public Activity(Date date) { @@ -65,7 +65,7 @@ /** * Constructor for specified duration of activity from start date. - * + * * @param date * the start date of the activity * @param duration @@ -79,10 +79,10 @@ repositoryMetrics = new HashMap<String, Metric>(); authorExclusions = new TreeSet<String>(); } - + /** * Exclude the specified authors from the metrics. - * + * * @param authors */ public void excludeAuthors(Collection<String> authors) { @@ -94,7 +94,7 @@ /** * Adds a commit to the activity object as long as the commit is not a * duplicate. - * + * * @param repository * @param branch * @param commit @@ -103,14 +103,28 @@ */ public RepositoryCommit addCommit(String repository, String branch, RevCommit commit) { RepositoryCommit commitModel = new RepositoryCommit(repository, branch, commit); + return addCommit(commitModel); + } + + /** + * Adds a commit to the activity object as long as the commit is not a + * duplicate. + * + * @param repository + * @param branch + * @param commit + * @return a RepositoryCommit, if one was added. Null if this is duplicate + * commit + */ + public RepositoryCommit addCommit(RepositoryCommit commitModel) { if (commits.add(commitModel)) { - String author = StringUtils.removeNewlines(commit.getAuthorIdent().getName()); + String author = StringUtils.removeNewlines(commitModel.getAuthorIdent().getName()); String authorName = author.toLowerCase(); - String authorEmail = StringUtils.removeNewlines(commit.getAuthorIdent().getEmailAddress()).toLowerCase(); - if (!repositoryMetrics.containsKey(repository)) { - repositoryMetrics.put(repository, new Metric(repository)); + String authorEmail = StringUtils.removeNewlines(commitModel.getAuthorIdent().getEmailAddress()).toLowerCase(); + if (!repositoryMetrics.containsKey(commitModel.repository)) { + repositoryMetrics.put(commitModel.repository, new Metric(commitModel.repository)); } - repositoryMetrics.get(repository).count++; + repositoryMetrics.get(commitModel.repository).count++; if (!authorExclusions.contains(authorName) && !authorExclusions.contains(authorEmail)) { if (!authorMetrics.containsKey(author)) { @@ -122,11 +136,11 @@ } return null; } - + public int getCommitCount() { return commits.size(); } - + public List<RepositoryCommit> getCommits() { List<RepositoryCommit> list = new ArrayList<RepositoryCommit>(commits); Collections.sort(list); -- Gitblit v1.9.1