summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2015-03-07 11:17:27 -0500
committerJames Moger <james.moger@gitblit.com>2015-03-07 11:17:27 -0500
commitdd661a1091b2a59af513fc846293b6530e73f613 (patch)
tree759514bb35602823e5d413ca20000fd4e90f43b9 /src
parentcff35236ba16e2c376c59feeff310f62554a4140 (diff)
downloadgitblit-dd661a1091b2a59af513fc846293b6530e73f613.tar.gz
gitblit-dd661a1091b2a59af513fc846293b6530e73f613.zip
Expose the DiffComparator choice as an url parameter (?w=1)
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/gitblit/wicket/WicketUtils.java8
-rw-r--r--src/main/java/com/gitblit/wicket/pages/BlobDiffPage.java4
-rw-r--r--src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java2
-rw-r--r--src/main/java/com/gitblit/wicket/pages/ComparePage.java2
4 files changed, 11 insertions, 5 deletions
diff --git a/src/main/java/com/gitblit/wicket/WicketUtils.java b/src/main/java/com/gitblit/wicket/WicketUtils.java
index 9a40931d..0684be30 100644
--- a/src/main/java/com/gitblit/wicket/WicketUtils.java
+++ b/src/main/java/com/gitblit/wicket/WicketUtils.java
@@ -48,6 +48,7 @@ import com.gitblit.IStoredSettings;
import com.gitblit.Keys;
import com.gitblit.models.FederationModel;
import com.gitblit.models.Metric;
+import com.gitblit.utils.DiffUtils.DiffComparator;
import com.gitblit.utils.HttpUtils;
import com.gitblit.utils.StringUtils;
import com.gitblit.utils.TimeUtils;
@@ -61,7 +62,7 @@ public class WicketUtils {
public static void addCssClass(Component container, String value) {
container.add(new AttributeAppender("class", new Model<String>(value), " "));
}
-
+
public static void setCssStyle(Component container, String value) {
container.add(new SimpleAttributeModifier("style", value));
}
@@ -494,6 +495,11 @@ public class WicketUtils {
return params.getString("st", null);
}
+ public static DiffComparator getDiffComparator(PageParameters params) {
+ int ordinal = params.getInt("w", 0);
+ return DiffComparator.values()[ordinal];
+ }
+
public static int getPage(PageParameters params) {
// index from 1
return params.getInt("pg", 1);
diff --git a/src/main/java/com/gitblit/wicket/pages/BlobDiffPage.java b/src/main/java/com/gitblit/wicket/pages/BlobDiffPage.java
index f74e8cb3..bf84fad9 100644
--- a/src/main/java/com/gitblit/wicket/pages/BlobDiffPage.java
+++ b/src/main/java/com/gitblit/wicket/pages/BlobDiffPage.java
@@ -43,7 +43,7 @@ public class BlobDiffPage extends RepositoryPage {
final String blobPath = WicketUtils.getPath(params);
final String baseObjectId = WicketUtils.getBaseObjectId(params);
- final DiffComparator diffComparator = DiffComparator.WS_IGNORE_ALL;
+ final DiffComparator diffComparator = WicketUtils.getDiffComparator(params);
Repository r = getRepository();
RevCommit commit = getCommit();
@@ -67,7 +67,7 @@ public class BlobDiffPage extends RepositoryPage {
RevCommit baseCommit = JGitUtils.getCommit(r, baseObjectId);
ImageDiffHandler handler = new ImageDiffHandler(this, repositoryName,
baseCommit.getName(), commit.getName(), imageExtensions);
- diff = DiffUtils.getDiff(r, baseCommit, commit, blobPath, DiffComparator.WS_IGNORE_ALL, DiffOutputType.HTML, handler).content;
+ diff = DiffUtils.getDiff(r, baseCommit, commit, blobPath, diffComparator, DiffOutputType.HTML, handler).content;
if (handler.getImgDiffCount() > 0) {
addBottomScript("scripts/imgdiff.js"); // Tiny support script for image diffs
}
diff --git a/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java b/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java
index 9b3d693b..2ec829ee 100644
--- a/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java
+++ b/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java
@@ -86,7 +86,7 @@ public class CommitDiffPage extends RepositoryPage {
final ImageDiffHandler handler = new ImageDiffHandler(this, repositoryName,
parents.isEmpty() ? null : parents.get(0), commit.getName(), imageExtensions);
- final DiffComparator diffComparator = DiffComparator.WS_IGNORE_ALL;
+ final DiffComparator diffComparator = WicketUtils.getDiffComparator(params);
final DiffOutput diff = DiffUtils.getCommitDiff(r, commit, diffComparator, DiffOutputType.HTML, handler);
if (handler.getImgDiffCount() > 0) {
addBottomScript("scripts/imgdiff.js"); // Tiny support script for image diffs
diff --git a/src/main/java/com/gitblit/wicket/pages/ComparePage.java b/src/main/java/com/gitblit/wicket/pages/ComparePage.java
index 68e904b9..76bf1c50 100644
--- a/src/main/java/com/gitblit/wicket/pages/ComparePage.java
+++ b/src/main/java/com/gitblit/wicket/pages/ComparePage.java
@@ -117,7 +117,7 @@ public class ComparePage extends RepositoryPage {
final ImageDiffHandler handler = new ImageDiffHandler(this, repositoryName,
fromCommit.getName(), toCommit.getName(), imageExtensions);
- final DiffComparator diffComparator = DiffComparator.WS_IGNORE_ALL;
+ final DiffComparator diffComparator = WicketUtils.getDiffComparator(params);
final DiffOutput diff = DiffUtils.getDiff(r, fromCommit, toCommit, diffComparator, DiffOutputType.HTML, handler);
if (handler.getImgDiffCount() > 0) {
addBottomScript("scripts/imgdiff.js"); // Tiny support script for image diffs