James Moger
2013-09-30 58be4a33a1ca70baae779d80eff5d79ab7c523a3
src/main/java/com/gitblit/wicket/pages/CommitPage.java
@@ -37,14 +37,18 @@
import com.gitblit.models.PathModel.PathChangeModel;
import com.gitblit.models.SubmoduleModel;
import com.gitblit.utils.JGitUtils;
import com.gitblit.wicket.CacheControl;
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.CompressedDownloadsPanel;
import com.gitblit.wicket.panels.DiffStatPanel;
import com.gitblit.wicket.panels.GravatarImage;
import com.gitblit.wicket.panels.LinkPanel;
import com.gitblit.wicket.panels.RefsPanel;
@CacheControl(LastModified.BOOT)
public class CommitPage extends RepositoryPage {
   public CommitPage(PageParameters params) {
@@ -114,7 +118,7 @@
      };
      add(parentsView);
      addFullText("fullMessage", c.getFullMessage(), true);
      addFullText("fullMessage", c.getFullMessage());
      // git notes
      List<GitNote> notes = JGitUtils.getNotesOnCommit(r, c);
@@ -130,14 +134,24 @@
            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().processCommitMessage(
                  repositoryName, entry.content)).setEscapeModelStrings(false));
            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, c);
      // add commit diffstat
      int insertions = 0;
      int deletions = 0;
      for (PathChangeModel pcm : paths) {
         insertions += pcm.insertions;
         deletions += pcm.deletions;
      }
      add(new DiffStatPanel("diffStat", insertions, deletions));
      add(new CommitLegendPanel("commitLegend", paths));
      ListDataProvider<PathChangeModel> pathsDp = new ListDataProvider<PathChangeModel>(paths);
      DataView<PathChangeModel> pathsView = new DataView<PathChangeModel>("changedPath", pathsDp) {
@@ -150,7 +164,8 @@
            WicketUtils.setChangeTypeCssClass(changeType, entry.changeType);
            setChangeTypeTooltip(changeType, entry.changeType);
            item.add(changeType);
            item.add(new DiffStatPanel("diffStat", entry.insertions, entry.deletions, true));
            boolean hasSubmodule = false;
            String submodulePath = null;
            if (entry.isTree()) {