Merge changes I29e412b8,I57161c14 * changes: Make InvalidRevisionException a static class of CreateBranch AccountVisibilityProvider: Remove support for legacy suggest.accounts
diff --git a/Documentation/config-gerrit.txt b/Documentation/config-gerrit.txt index ec73a32..a502ccf 100644 --- a/Documentation/config-gerrit.txt +++ b/Documentation/config-gerrit.txt
@@ -3655,23 +3655,6 @@ [[suggest]] === Section suggest -[[suggest.accounts]]suggest.accounts:: -+ -If `true`, visible user accounts (according to the value of -`accounts.visibility`) will be offered as completion suggestions -when adding a reviewer to a change, or a user to a group. -+ -If `false`, account suggestion is disabled. -+ -Older configurations may also have one of the `accounts.visibility` -values for this field, including `OFF` as a synonym for `NONE`. If -`accounts.visibility` is also set, that value overrides this one; -otherwise, this value applies to both `suggest.accounts` and -`accounts.visibility`. -+ -New configurations should prefer the boolean value for this field -and an enum value for `accounts.visibility`. - [[suggest.maxSuggestedReviewers]]suggest.maxSuggestedReviewers:: + The maximum numbers of reviewers suggested.
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/SuggestReviewersIT.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/SuggestReviewersIT.java index 7d2930a..3eb46cf 100644 --- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/SuggestReviewersIT.java +++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/SuggestReviewersIT.java
@@ -70,7 +70,7 @@ } @Test - @GerritConfig(name = "suggest.accounts", value = "false") + @GerritConfig(name = "accounts.visibility", value = "NONE") public void suggestReviewersNoResult1() throws Exception { String changeId = createChange().getChangeId(); List<SuggestedReviewerInfo> reviewers = @@ -80,8 +80,7 @@ @Test @GerritConfigs( - {@GerritConfig(name = "suggest.accounts", value = "true"), - @GerritConfig(name = "suggest.from", value = "1"), + {@GerritConfig(name = "suggest.from", value = "1"), @GerritConfig(name = "accounts.visibility", value = "NONE") }) public void suggestReviewersNoResult2() throws Exception {
diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/errors/InvalidRevisionException.java b/gerrit-common/src/main/java/com/google/gerrit/common/errors/InvalidRevisionException.java deleted file mode 100644 index b4b54c1..0000000 --- a/gerrit-common/src/main/java/com/google/gerrit/common/errors/InvalidRevisionException.java +++ /dev/null
@@ -1,26 +0,0 @@ -// Copyright (C) 2009 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.common.errors; - -/** Error indicating the revision is invalid as supplied. */ -public class InvalidRevisionException extends Exception { - private static final long serialVersionUID = 1L; - - public static final String MESSAGE = "Invalid Revision"; - - public InvalidRevisionException() { - super(MESSAGE); - } -}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/account/AccountVisibilityProvider.java b/gerrit-server/src/main/java/com/google/gerrit/server/account/AccountVisibilityProvider.java index d7f7a19..25f0a7d 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/account/AccountVisibilityProvider.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/account/AccountVisibilityProvider.java
@@ -19,13 +19,8 @@ import com.google.inject.Provider; import org.eclipse.jgit.lib.Config; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class AccountVisibilityProvider implements Provider<AccountVisibility> { - private static final Logger log = - LoggerFactory.getLogger(AccountVisibilityProvider.class); - private final AccountVisibility accountVisibility; @Inject @@ -33,19 +28,6 @@ AccountVisibility av; if (cfg.getString("accounts", null, "visibility") != null) { av = cfg.getEnum("accounts", null, "visibility", AccountVisibility.ALL); - } else if (cfg.getString("suggest", null, "accounts") != null) { - try { - av = cfg.getEnum("suggest", null, "accounts", AccountVisibility.ALL); - log.warn(String.format( - "Using legacy value %s for suggest.accounts;" - + " use accounts.visibility=%s instead", - av, av)); - } catch (IllegalArgumentException err) { - // If suggest.accounts is a valid boolean, it's a new-style config, and - // we should use the default here. Invalid values are caught in - // SuggestServiceImpl so we don't worry about them here. - av = AccountVisibility.ALL; - } } else { av = AccountVisibility.ALL; }
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/CreateBranch.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/CreateBranch.java index 933d64a..83f69ee 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/project/CreateBranch.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/CreateBranch.java
@@ -16,7 +16,6 @@ import com.google.common.collect.Iterables; import com.google.gerrit.common.ChangeHooks; -import com.google.gerrit.common.errors.InvalidRevisionException; import com.google.gerrit.extensions.api.projects.BranchInfo; import com.google.gerrit.extensions.restapi.AuthException; import com.google.gerrit.extensions.restapi.BadRequestException; @@ -253,4 +252,15 @@ throw new InvalidRevisionException(); } } + + /** Error indicating the revision is invalid as supplied. */ + private static class InvalidRevisionException extends Exception { + private static final long serialVersionUID = 1L; + + public static final String MESSAGE = "Invalid Revision"; + + public InvalidRevisionException() { + super(MESSAGE); + } + } }