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:
committed by
Shawn O. Pearce
parent
69b3336684
commit
8fb080a4a3
@@ -14,6 +14,7 @@
|
||||
|
||||
package com.google.gerrit.common.data;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.InheritedBoolean;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
|
||||
public class ProjectDetail {
|
||||
@@ -24,6 +25,10 @@ public class ProjectDetail {
|
||||
public boolean canModifyAccess;
|
||||
public boolean canModifyState;
|
||||
public boolean isPermissionOnly;
|
||||
public InheritedBoolean useContributorAgreements;
|
||||
public InheritedBoolean useSignedOffBy;
|
||||
public InheritedBoolean useContentMerge;
|
||||
public InheritedBoolean requireChangeID;
|
||||
|
||||
public ProjectDetail() {
|
||||
}
|
||||
@@ -55,4 +60,20 @@ public class ProjectDetail {
|
||||
public void setPermissionOnly(final boolean ipo) {
|
||||
isPermissionOnly = ipo;
|
||||
}
|
||||
|
||||
public void setUseContributorAgreements(final InheritedBoolean uca) {
|
||||
useContributorAgreements = uca;
|
||||
}
|
||||
|
||||
public void setUseSignedOffBy(final InheritedBoolean usob) {
|
||||
useSignedOffBy = usob;
|
||||
}
|
||||
|
||||
public void setUseContentMerge(final InheritedBoolean ucm) {
|
||||
useContentMerge = ucm;
|
||||
}
|
||||
|
||||
public void setRequireChangeID(final InheritedBoolean rcid) {
|
||||
requireChangeID = rcid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,9 @@ import com.google.gerrit.client.ui.OnEditEnabler;
|
||||
import com.google.gerrit.client.ui.SmallHeading;
|
||||
import com.google.gerrit.common.data.ProjectDetail;
|
||||
import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand;
|
||||
import com.google.gerrit.reviewdb.client.InheritedBoolean;
|
||||
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.gwt.event.dom.client.ChangeEvent;
|
||||
import com.google.gwt.event.dom.client.ChangeHandler;
|
||||
@@ -170,7 +171,7 @@ public class ProjectInfoScreen extends ProjectScreen {
|
||||
|
||||
private static ListBox newInheritedBooleanBox() {
|
||||
ListBox box = new ListBox();
|
||||
for (InheritedBoolean b : InheritedBoolean.values()) {
|
||||
for (InheritableBoolean b : InheritableBoolean.values()) {
|
||||
box.addItem(b.name(), b.name());
|
||||
}
|
||||
return box;
|
||||
@@ -186,7 +187,9 @@ public class ProjectInfoScreen extends ProjectScreen {
|
||||
if (SubmitType.FAST_FORWARD_ONLY.equals(Project.SubmitType
|
||||
.valueOf(submitType.getValue(submitType.getSelectedIndex())))) {
|
||||
contentMerge.setEnabled(false);
|
||||
setBool(contentMerge, InheritedBoolean.FALSE);
|
||||
final InheritedBoolean inheritedBoolean = new InheritedBoolean();
|
||||
inheritedBoolean.setValue(InheritableBoolean.FALSE);
|
||||
setBool(contentMerge, inheritedBoolean);
|
||||
} else {
|
||||
contentMerge.setEnabled(submitType.isEnabled());
|
||||
}
|
||||
@@ -240,31 +243,38 @@ public class ProjectInfoScreen extends ProjectScreen {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setBool(ListBox box, InheritedBoolean val) {
|
||||
private static void setBool(ListBox box, InheritedBoolean inheritedBoolean) {
|
||||
for (int i = 0; i < box.getItemCount(); i++) {
|
||||
if (val.name().equals(box.getValue(i))) {
|
||||
if (box.getValue(i).startsWith(InheritableBoolean.INHERIT.name())) {
|
||||
box.setItemText(i, InheritableBoolean.INHERIT.name() + " ("
|
||||
+ inheritedBoolean.inheritedValue + ")");
|
||||
}
|
||||
if (box.getValue(i).startsWith(inheritedBoolean.value.name())) {
|
||||
box.setSelectedIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static InheritedBoolean getBool(ListBox box) {
|
||||
private static InheritableBoolean getBool(ListBox box) {
|
||||
int i = box.getSelectedIndex();
|
||||
if (i >= 0) {
|
||||
return InheritedBoolean.valueOf(box.getValue(i));
|
||||
final String selectedValue = box.getValue(i);
|
||||
if (selectedValue.startsWith(InheritableBoolean.INHERIT.name())) {
|
||||
return InheritableBoolean.INHERIT;
|
||||
}
|
||||
return InheritedBoolean.INHERIT;
|
||||
return InheritableBoolean.valueOf(selectedValue);
|
||||
}
|
||||
return InheritableBoolean.INHERIT;
|
||||
}
|
||||
|
||||
void display(final ProjectDetail result) {
|
||||
project = result.project;
|
||||
|
||||
descTxt.setText(project.getDescription());
|
||||
setBool(contributorAgreements, project.getUseContributorAgreements());
|
||||
setBool(signedOffBy, project.getUseSignedOffBy());
|
||||
setBool(contentMerge, project.getUseContentMerge());
|
||||
setBool(requireChangeID, project.getRequireChangeID());
|
||||
setBool(contributorAgreements, result.useContributorAgreements);
|
||||
setBool(signedOffBy, result.useSignedOffBy);
|
||||
setBool(contentMerge, result.useContentMerge);
|
||||
setBool(requireChangeID, result.requireChangeID);
|
||||
setSubmitType(project.getSubmitType());
|
||||
setState(project.getState());
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ package com.google.gerrit.httpd.rpc.project;
|
||||
|
||||
import com.google.gerrit.common.data.ProjectDetail;
|
||||
import com.google.gerrit.httpd.rpc.Handler;
|
||||
import com.google.gerrit.reviewdb.client.InheritedBoolean;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.server.git.GitRepositoryManager;
|
||||
import com.google.gerrit.server.project.NoSuchProjectException;
|
||||
@@ -68,6 +69,28 @@ class ProjectDetailFactory extends Handler<ProjectDetail> {
|
||||
detail.setCanModifyMergeType(userIsOwner);
|
||||
detail.setCanModifyState(userIsOwner);
|
||||
|
||||
final InheritedBoolean useContributorAgreements = new InheritedBoolean();
|
||||
final InheritedBoolean useSignedOffBy = new InheritedBoolean();
|
||||
final InheritedBoolean useContentMerge = new InheritedBoolean();
|
||||
final InheritedBoolean requireChangeID = new InheritedBoolean();
|
||||
useContributorAgreements.setValue(projectState.getProject()
|
||||
.getUseContributorAgreements());
|
||||
useSignedOffBy.setValue(projectState.getProject().getUseSignedOffBy());
|
||||
useContentMerge.setValue(projectState.getProject().getUseContentMerge());
|
||||
requireChangeID.setValue(projectState.getProject().getRequireChangeID());
|
||||
final ProjectState parentState = projectState.getParentState();
|
||||
if (parentState != null) {
|
||||
useContributorAgreements.setInheritedValue(parentState
|
||||
.isUseContributorAgreements());
|
||||
useSignedOffBy.setInheritedValue(parentState.isUseSignedOffBy());
|
||||
useContentMerge.setInheritedValue(parentState.isUseContentMerge());
|
||||
requireChangeID.setInheritedValue(parentState.isRequireChangeID());
|
||||
}
|
||||
detail.setUseContributorAgreements(useContributorAgreements);
|
||||
detail.setUseSignedOffBy(useSignedOffBy);
|
||||
detail.setUseContentMerge(useContentMerge);
|
||||
detail.setRequireChangeID(requireChangeID);
|
||||
|
||||
final Project.NameKey projectName = projectState.getProject().getNameKey();
|
||||
Repository git;
|
||||
try {
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// Copyright (C) 2012 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.reviewdb.client;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.Project.InheritableBoolean;
|
||||
|
||||
public class InheritedBoolean {
|
||||
|
||||
public InheritableBoolean value;
|
||||
public boolean inheritedValue;
|
||||
|
||||
public InheritedBoolean() {
|
||||
}
|
||||
|
||||
public void setValue(final InheritableBoolean value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public void setInheritedValue(final boolean inheritedValue) {
|
||||
this.inheritedValue = inheritedValue;
|
||||
}
|
||||
}
|
||||
@@ -85,7 +85,7 @@ public final class Project {
|
||||
HIDDEN;
|
||||
}
|
||||
|
||||
public static enum InheritedBoolean {
|
||||
public static enum InheritableBoolean {
|
||||
TRUE,
|
||||
FALSE,
|
||||
INHERIT;
|
||||
@@ -95,9 +95,9 @@ public final class Project {
|
||||
|
||||
protected String description;
|
||||
|
||||
protected InheritedBoolean useContributorAgreements;
|
||||
protected InheritableBoolean useContributorAgreements;
|
||||
|
||||
protected InheritedBoolean useSignedOffBy;
|
||||
protected InheritableBoolean useSignedOffBy;
|
||||
|
||||
protected SubmitType submitType;
|
||||
|
||||
@@ -105,9 +105,9 @@ public final class Project {
|
||||
|
||||
protected NameKey parent;
|
||||
|
||||
protected InheritedBoolean requireChangeID;
|
||||
protected InheritableBoolean requireChangeID;
|
||||
|
||||
protected InheritedBoolean useContentMerge;
|
||||
protected InheritableBoolean useContentMerge;
|
||||
|
||||
protected String defaultDashboardId;
|
||||
|
||||
@@ -120,10 +120,10 @@ public final class Project {
|
||||
name = nameKey;
|
||||
submitType = SubmitType.MERGE_IF_NECESSARY;
|
||||
state = State.ACTIVE;
|
||||
useContributorAgreements = InheritedBoolean.INHERIT;
|
||||
useSignedOffBy = InheritedBoolean.INHERIT;
|
||||
requireChangeID = InheritedBoolean.INHERIT;
|
||||
useContentMerge = InheritedBoolean.INHERIT;
|
||||
useContributorAgreements = InheritableBoolean.INHERIT;
|
||||
useSignedOffBy = InheritableBoolean.INHERIT;
|
||||
requireChangeID = InheritableBoolean.INHERIT;
|
||||
useContentMerge = InheritableBoolean.INHERIT;
|
||||
}
|
||||
|
||||
public Project.NameKey getNameKey() {
|
||||
@@ -142,35 +142,35 @@ public final class Project {
|
||||
description = d;
|
||||
}
|
||||
|
||||
public InheritedBoolean getUseContributorAgreements() {
|
||||
public InheritableBoolean getUseContributorAgreements() {
|
||||
return useContributorAgreements;
|
||||
}
|
||||
|
||||
public InheritedBoolean getUseSignedOffBy() {
|
||||
public InheritableBoolean getUseSignedOffBy() {
|
||||
return useSignedOffBy;
|
||||
}
|
||||
|
||||
public InheritedBoolean getUseContentMerge() {
|
||||
public InheritableBoolean getUseContentMerge() {
|
||||
return useContentMerge;
|
||||
}
|
||||
|
||||
public InheritedBoolean getRequireChangeID() {
|
||||
public InheritableBoolean getRequireChangeID() {
|
||||
return requireChangeID;
|
||||
}
|
||||
|
||||
public void setUseContributorAgreements(final InheritedBoolean u) {
|
||||
public void setUseContributorAgreements(final InheritableBoolean u) {
|
||||
useContributorAgreements = u;
|
||||
}
|
||||
|
||||
public void setUseSignedOffBy(final InheritedBoolean sbo) {
|
||||
public void setUseSignedOffBy(final InheritableBoolean sbo) {
|
||||
useSignedOffBy = sbo;
|
||||
}
|
||||
|
||||
public void setUseContentMerge(final InheritedBoolean cm) {
|
||||
public void setUseContentMerge(final InheritableBoolean cm) {
|
||||
useContentMerge = cm;
|
||||
}
|
||||
|
||||
public void setRequireChangeID(final InheritedBoolean cid) {
|
||||
public void setRequireChangeID(final InheritableBoolean cid) {
|
||||
requireChangeID = cid;
|
||||
}
|
||||
|
||||
|
||||
@@ -287,12 +287,12 @@ public class ProjectConfig extends VersionedMetaData {
|
||||
}
|
||||
p.setParentName(rc.getString(ACCESS, null, KEY_INHERIT_FROM));
|
||||
|
||||
p.setUseContributorAgreements(getEnum(rc, RECEIVE, null, KEY_REQUIRE_CONTRIBUTOR_AGREEMENT, Project.InheritedBoolean.INHERIT));
|
||||
p.setUseSignedOffBy(getEnum(rc, RECEIVE, null, KEY_REQUIRE_SIGNED_OFF_BY, Project.InheritedBoolean.INHERIT));
|
||||
p.setRequireChangeID(getEnum(rc, RECEIVE, null, KEY_REQUIRE_CHANGE_ID, Project.InheritedBoolean.INHERIT));
|
||||
p.setUseContributorAgreements(getEnum(rc, RECEIVE, null, KEY_REQUIRE_CONTRIBUTOR_AGREEMENT, Project.InheritableBoolean.INHERIT));
|
||||
p.setUseSignedOffBy(getEnum(rc, RECEIVE, null, KEY_REQUIRE_SIGNED_OFF_BY, Project.InheritableBoolean.INHERIT));
|
||||
p.setRequireChangeID(getEnum(rc, RECEIVE, null, KEY_REQUIRE_CHANGE_ID, Project.InheritableBoolean.INHERIT));
|
||||
|
||||
p.setSubmitType(getEnum(rc, SUBMIT, null, KEY_ACTION, defaultSubmitAction));
|
||||
p.setUseContentMerge(getEnum(rc, SUBMIT, null, KEY_MERGE_CONTENT, Project.InheritedBoolean.INHERIT));
|
||||
p.setUseContentMerge(getEnum(rc, SUBMIT, null, KEY_MERGE_CONTENT, Project.InheritableBoolean.INHERIT));
|
||||
p.setState(getEnum(rc, PROJECT, null, KEY_STATE, defaultStateValue));
|
||||
|
||||
p.setDefaultDashboard(rc.getString(DASHBOARD, null, KEY_DEFAULT));
|
||||
@@ -536,12 +536,12 @@ public class ProjectConfig extends VersionedMetaData {
|
||||
}
|
||||
set(rc, ACCESS, null, KEY_INHERIT_FROM, p.getParentName());
|
||||
|
||||
set(rc, RECEIVE, null, KEY_REQUIRE_CONTRIBUTOR_AGREEMENT, p.getUseContributorAgreements(), Project.InheritedBoolean.INHERIT);
|
||||
set(rc, RECEIVE, null, KEY_REQUIRE_SIGNED_OFF_BY, p.getUseSignedOffBy(), Project.InheritedBoolean.INHERIT);
|
||||
set(rc, RECEIVE, null, KEY_REQUIRE_CHANGE_ID, p.getRequireChangeID(), Project.InheritedBoolean.INHERIT);
|
||||
set(rc, RECEIVE, null, KEY_REQUIRE_CONTRIBUTOR_AGREEMENT, p.getUseContributorAgreements(), Project.InheritableBoolean.INHERIT);
|
||||
set(rc, RECEIVE, null, KEY_REQUIRE_SIGNED_OFF_BY, p.getUseSignedOffBy(), Project.InheritableBoolean.INHERIT);
|
||||
set(rc, RECEIVE, null, KEY_REQUIRE_CHANGE_ID, p.getRequireChangeID(), Project.InheritableBoolean.INHERIT);
|
||||
|
||||
set(rc, SUBMIT, null, KEY_ACTION, p.getSubmitType(), defaultSubmitAction);
|
||||
set(rc, SUBMIT, null, KEY_MERGE_CONTENT, p.getUseContentMerge(), Project.InheritedBoolean.INHERIT);
|
||||
set(rc, SUBMIT, null, KEY_MERGE_CONTENT, p.getUseContentMerge(), Project.InheritableBoolean.INHERIT);
|
||||
|
||||
set(rc, PROJECT, null, KEY_STATE, p.getState(), null);
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ package com.google.gerrit.server.project;
|
||||
|
||||
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 java.util.List;
|
||||
@@ -28,19 +28,19 @@ public class CreateProjectArgs {
|
||||
public ProjectControl newParent;
|
||||
public String projectDescription;
|
||||
public SubmitType submitType;
|
||||
public InheritedBoolean contributorAgreements;
|
||||
public InheritedBoolean signedOffBy;
|
||||
public InheritableBoolean contributorAgreements;
|
||||
public InheritableBoolean signedOffBy;
|
||||
public boolean permissionsOnly;
|
||||
public List<String> branch;
|
||||
public InheritedBoolean contentMerge;
|
||||
public InheritedBoolean changeIdRequired;
|
||||
public InheritableBoolean contentMerge;
|
||||
public InheritableBoolean changeIdRequired;
|
||||
public boolean createEmptyCommit;
|
||||
|
||||
public CreateProjectArgs() {
|
||||
contributorAgreements = InheritedBoolean.INHERIT;
|
||||
signedOffBy = InheritedBoolean.INHERIT;
|
||||
contentMerge = InheritedBoolean.INHERIT;
|
||||
changeIdRequired = InheritedBoolean.INHERIT;
|
||||
contributorAgreements = InheritableBoolean.INHERIT;
|
||||
signedOffBy = InheritableBoolean.INHERIT;
|
||||
contentMerge = InheritableBoolean.INHERIT;
|
||||
changeIdRequired = InheritableBoolean.INHERIT;
|
||||
}
|
||||
|
||||
public Project.NameKey getProject() {
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.google.gerrit.common.data.Permission;
|
||||
import com.google.gerrit.common.data.PermissionRule;
|
||||
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.rules.PrologEnvironment;
|
||||
import com.google.gerrit.rules.RulesCache;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
@@ -315,42 +315,42 @@ public class ProjectState {
|
||||
}
|
||||
|
||||
public boolean isUseContributorAgreements() {
|
||||
return getInheritedBoolean(new Function<Project, InheritedBoolean>() {
|
||||
return getInheritableBoolean(new Function<Project, InheritableBoolean>() {
|
||||
@Override
|
||||
public InheritedBoolean apply(Project input) {
|
||||
public InheritableBoolean apply(Project input) {
|
||||
return input.getUseContributorAgreements();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public boolean isUseContentMerge() {
|
||||
return getInheritedBoolean(new Function<Project, InheritedBoolean>() {
|
||||
return getInheritableBoolean(new Function<Project, InheritableBoolean>() {
|
||||
@Override
|
||||
public InheritedBoolean apply(Project input) {
|
||||
public InheritableBoolean apply(Project input) {
|
||||
return input.getUseContentMerge();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public boolean isUseSignedOffBy() {
|
||||
return getInheritedBoolean(new Function<Project, InheritedBoolean>() {
|
||||
return getInheritableBoolean(new Function<Project, InheritableBoolean>() {
|
||||
@Override
|
||||
public InheritedBoolean apply(Project input) {
|
||||
public InheritableBoolean apply(Project input) {
|
||||
return input.getUseSignedOffBy();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public boolean isRequireChangeID() {
|
||||
return getInheritedBoolean(new Function<Project, InheritedBoolean>() {
|
||||
return getInheritableBoolean(new Function<Project, InheritableBoolean>() {
|
||||
@Override
|
||||
public InheritedBoolean apply(Project input) {
|
||||
public InheritableBoolean apply(Project input) {
|
||||
return input.getRequireChangeID();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean getInheritedBoolean(Function<Project, InheritedBoolean> func) {
|
||||
private boolean getInheritableBoolean(Function<Project, InheritableBoolean> func) {
|
||||
Set<Project.NameKey> seen = Sets.newHashSet();
|
||||
seen.add(getProject().getNameKey());
|
||||
ProjectState s = this;
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.google.gerrit.reviewdb.client.ApprovalCategory;
|
||||
import com.google.gerrit.reviewdb.client.ApprovalCategoryValue;
|
||||
import com.google.gerrit.reviewdb.client.CurrentSchemaVersion;
|
||||
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.SystemConfig;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.GerritPersonIdent;
|
||||
@@ -210,10 +210,10 @@ public class SchemaCreator {
|
||||
ProjectConfig config = ProjectConfig.read(md);
|
||||
Project p = config.getProject();
|
||||
p.setDescription("Rights inherited by all other projects");
|
||||
p.setRequireChangeID(InheritedBoolean.TRUE);
|
||||
p.setUseContentMerge(InheritedBoolean.FALSE);
|
||||
p.setUseContributorAgreements(InheritedBoolean.FALSE);
|
||||
p.setUseSignedOffBy(InheritedBoolean.FALSE);
|
||||
p.setRequireChangeID(InheritableBoolean.TRUE);
|
||||
p.setUseContentMerge(InheritableBoolean.FALSE);
|
||||
p.setUseContributorAgreements(InheritableBoolean.FALSE);
|
||||
p.setUseSignedOffBy(InheritableBoolean.FALSE);
|
||||
|
||||
AccessSection cap = config.getAccessSection(AccessSection.GLOBAL_CAPABILITIES, true);
|
||||
AccessSection all = config.getAccessSection(AccessSection.ALL, true);
|
||||
|
||||
@@ -33,7 +33,7 @@ import com.google.gerrit.common.data.PermissionRule;
|
||||
import com.google.gerrit.reviewdb.client.AccountGroup;
|
||||
import com.google.gerrit.reviewdb.client.ApprovalCategory;
|
||||
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.SystemConfig;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.GerritPersonIdent;
|
||||
@@ -201,7 +201,7 @@ class Schema_53 extends SchemaVersion {
|
||||
private void loadProject(ResultSet rs, Project project) throws SQLException,
|
||||
OrmException {
|
||||
project.setDescription(rs.getString("description"));
|
||||
project.setUseContributorAgreements(asInheritedBoolean(rs, "use_contributor_agreements"));
|
||||
project.setUseContributorAgreements(asInheritableBoolean(rs, "use_contributor_agreements"));
|
||||
|
||||
switch (rs.getString("submit_type").charAt(0)) {
|
||||
case 'F':
|
||||
@@ -221,17 +221,17 @@ class Schema_53 extends SchemaVersion {
|
||||
+ rs.getString("submit_type") + " on project " + project.getName());
|
||||
}
|
||||
|
||||
project.setUseSignedOffBy(asInheritedBoolean(rs, "use_signed_off_by"));
|
||||
project.setRequireChangeID(asInheritedBoolean(rs, "require_change_id"));
|
||||
project.setUseContentMerge(asInheritedBoolean(rs, "use_content_merge"));
|
||||
project.setUseSignedOffBy(asInheritableBoolean(rs, "use_signed_off_by"));
|
||||
project.setRequireChangeID(asInheritableBoolean(rs, "require_change_id"));
|
||||
project.setUseContentMerge(asInheritableBoolean(rs, "use_content_merge"));
|
||||
project.setParentName(rs.getString("parent_name"));
|
||||
}
|
||||
|
||||
private static InheritedBoolean asInheritedBoolean(ResultSet rs, String col)
|
||||
private static InheritableBoolean asInheritableBoolean(ResultSet rs, String col)
|
||||
throws SQLException {
|
||||
return "Y".equals(rs.getString(col))
|
||||
? Project.InheritedBoolean.TRUE
|
||||
: Project.InheritedBoolean.INHERIT;
|
||||
? Project.InheritableBoolean.TRUE
|
||||
: Project.InheritableBoolean.INHERIT;
|
||||
}
|
||||
|
||||
private void readOldRefRights(ReviewDb db) throws SQLException {
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user