From 67b82a67335cc24b3cadf3e31de097b21294b244 Mon Sep 17 00:00:00 2001 From: James Moger Date: Wed, 18 Sep 2013 11:21:00 -0400 Subject: [PATCH] Added GitNotes to the commitdiff page --- .../gitblit/wicket/pages/CommitDiffPage.html | 24 ++++++++++++++++++ .../gitblit/wicket/pages/CommitDiffPage.java | 25 +++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.html b/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.html index 7437d2ed..7fd3857f 100644 --- a/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.html +++ b/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.html @@ -18,6 +18,22 @@
[commit message]
+ + + + + + +
+ + + + +
+ + +
+
@@ -38,6 +54,14 @@
[diff text]
+ + + + + + + + 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 notes = JGitUtils.getNotesOnCommit(r, commit); + ListDataProvider notesDp = new ListDataProvider(notes); + DataView notesView = new DataView("notes", notesDp) { + private static final long serialVersionUID = 1L; + + public void populateItem(final Item 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 paths = JGitUtils.getFilesInCommit(r, commit); -- 2.39.5