Merge "ChangeScreen: Allow to disable muting of common paths in file table"

This commit is contained in:
Shawn Pearce
2015-02-04 19:17:43 +00:00
committed by Gerrit Code Review
12 changed files with 90 additions and 3 deletions

View File

@@ -109,6 +109,7 @@ public class GetPreferences implements RestReadView<AccountResource> {
Boolean relativeDateInChangeTable;
Boolean sizeBarInChangeTable;
Boolean legacycidInChangeTable;
Boolean muteCommonPathPrefixes;
ReviewCategoryStrategy reviewCategoryStrategy;
DiffView diffView;
List<TopMenu.MenuItem> my;
@@ -127,6 +128,7 @@ public class GetPreferences implements RestReadView<AccountResource> {
relativeDateInChangeTable = p.isRelativeDateInChangeTable() ? true : null;
sizeBarInChangeTable = p.isSizeBarInChangeTable() ? true : null;
legacycidInChangeTable = p.isLegacycidInChangeTable() ? true : null;
muteCommonPathPrefixes = p.isMuteCommonPathPrefixes() ? true : null;
reviewCategoryStrategy = p.getReviewCategoryStrategy();
diffView = p.getDiffView();
}

View File

@@ -63,6 +63,7 @@ public class SetPreferences implements RestModifyView<AccountResource, Input> {
public Boolean relativeDateInChangeTable;
public Boolean sizeBarInChangeTable;
public Boolean legacycidInChangeTable;
public Boolean muteCommonPathPrefixes;
public ReviewCategoryStrategy reviewCategoryStrategy;
public DiffView diffView;
public List<TopMenu.MenuItem> my;
@@ -150,6 +151,9 @@ public class SetPreferences implements RestModifyView<AccountResource, Input> {
if (i.legacycidInChangeTable != null) {
p.setLegacycidInChangeTable(i.legacycidInChangeTable);
}
if (i.muteCommonPathPrefixes != null) {
p.setMuteCommonPathPrefixes(i.muteCommonPathPrefixes);
}
if (i.reviewCategoryStrategy != null) {
p.setReviewCategoryStrategy(i.reviewCategoryStrategy);
}

View File

@@ -52,6 +52,7 @@ public class SetPreferences implements RestModifyView<ConfigResource, Input> {
|| i.relativeDateInChangeTable != null
|| i.sizeBarInChangeTable != null
|| i.legacycidInChangeTable != null
|| i.muteCommonPathPrefixes != null
|| i.reviewCategoryStrategy != null) {
throw new BadRequestException("unsupported option");
}

View File

@@ -32,7 +32,7 @@ import java.util.List;
/** A version of the database schema. */
public abstract class SchemaVersion {
/** The current schema version. */
public static final Class<Schema_106> C = Schema_106.class;
public static final Class<Schema_107> C = Schema_107.class;
public static int getBinaryVersion() {
return guessVersion(C);

View File

@@ -0,0 +1,41 @@
// Copyright (C) 2015 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.gerrit.reviewdb.server.ReviewDb;
import com.google.gwtorm.jdbc.JdbcSchema;
import com.google.inject.Inject;
import com.google.inject.Provider;
import java.sql.SQLException;
import java.sql.Statement;
public class Schema_107 extends SchemaVersion {
@Inject
Schema_107(Provider<Schema_106> prior) {
super(prior);
}
@Override
protected void migrateData(ReviewDb db, UpdateUI ui) throws SQLException {
Statement stmt = ((JdbcSchema) db).getConnection().createStatement();
try {
stmt.executeUpdate("UPDATE accounts set mute_common_path_prefixes = 'Y'");
} finally {
stmt.close();
}
}
}