summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2013-09-18 11:21:00 -0400
committerJames Moger <james.moger@gitblit.com>2013-09-18 11:31:01 -0400
commit67b82a67335cc24b3cadf3e31de097b21294b244 (patch)
treec37046ab51b46a397e9e4040943e7179ca8bc3ef /src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java
parent0250286553ca93406bfaa976d6aae61e76a9d55f (diff)
downloadgitblit-67b82a67335cc24b3cadf3e31de097b21294b244.tar.gz
gitblit-67b82a67335cc24b3cadf3e31de097b21294b244.zip
Added GitNotes to the commitdiff page
Diffstat (limited to 'src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java')
-rw-r--r--src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java b/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java
index 4c802d74..eb672164 100644
--- a/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java
+++ b/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java
@@ -16,6 +16,7 @@
package com.gitblit.wicket.pages;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.apache.wicket.PageParameters;
@@ -29,8 +30,10 @@ import org.eclipse.jgit.diff.DiffEntry.ChangeType;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
+import com.gitblit.Constants;
import com.gitblit.GitBlit;
import com.gitblit.models.PathModel.PathChangeModel;
+import com.gitblit.models.GitNote;
import com.gitblit.models.SubmoduleModel;
import com.gitblit.utils.DiffUtils;
import com.gitblit.utils.DiffUtils.DiffOutputType;
@@ -40,7 +43,9 @@ import com.gitblit.wicket.CacheControl.LastModified;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.panels.CommitHeaderPanel;
import com.gitblit.wicket.panels.CommitLegendPanel;
+import com.gitblit.wicket.panels.GravatarImage;
import com.gitblit.wicket.panels.LinkPanel;
+import com.gitblit.wicket.panels.RefsPanel;
@CacheControl(LastModified.BOOT)
public class CommitDiffPage extends RepositoryPage {
@@ -77,6 +82,26 @@ public class CommitDiffPage extends RepositoryPage {
addFullText("fullMessage", commit.getFullMessage());
+ // git notes
+ List<GitNote> notes = JGitUtils.getNotesOnCommit(r, commit);
+ ListDataProvider<GitNote> notesDp = new ListDataProvider<GitNote>(notes);
+ DataView<GitNote> notesView = new DataView<GitNote>("notes", notesDp) {
+ private static final long serialVersionUID = 1L;
+
+ public void populateItem(final Item<GitNote> item) {
+ GitNote entry = item.getModelObject();
+ item.add(new RefsPanel("refName", repositoryName, Arrays.asList(entry.notesRef)));
+ item.add(createPersonPanel("authorName", entry.notesRef.getAuthorIdent(),
+ Constants.SearchType.AUTHOR));
+ item.add(new GravatarImage("noteAuthorAvatar", entry.notesRef.getAuthorIdent()));
+ item.add(WicketUtils.createTimestampLabel("authorDate", entry.notesRef
+ .getAuthorIdent().getWhen(), getTimeZone(), getTimeUtils()));
+ item.add(new Label("noteContent", GitBlit.self().processPlainCommitMessage(repositoryName,
+ entry.content)).setEscapeModelStrings(false));
+ }
+ };
+ add(notesView.setVisible(notes.size() > 0));
+
// changed paths list
List<PathChangeModel> paths = JGitUtils.getFilesInCommit(r, commit);