From d0b688d3ad3c72b6a07627ca689fade3a6257471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C5=A1a=20=C5=BDivkov?= Date: Tue, 13 Jun 2017 12:49:42 +0200 Subject: [PATCH 1/3] Fix cyclic dependency when using site_path from system_config table The starting mode where site_path is not specified (as a system property) and Gerrit first connects to the database using the ReviewDb JNDI property from the servlet container was broken since I60f585f5ef due to a cyclic dependency in Guice bindings. Make sure to inject the non-wrapped SchemaFactory in the SitePathFromSystemConfigProvider. Change-Id: Ie283a5498e981642a82aac1fcb8b33b0c881fc84 --- .../google/gerrit/httpd/SitePathFromSystemConfigProvider.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gerrit-war/src/main/java/com/google/gerrit/httpd/SitePathFromSystemConfigProvider.java b/gerrit-war/src/main/java/com/google/gerrit/httpd/SitePathFromSystemConfigProvider.java index 33f9ae34bf..5a97d20665 100644 --- a/gerrit-war/src/main/java/com/google/gerrit/httpd/SitePathFromSystemConfigProvider.java +++ b/gerrit-war/src/main/java/com/google/gerrit/httpd/SitePathFromSystemConfigProvider.java @@ -17,6 +17,7 @@ package com.google.gerrit.httpd; import com.google.gerrit.reviewdb.client.SystemConfig; import com.google.gerrit.reviewdb.server.ReviewDb; import com.google.gerrit.server.config.SitePath; +import com.google.gerrit.server.schema.ReviewDbFactory; import com.google.gwtorm.server.OrmException; import com.google.gwtorm.server.SchemaFactory; import com.google.inject.Inject; @@ -31,7 +32,7 @@ class SitePathFromSystemConfigProvider implements Provider { private final Path path; @Inject - SitePathFromSystemConfigProvider(SchemaFactory schemaFactory) + SitePathFromSystemConfigProvider(@ReviewDbFactory SchemaFactory schemaFactory) throws OrmException { path = read(schemaFactory); } From f6a3cb127cb9dbaaaf935d67f02d47d0b9c5d431 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Wed, 14 Jun 2017 21:32:57 +0900 Subject: [PATCH 2/3] ProjectTagsScreen: Fix title of revision field for new tag The UI for tag creation was based on the existing UI for branch creation, and the field is named "Initial Revision". "Initial Revision" makes sense for branches, where the revision of the branch may advance as changes are submitted. However, it does not make sense for tags, whose revision will not change. Change the title to only "Revision". Change-Id: I5c5ee711da7ef196f8a7398f5b479f8c0f31d302 --- .../java/com/google/gerrit/client/admin/AdminConstants.java | 2 ++ .../com/google/gerrit/client/admin/AdminConstants.properties | 1 + .../java/com/google/gerrit/client/admin/ProjectTagsScreen.java | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminConstants.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminConstants.java index d7fb0726e0..cc6a13671a 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminConstants.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminConstants.java @@ -179,6 +179,8 @@ public interface AdminConstants extends Constants { String initialRevision(); + String revision(); + String buttonAddBranch(); String buttonDeleteBranch(); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminConstants.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminConstants.properties index 465bcfc054..1588ea6afa 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminConstants.properties +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminConstants.properties @@ -85,6 +85,7 @@ columnBranchRevision = Revision columnTagName = Tag Name columnTagRevision = Revision initialRevision = Initial Revision +revision = Revision buttonAddBranch = Create Branch buttonAddTag = Create Tag buttonDeleteBranch = Delete diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectTagsScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectTagsScreen.java index b89139c21f..f38d36cf9c 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectTagsScreen.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectTagsScreen.java @@ -150,7 +150,7 @@ public class ProjectTagsScreen extends PaginatedProjectScreen { } } }); - addGrid.setText(1, 0, AdminConstants.I.initialRevision() + ":"); + addGrid.setText(1, 0, AdminConstants.I.revision() + ":"); addGrid.setWidget(1, 1, irevTxtBox); addTag = new Button(AdminConstants.I.buttonAddTag()); From fc9f79445ca30cfdee3a89ee6b0d8033f0c9e51a Mon Sep 17 00:00:00 2001 From: Paladox none Date: Wed, 29 Mar 2017 20:13:59 +0000 Subject: [PATCH 3/3] Fix java.lang.ArrayIndexOutOfBoundsException when checking for parent Check to see if parent == 0 first. Bug: Issue 5866 Change-Id: Id79fe8bdcf893592d28d475215cdeedcd92d271b --- .../com/google/gerrit/server/change/ChangeKindCacheImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/ChangeKindCacheImpl.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/ChangeKindCacheImpl.java index 030ddd2a15..8332a098bd 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/change/ChangeKindCacheImpl.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/ChangeKindCacheImpl.java @@ -225,7 +225,7 @@ public class ChangeKindCacheImpl implements ChangeKindCache { } if ((prior.getParentCount() != 1 || next.getParentCount() != 1) - && (!onlyFirstParentChanged(prior, next) || prior.getParentCount() == 0)) { + && (prior.getParentCount() == 0 || !onlyFirstParentChanged(prior, next))) { // Trivial rebases done by machine only work well on 1 parent. return ChangeKind.REWORK; }