For inherited boolean values display the actual value that is inherited

The values for useContributorAgreements, useSignedOffBy,
useContentMerge and requireChangeID can be either directly set on a
project or be inherited from the parent project. In case that the value
is inherited from the parent project display the actual value that is
inherited on the ProjectInfoScreen.

Change-Id: If4f484ceb5287326d7e9961733cdbf86a6e58827
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2012-11-24 22:44:36 +01:00
committed by Shawn O. Pearce
parent 69b3336684
commit 8fb080a4a3
12 changed files with 180 additions and 92 deletions

View File

@@ -19,7 +19,7 @@ import com.google.gerrit.common.errors.ProjectCreationFailedException;
import com.google.gerrit.extensions.annotations.RequiresCapability;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.client.Project.InheritedBoolean;
import com.google.gerrit.reviewdb.client.Project.InheritableBoolean;
import com.google.gerrit.reviewdb.client.Project.SubmitType;
import com.google.gerrit.server.project.CreateProject;
import com.google.gerrit.server.project.CreateProjectArgs;
@@ -66,35 +66,35 @@ final class CreateProjectCommand extends SshCommand {
private SubmitType submitType = SubmitType.MERGE_IF_NECESSARY;
@Option(name = "--contributor-agreements", usage = "if contributor agreement is required")
private InheritedBoolean contributorAgreements = InheritedBoolean.INHERIT;
private InheritableBoolean contributorAgreements = InheritableBoolean.INHERIT;
@Option(name = "--signed-off-by", usage = "if signed-off-by is required")
private InheritedBoolean signedOffBy = InheritedBoolean.INHERIT;
private InheritableBoolean signedOffBy = InheritableBoolean.INHERIT;
@Option(name = "--content-merge", usage = "allow automatic conflict resolving within files")
private InheritedBoolean contentMerge = InheritedBoolean.INHERIT;
private InheritableBoolean contentMerge = InheritableBoolean.INHERIT;
@Option(name = "--change-id", usage = "if change-id is required")
private InheritedBoolean requireChangeID = InheritedBoolean.INHERIT;
private InheritableBoolean requireChangeID = InheritableBoolean.INHERIT;
@Option(name = "--use-contributor-agreements", aliases = {"--ca"}, usage = "if contributor agreement is required")
void setUseContributorArgreements(boolean on) {
contributorAgreements = InheritedBoolean.TRUE;
contributorAgreements = InheritableBoolean.TRUE;
}
@Option(name = "--use-signed-off-by", aliases = {"--so"}, usage = "if signed-off-by is required")
void setUseSignedOffBy(boolean on) {
signedOffBy = InheritedBoolean.TRUE;
signedOffBy = InheritableBoolean.TRUE;
}
@Option(name = "--use-content-merge", usage = "allow automatic conflict resolving within files")
void setUseContentMerge(boolean on) {
contentMerge = InheritedBoolean.TRUE;
contentMerge = InheritableBoolean.TRUE;
}
@Option(name = "--require-change-id", aliases = {"--id"}, usage = "if change-id is required")
void setRequireChangeId(boolean on) {
requireChangeID = InheritedBoolean.TRUE;
requireChangeID = InheritableBoolean.TRUE;
}
@Option(name = "--branch", aliases = {"-b"}, metaVar = "BRANCH", usage = "initial branch name\n"

View File

@@ -17,7 +17,7 @@ package com.google.gerrit.sshd.commands;
import com.google.gerrit.common.data.GlobalCapability;
import com.google.gerrit.extensions.annotations.RequiresCapability;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.client.Project.InheritedBoolean;
import com.google.gerrit.reviewdb.client.Project.InheritableBoolean;
import com.google.gerrit.reviewdb.client.Project.State;
import com.google.gerrit.reviewdb.client.Project.SubmitType;
import com.google.gerrit.server.git.MetaDataUpdate;
@@ -52,55 +52,55 @@ final class SetProjectCommand extends SshCommand {
private SubmitType submitType;
@Option(name = "--contributor-agreements", usage = "if contributor agreement is required")
private InheritedBoolean contributorAgreements;
private InheritableBoolean contributorAgreements;
@Option(name = "--signed-off-by", usage = "if signed-off-by is required")
private InheritedBoolean signedOffBy;
private InheritableBoolean signedOffBy;
@Option(name = "--content-merge", usage = "allow automatic conflict resolving within files")
private InheritedBoolean contentMerge;
private InheritableBoolean contentMerge;
@Option(name = "--change-id", usage = "if change-id is required")
private InheritedBoolean requireChangeID;
private InheritableBoolean requireChangeID;
@Option(name = "--use-contributor-agreements", aliases = {"--ca"}, usage = "if contributor agreement is required")
void setUseContributorArgreements(boolean on) {
contributorAgreements = InheritedBoolean.TRUE;
contributorAgreements = InheritableBoolean.TRUE;
}
@Option(name = "--no-contributor-agreements", aliases = {"--nca"}, usage = "if contributor agreement is not required")
void setNoContributorArgreements(boolean on) {
contributorAgreements = InheritedBoolean.FALSE;
contributorAgreements = InheritableBoolean.FALSE;
}
@Option(name = "--use-signed-off-by", aliases = {"--so"}, usage = "if signed-off-by is required")
void setUseSignedOffBy(boolean on) {
signedOffBy = InheritedBoolean.TRUE;
signedOffBy = InheritableBoolean.TRUE;
}
@Option(name = "--no-signed-off-by", aliases = {"--nso"}, usage = "if signed-off-by is not required")
void setNoSignedOffBy(boolean on) {
signedOffBy = InheritedBoolean.FALSE;
signedOffBy = InheritableBoolean.FALSE;
}
@Option(name = "--use-content-merge", usage = "allow automatic conflict resolving within files")
void setUseContentMerge(boolean on) {
contentMerge = InheritedBoolean.TRUE;
contentMerge = InheritableBoolean.TRUE;
}
@Option(name = "--no-content-merge", usage = "don't allow automatic conflict resolving within files")
void setNoContentMerge(boolean on) {
contentMerge = InheritedBoolean.FALSE;
contentMerge = InheritableBoolean.FALSE;
}
@Option(name = "--require-change-id", aliases = {"--id"}, usage = "if change-id is required")
void setRequireChangeId(boolean on) {
requireChangeID = InheritedBoolean.TRUE;
requireChangeID = InheritableBoolean.TRUE;
}
@Option(name = "--no-change-id", aliases = {"--nid"}, usage = "if change-id is not required")
void setNoChangeId(boolean on) {
requireChangeID = InheritedBoolean.FALSE;
requireChangeID = InheritableBoolean.FALSE;
}
@Option(name = "--project-state", aliases = {"--ps"}, usage = "project's visibility state")