From be02a0580e355dd0b935acc304b2426afbbd7a09 Mon Sep 17 00:00:00 2001 From: takezoe Date: Fri, 26 Apr 2013 19:58:59 +0900 Subject: [PATCH] Display commit diff using jsdifflib. --- src/main/twirl/commit.scala.html | 76 ++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 4 deletions(-) diff --git a/src/main/twirl/commit.scala.html b/src/main/twirl/commit.scala.html index 76ea3def8..89c833bb8 100644 --- a/src/main/twirl/commit.scala.html +++ b/src/main/twirl/commit.scala.html @@ -1,6 +1,7 @@ @(branch: String, commit: app.CommitInfo, repository: app.RepositoryInfo, diffs: Seq[app.DiffInfo])(implicit context: app.Context) @import context._ @import view.helpers +@import org.eclipse.jgit.diff.DiffEntry.ChangeType @main(helpers.cut(commit.message, 20)){ @header(branch, repository) @navtab(branch, repository, "commits") @@ -21,11 +22,16 @@ - @diffs.map { diff => + @diffs.zipWithIndex.map { case (diff, i) =>
- @diff.newPath + @if(diff.changeType == ChangeType.COPY || diff.changeType == ChangeType.RENAME){ + @diff.oldPath -> @diff.newPath + } + @if(diff.changeType == ChangeType.ADD || diff.changeType == ChangeType.DELETE || diff.changeType == ChangeType.MODIFY){ + @diff.newPath + } @@ -33,9 +39,71 @@
-
@diff.newContent.getOrElse("")
+
+ +
} -} \ No newline at end of file +} + + + + + \ No newline at end of file