Merge "ReceiveCommits: add a new push option"

This commit is contained in:
xchangcheng
2019-05-27 06:53:22 +00:00
committed by Gerrit Code Review
2 changed files with 10 additions and 4 deletions

View File

@@ -14,6 +14,7 @@
package com.google.gerrit.common;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@@ -22,13 +23,13 @@ import java.lang.annotation.Retention;
import java.lang.annotation.Target;
/**
* A marker for a method that is public solely because it is called from inside a project or an
* organisation using Gerrit.
* A marker to say a method/type/field is added or is increased to public solely because it is
* called from inside a project or an organisation using Gerrit.
*/
@Target({METHOD, TYPE})
@Target({METHOD, TYPE, FIELD})
@Retention(RUNTIME)
public @interface UsedAt {
/** Enumeration of projects that call a method that would otherwise be private. */
/** Enumeration of projects that call a method/type/field. */
enum Project {
GOOGLE,
PLUGIN_CHECKS,

View File

@@ -62,6 +62,7 @@ import com.google.common.collect.Streams;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.common.FooterConstants;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.UsedAt;
import com.google.gerrit.common.data.LabelType;
import com.google.gerrit.common.data.LabelTypes;
import com.google.gerrit.exceptions.StorageException;
@@ -1517,6 +1518,10 @@ class ReceiveCommits {
// TODO(dpursehouse): validate hashtags
}
@UsedAt(UsedAt.Project.GOOGLE)
@Option(name = "--create-cod-token", usage = "create a token for consistency-on-demand")
private boolean createCodToken;
MagicBranchInput(IdentifiedUser user, ReceiveCommand cmd, LabelTypes labelTypes) {
this.deprecatedTopicSeen = false;
this.cmd = cmd;