]> source.dussan.org Git - gitblit.git/commitdiff
Explicitly declare RepositoryPage subclasses that reference commits 80/180/1
authorJames Moger <james.moger@gitblit.com>
Wed, 17 Sep 2014 16:20:22 +0000 (12:20 -0400)
committerJames Moger <james.moger@gitblit.com>
Wed, 17 Sep 2014 16:20:22 +0000 (12:20 -0400)
15 files changed:
src/main/java/com/gitblit/wicket/GitBlitWebApp.java
src/main/java/com/gitblit/wicket/pages/BlamePage.java
src/main/java/com/gitblit/wicket/pages/BlobDiffPage.java
src/main/java/com/gitblit/wicket/pages/BlobPage.java
src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java
src/main/java/com/gitblit/wicket/pages/CommitPage.java
src/main/java/com/gitblit/wicket/pages/DocPage.java
src/main/java/com/gitblit/wicket/pages/DocsPage.java
src/main/java/com/gitblit/wicket/pages/HistoryPage.java
src/main/java/com/gitblit/wicket/pages/LogPage.java
src/main/java/com/gitblit/wicket/pages/MetricsPage.java
src/main/java/com/gitblit/wicket/pages/NoDocsPage.java
src/main/java/com/gitblit/wicket/pages/RepositoryPage.java
src/main/java/com/gitblit/wicket/pages/TagPage.java
src/main/java/com/gitblit/wicket/pages/TreePage.java

index 0c978618e54884d7994d9f6ba553dac8830cd04e..d19630c251ed9f62a0e537ff7b0f242ea5acddbd 100644 (file)
@@ -175,9 +175,9 @@ public class GitBlitWebApp extends WebApplication implements GitblitWicketApp {
 
                // setup the standard gitweb-ish urls
                mount("/repositories", RepositoriesPage.class);
-               mount("/overview", OverviewPage.class, "r", "h");
+               mount("/overview", OverviewPage.class, "r");
                mount("/summary", SummaryPage.class, "r");
-               mount("/reflog", ReflogPage.class, "r", "h");
+               mount("/reflog", ReflogPage.class, "r");
                mount("/commits", LogPage.class, "r", "h");
                mount("/log", LogPage.class, "r", "h");
                mount("/tags", TagsPage.class, "r");
index c2280a2e4b568db9ba33f93ae575f9d623415f86..3c850f2929d4965b6077892bd51bb302e8c15eb9 100644 (file)
@@ -234,6 +234,11 @@ public class BlamePage extends RepositoryPage {
                return getString("gb.blame");\r
        }\r
 \r
+       @Override\r
+       protected boolean isCommitPage() {\r
+               return true;\r
+       }\r
+\r
        @Override\r
        protected Class<? extends BasePage> getRepoNavPageClass() {\r
                return TreePage.class;\r
index 27678ecd8cf0fcd9fe0509ca75e7586f90ad1919..9cc3eae11a091c107b4e656c2210714fd0be1f26 100644 (file)
@@ -81,6 +81,11 @@ public class BlobDiffPage extends RepositoryPage {
                return getString("gb.diff");\r
        }\r
 \r
+       @Override\r
+       protected boolean isCommitPage() {\r
+               return true;\r
+       }\r
+\r
        @Override\r
        protected Class<? extends BasePage> getRepoNavPageClass() {\r
                return TreePage.class;\r
index e84056b31412f1caafb77983742be769c9048858..3c244f9afb43f9767f3d10bb149bc5f35dfd7596 100644 (file)
@@ -223,6 +223,11 @@ public class BlobPage extends RepositoryPage {
                return getString("gb.view");\r
        }\r
 \r
+       @Override\r
+       protected boolean isCommitPage() {\r
+               return true;\r
+       }\r
+\r
        @Override\r
        protected Class<? extends BasePage> getRepoNavPageClass() {\r
                return TreePage.class;\r
index 71a5ea67adef3579ee388db24ea43fee8dd0471b..d827c44999da55d32f116ea2619bf98da6f1b135 100644 (file)
@@ -196,6 +196,11 @@ public class CommitDiffPage extends RepositoryPage {
                return getString("gb.commitdiff");
        }
 
+       @Override
+       protected boolean isCommitPage() {
+               return true;
+       }
+
        @Override
        protected Class<? extends BasePage> getRepoNavPageClass() {
                return LogPage.class;
index 6fadec5b48cb52654d1d0f76737dbf9cc34cc987..072bb20032b00a7a45d9c27900b868ff1a2f2fad 100644 (file)
@@ -247,6 +247,11 @@ public class CommitPage extends RepositoryPage {
                return getString("gb.commit");\r
        }\r
 \r
+       @Override\r
+       protected boolean isCommitPage() {\r
+               return true;\r
+       }\r
+\r
        @Override\r
        protected Class<? extends BasePage> getRepoNavPageClass() {\r
                return LogPage.class;\r
index 567c6fbdd3da9dd117a74000169f294918aaea80..5ed9c400bef0c431a51aaa65f6e1813752250a58 100644 (file)
@@ -101,6 +101,11 @@ public class DocPage extends RepositoryPage {
                return getString("gb.docs");\r
        }\r
 \r
+       @Override\r
+       protected boolean isCommitPage() {\r
+               return true;\r
+       }\r
+\r
        @Override\r
        protected Class<? extends BasePage> getRepoNavPageClass() {\r
                return DocsPage.class;\r
index 97b160499ee7d9e3e57972f0df3dba6664618165..8be9a573f3b8d021a7945483c90837da27b9f53e 100644 (file)
@@ -167,4 +167,10 @@ public class DocsPage extends RepositoryPage {
        protected String getPageName() {\r
                return getString("gb.docs");\r
        }\r
+\r
+       @Override\r
+       protected boolean isCommitPage() {\r
+               return true;\r
+       }\r
+\r
 }\r
index f7f188df7b603a44071ab640ac70d357d90b879e..3021cb3c5520af14591c595257eeec06ed245f2f 100644 (file)
@@ -66,6 +66,11 @@ public class HistoryPage extends RepositoryPage {
                return getString("gb.history");\r
        }\r
 \r
+       @Override\r
+       protected boolean isCommitPage() {\r
+               return true;\r
+       }\r
+\r
        @Override\r
        protected Class<? extends BasePage> getRepoNavPageClass() {\r
                return TreePage.class;\r
index 092f719a9d893c8762fe99776c695d5b463be44b..411d7edd7c8ffe40b74b3139e0aba734fd7f775f 100644 (file)
@@ -69,4 +69,10 @@ public class LogPage extends RepositoryPage {
        protected String getPageName() {\r
                return getString("gb.log");\r
        }\r
+\r
+       @Override\r
+       protected boolean isCommitPage() {\r
+               return true;\r
+       }\r
+\r
 }\r
index 7ae4e4ed960fbeba3bcf774e97180f0b062c4ed5..96113b0f6b4ac4248c582b50dccbf919096bb60c 100644 (file)
@@ -61,24 +61,24 @@ public class MetricsPage extends RepositoryPage {
                                        MessageFormat.format(getString("gb.branchStats"), metricsTotal.count,\r
                                                        metricsTotal.tag, getTimeUtils().duration(metricsTotal.duration))));\r
                }\r
-               \r
+\r
                Charts charts =  new Flotr2Charts();\r
-       \r
+\r
                add(WicketUtils.newBlankImage("commitsChart"));\r
                add(WicketUtils.newBlankImage("dayOfWeekChart"));\r
                add(WicketUtils.newBlankImage("authorsChart"));\r
-                       \r
+\r
                createLineChart(charts, "commitsChart", metrics);\r
                createBarChart(charts, "dayOfWeekChart", getDayOfWeekMetrics(r, objectId));\r
                createPieChart(charts, "authorsChart", getAuthorMetrics(r, objectId));\r
-               \r
+\r
                add(new HeaderContributor(charts));\r
 \r
        }\r
 \r
        private void createLineChart(Charts charts, String id, List<Metric> metrics) {\r
                if ((metrics != null) && (metrics.size() > 0)) {\r
-                       \r
+\r
                        Chart chart = charts.createLineChart(id, "", "day",\r
                                        getString("gb.commits"));\r
                        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");\r
@@ -102,22 +102,22 @@ public class MetricsPage extends RepositoryPage {
                                        chart.addHighlight(date, (int)metric.count);\r
                                }\r
                        }\r
-                       charts.addChart(chart); \r
+                       charts.addChart(chart);\r
                }\r
        }\r
-       \r
+\r
        private void createPieChart(Charts charts, String id, List<Metric> metrics) {\r
                if ((metrics != null) && (metrics.size() > 0)) {\r
-                       \r
+\r
                        Chart chart = charts.createPieChart(id, "", "day",\r
                                        getString("gb.commits"));\r
                        for (Metric metric : metrics) {\r
                                chart.addValue(metric.name, (int)metric.count);\r
                        }\r
-                       charts.addChart(chart); \r
+                       charts.addChart(chart);\r
                }\r
        }\r
-       \r
+\r
        private void createBarChart(Charts charts, String id, List<Metric> metrics) {\r
                if ((metrics != null) && (metrics.size() > 0)) {\r
                        Chart chart = charts.createBarChart(id, "", "day",\r
@@ -125,7 +125,7 @@ public class MetricsPage extends RepositoryPage {
                        for (Metric metric : metrics) {\r
                                chart.addValue(metric.name, (int)metric.count);\r
                        }\r
-                       charts.addChart(chart); \r
+                       charts.addChart(chart);\r
                }\r
        }\r
 \r
@@ -178,6 +178,11 @@ public class MetricsPage extends RepositoryPage {
                return getString("gb.metrics");\r
        }\r
 \r
+       @Override\r
+       protected boolean isCommitPage() {\r
+               return true;\r
+       }\r
+\r
        @Override\r
        protected Class<? extends BasePage> getRepoNavPageClass() {\r
                return SummaryPage.class;\r
index 868e5d026688d36d85d0be540d27f3f458928be9..7dcc02272c4e7793fa5aa063762908518bbab8c7 100644 (file)
@@ -32,6 +32,11 @@ public class NoDocsPage extends RepositoryPage {
                return getString("gb.docs");
        }
 
+       @Override
+       protected boolean isCommitPage() {
+               return true;
+       }
+
        @Override
        protected Class<? extends BasePage> getRepoNavPageClass() {
                return DocsPage.class;
index b3250a6b5a0f53f4f7d9a15682a543c858e990a4..134ee044de13ff2f58f6c6d6c015caa47a75e2bb 100644 (file)
@@ -201,11 +201,13 @@ public abstract class RepositoryPage extends RootPage {
                        objectParams = params;\r
 \r
                        // preserve the objectid iff the objectid directly (or indirectly) refers to a ref\r
-                       if (!StringUtils.isEmpty(objectId)) {\r
+                       if (isCommitPage() && !StringUtils.isEmpty(objectId)) {\r
                                RevCommit commit = JGitUtils.getCommit(r, objectId);\r
-                               String bestId = getBestCommitId(commit);\r
-                               if (!commit.getName().equals(bestId)) {\r
-                                       objectParams = WicketUtils.newObjectParameter(getRepositoryName(), bestId);\r
+                               if (commit != null) {\r
+                                       String bestId = getBestCommitId(commit);\r
+                                       if (!commit.getName().equals(bestId)) {\r
+                                               objectParams = WicketUtils.newObjectParameter(getRepositoryName(), bestId);\r
+                                       }\r
                                }\r
                        }\r
                }\r
@@ -574,6 +576,10 @@ public abstract class RepositoryPage extends RootPage {
 \r
        protected abstract String getPageName();\r
 \r
+       protected boolean isCommitPage() {\r
+               return false;\r
+       }\r
+\r
        protected Component createPersonPanel(String wicketId, PersonIdent identity,\r
                        Constants.SearchType searchType) {\r
                String name = identity == null ? "" : identity.getName();\r
index afade81cec549a06c3e26910a225dfb43e50ea06..9eed27972f2d1856c4419176cafc8665a4e33630 100644 (file)
@@ -100,6 +100,11 @@ public class TagPage extends RepositoryPage {
                return getString("gb.tag");\r
        }\r
 \r
+       @Override\r
+       protected boolean isCommitPage() {\r
+               return true;\r
+       }\r
+\r
        @Override\r
        protected Class<? extends BasePage> getRepoNavPageClass() {\r
                return LogPage.class;\r
index 722b824fb8ca1fcb052ae6db42656c612b27ff8d..9ddbecf6485fb1ee6b3f9c590f54cde6553ab862 100644 (file)
@@ -186,4 +186,10 @@ public class TreePage extends RepositoryPage {
        protected String getPageName() {\r
                return getString("gb.tree");\r
        }\r
+\r
+       @Override\r
+       protected boolean isCommitPage() {\r
+               return true;\r
+       }\r
+\r
 }\r