]> source.dussan.org Git - gitblit.git/commitdiff
Expose the DiffComparator choice as an url parameter (?w=1)
authorJames Moger <james.moger@gitblit.com>
Sat, 7 Mar 2015 16:17:27 +0000 (11:17 -0500)
committerJames Moger <james.moger@gitblit.com>
Sat, 7 Mar 2015 16:17:27 +0000 (11:17 -0500)
src/main/java/com/gitblit/wicket/WicketUtils.java
src/main/java/com/gitblit/wicket/pages/BlobDiffPage.java
src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java
src/main/java/com/gitblit/wicket/pages/ComparePage.java

index 9a40931d3edf028ec6cc421f4775aa630c260a97..0684be3024fe0f70ac80dea7476c08edb7615a1f 100644 (file)
@@ -48,6 +48,7 @@ import com.gitblit.IStoredSettings;
 import com.gitblit.Keys;\r
 import com.gitblit.models.FederationModel;\r
 import com.gitblit.models.Metric;\r
+import com.gitblit.utils.DiffUtils.DiffComparator;\r
 import com.gitblit.utils.HttpUtils;\r
 import com.gitblit.utils.StringUtils;\r
 import com.gitblit.utils.TimeUtils;\r
@@ -61,7 +62,7 @@ public class WicketUtils {
        public static void addCssClass(Component container, String value) {\r
                container.add(new AttributeAppender("class", new Model<String>(value), " "));\r
        }\r
-       \r
+\r
        public static void setCssStyle(Component container, String value) {\r
                container.add(new SimpleAttributeModifier("style", value));\r
        }\r
@@ -494,6 +495,11 @@ public class WicketUtils {
                return params.getString("st", null);\r
        }\r
 \r
+       public static DiffComparator getDiffComparator(PageParameters params) {\r
+               int ordinal = params.getInt("w", 0);\r
+               return DiffComparator.values()[ordinal];\r
+       }\r
+\r
        public static int getPage(PageParameters params) {\r
                // index from 1\r
                return params.getInt("pg", 1);\r
index f74e8cb3f2f43fbe8021d1f51ddb1ac98c86672f..bf84fad939a3cec18971996a0f414d424756d1ff 100644 (file)
@@ -43,7 +43,7 @@ public class BlobDiffPage extends RepositoryPage {
 \r
                final String blobPath = WicketUtils.getPath(params);\r
                final String baseObjectId = WicketUtils.getBaseObjectId(params);\r
-               final DiffComparator diffComparator = DiffComparator.WS_IGNORE_ALL;\r
+               final DiffComparator diffComparator = WicketUtils.getDiffComparator(params);\r
 \r
                Repository r = getRepository();\r
                RevCommit commit = getCommit();\r
@@ -67,7 +67,7 @@ public class BlobDiffPage extends RepositoryPage {
                        RevCommit baseCommit = JGitUtils.getCommit(r, baseObjectId);\r
                        ImageDiffHandler handler = new ImageDiffHandler(this, repositoryName,\r
                                        baseCommit.getName(), commit.getName(), imageExtensions);\r
-                       diff = DiffUtils.getDiff(r, baseCommit, commit, blobPath, DiffComparator.WS_IGNORE_ALL, DiffOutputType.HTML, handler).content;\r
+                       diff = DiffUtils.getDiff(r, baseCommit, commit, blobPath, diffComparator, DiffOutputType.HTML, handler).content;\r
                        if (handler.getImgDiffCount() > 0) {\r
                                addBottomScript("scripts/imgdiff.js"); // Tiny support script for image diffs\r
                        }\r
index 9b3d693b4b6dfbb750e021320de011d71d5ec74b..2ec829eee30b0b297f724ef875ce56de8220dae3 100644 (file)
@@ -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
index 68e904b916e8460c3d5840e39e22cff462c2b4a8..76bf1c504178983027e9bce4293382577e46b1b3 100644 (file)
@@ -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