Merge branch 'stable-2.16'

* stable-2.16:
  ssh: Allow GIT_PROTOCOL to contain multiple parameters
  Fix running Gerrit on Tomcat
  Fix too-aggressive shortcut
  Filter MERGE_LIST magic file from Prolog facts
  Allow to enable git protocol version 2 for upload pack
  Remove irrelevant styles
  Remove unneeded AuditServiceImpl
  Fix some reviewers emails showing as undefined
  Add shift+m shortcut to diff view
  Delete system config table
  Don't use List in GerritConfigListener API
  Revert "Revert "Show author and committer when relevant""
  Reload repo and group list after creating a repo or group
  Hide "private" check box if private changes are disabled
  Set version to 2.15.7
  Trigger audit for GIT over Http commands

Change-Id: Idf8aed46f7a4fc1cd9b2630f79c73b86eefd970f
This commit is contained in:
David Pursehouse
2018-11-14 18:12:04 -08:00
48 changed files with 468 additions and 439 deletions

View File

@@ -275,8 +275,7 @@ class GroupRebuilder {
* Distinct event types.
*
* <p>Events at the same time by the same user are batched together by type. The types should
* correspond to the possible batch operations supported by {@link
* com.google.gerrit.server.audit.AuditService}.
* correspond to the possible batch operations supported by AuditService.
*/
enum Type {
ADD_MEMBER,

View File

@@ -21,7 +21,6 @@ import com.google.gerrit.git.RefUpdateUtil;
import com.google.gerrit.metrics.MetricMaker;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gerrit.reviewdb.client.CurrentSchemaVersion;
import com.google.gerrit.reviewdb.client.SystemConfig;
import com.google.gerrit.reviewdb.server.ReviewDb;
import com.google.gerrit.server.GerritPersonIdent;
import com.google.gerrit.server.Sequences;
@@ -150,7 +149,6 @@ public class ReviewDbSchemaCreator {
GroupReference admins = createGroupReference("Administrators");
GroupReference batchUsers = createGroupReference("Non-Interactive Users");
initSystemConfig(db);
allProjectsCreator.setAdministrators(admins).setBatchUsers(batchUsers).create();
// We have to create the All-Users repository before we can use it to store the groups in it.
allUsersCreator.setAdministrators(admins).create();
@@ -274,15 +272,4 @@ public class ReviewDbSchemaCreator {
.setGroupUUID(groupReference.getUUID())
.build();
}
private SystemConfig initSystemConfig(ReviewDb db) throws OrmException {
SystemConfig s = SystemConfig.create();
try {
s.sitePath = site_path.toRealPath().normalize().toString();
} catch (IOException e) {
s.sitePath = site_path.toAbsolutePath().normalize().toString();
}
db.systemConfig().insert(Collections.singleton(s));
return s;
}
}

View File

@@ -16,7 +16,6 @@ package com.google.gerrit.server.schema;
import com.google.common.annotations.VisibleForTesting;
import com.google.gerrit.reviewdb.client.CurrentSchemaVersion;
import com.google.gerrit.reviewdb.client.SystemConfig;
import com.google.gerrit.reviewdb.server.ReviewDb;
import com.google.gerrit.reviewdb.server.ReviewDbUtil;
import com.google.gerrit.server.GerritPersonIdent;
@@ -38,7 +37,6 @@ import com.google.inject.Provider;
import com.google.inject.Stage;
import java.io.IOException;
import java.sql.SQLException;
import java.util.Collections;
import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.PersonIdent;
@@ -46,18 +44,15 @@ import org.eclipse.jgit.lib.PersonIdent;
/** Creates or updates the current database schema. */
public class ReviewDbSchemaUpdater {
private final SchemaFactory<ReviewDb> schema;
private final SitePaths site;
private final ReviewDbSchemaCreator creator;
private final Provider<ReviewDbSchemaVersion> updater;
@Inject
ReviewDbSchemaUpdater(
@ReviewDbFactory SchemaFactory<ReviewDb> schema,
SitePaths site,
ReviewDbSchemaCreator creator,
Injector parent) {
this.schema = schema;
this.site = site;
this.creator = creator;
this.updater = buildInjector(parent).getProvider(ReviewDbSchemaVersion.class);
}
@@ -119,8 +114,6 @@ public class ReviewDbSchemaUpdater {
} catch (SQLException e) {
throw new OrmException("Cannot upgrade schema", e);
}
updateSystemConfig(db);
}
}
}
@@ -137,17 +130,4 @@ public class ReviewDbSchemaUpdater {
return null;
}
}
private void updateSystemConfig(ReviewDb db) throws OrmException {
final SystemConfig sc = db.systemConfig().get(new SystemConfig.Key());
if (sc == null) {
throw new OrmException("No record in system_config table");
}
try {
sc.sitePath = site.site_path.toRealPath().normalize().toString();
} catch (IOException e) {
sc.sitePath = site.site_path.toAbsolutePath().normalize().toString();
}
db.systemConfig().update(Collections.singleton(sc));
}
}

View File

@@ -36,7 +36,7 @@ import java.util.concurrent.TimeUnit;
/** A version of the database schema. */
public abstract class ReviewDbSchemaVersion {
/** The current schema version. */
public static final Class<Schema_169> C = Schema_169.class;
public static final Class<Schema_170> C = Schema_170.class;
public static int getBinaryVersion() {
return guessVersion(C);

View File

@@ -0,0 +1,25 @@
// Copyright (C) 2018 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.server.schema;
import com.google.inject.Inject;
import com.google.inject.Provider;
public class Schema_170 extends ReviewDbSchemaVersion {
@Inject
Schema_170(Provider<Schema_169> prior) {
super(prior);
}
}