Don't create verified category by default

Most project teams seem confused with the out-of-the-box experience
needing to vote on both Code-Review and Verified categories in order
to submit a change.  Simplify the out of the box workflow to only have
Code-Review.  When a team installs the Hudson/Jenkins integration or
their own build system they can now trivially add the Verified
category by pasting 5 lines into project.config.

Change-Id: I1a6a233570a3051d09d9f163b7eaeb8fd60109d8
This commit is contained in:
Shawn Pearce
2013-03-28 18:02:19 -04:00
parent 2fd31ddc27
commit 77d9662d47
3 changed files with 50 additions and 67 deletions

View File

@@ -5,56 +5,10 @@ As part of the code review process, reviewers score each change with
values for each label configured for the project. The label values that
a given user is allowed to set are defined according to the
link:access-control.html#access_labels[access controls]. Gerrit comes
pre-configured with several default labels that can be granted to groups
pre-configured with the Code-Review label that can be granted to groups
within projects, enabling functionality for that group's members.
[[label_Verified]]
Label: Verified
---------------
The verified label is one of two default labels that is configured upon
the creation of a Gerrit instance. It may have any meaning the project
desires. It was originally invented by the Android Open Source Project
to mean 'compiles, passes basic unit tests'.
The range of values is:
* -1 Fails
+
Tried to compile, but got a compile error, or tried to run tests,
but one or more tests did not pass.
+
*Any -1 blocks submit.*
* 0 No score
+
Didn't try to perform the verification tasks.
* +1 Verified
+
Compiled (and ran tests) successfully.
+
*Any +1 enables submit.*
For a change to be submittable, the change must have a `+1 Verified`
in this label, and no `-1 Fails`. Thus, `-1 Fails` can block a submit,
while `+1 Verified` enables a submit.
If a Gerrit installation does not wish to use this label in any project,
the `[label "Verified"]` section can be deleted from `project.config` in
`All-Projects`.
If a Gerrit installation or project wants to modify the description text
associated with these label values, the text can be updated in the
`label.Verified.value` fields in `project.config`.
Additional values could also be added to this label, to allow it to
behave more like `Code-Review` (below). Add -2 and +2 entries to the
`label.Verified.value` fields in `project.config` to get the same
behavior.
[[label_Code-Review]]
Label: Code-Review
------------------
@@ -128,6 +82,54 @@ label is a `MaxWithBlock` type, which means that the lowest negative
value if present blocks a submit, while the highest positive value is
required to enable submit.
[[label_Verified]]
Label: Verified
---------------
The Verified label was originally invented by the Android Open Source
Project to mean 'compiles, passes basic unit tests'. Some CI tools
expect to use the Verified label to vote on a change after running.
Administrators can install the Verified label by adding the following
text to `project.config`:
====
[label "Verified"]
functionName = MaxWithBlock
value = -1 Fails
value = 0 No score
value = +1 Verified
====
The range of values is:
* -1 Fails
+
Tried to compile, but got a compile error, or tried to run tests,
but one or more tests did not pass.
+
*Any -1 blocks submit.*
* 0 No score
+
Didn't try to perform the verification tasks.
* +1 Verified
+
Compiled (and ran tests) successfully.
+
*Any +1 enables submit.*
For a change to be submittable, the change must have a `+1 Verified`
in this label, and no `-1 Fails`. Thus, `-1 Fails` can block a submit,
while `+1 Verified` enables a submit.
Additional values could also be added to this label, to allow it to
behave more like `Code-Review` (below). Add -2 and +2 entries to the
`label.Verified.value` fields in `project.config` to get the same
behavior.
[[label_custom]]
Your Label Here
---------------

View File

@@ -243,7 +243,6 @@ public class SchemaCreator {
metaReadPermission.setExclusiveGroup(true);
metaReadPermission.add(rule(config, owners));
initVerifiedLabel(config);
initCodeReviewLabel(config);
md.setMessage("Initialized Gerrit Code Review " + Version.getVersion());
@@ -254,14 +253,6 @@ public class SchemaCreator {
return new PermissionRule(config.resolve(group));
}
public static void initVerifiedLabel(ProjectConfig c) {
LabelType type = new LabelType("Verified", ImmutableList.of(
new LabelValue((short) 1, "Verified"),
new LabelValue((short) 0, "No score"),
new LabelValue((short) -1, "Fails")));
c.getLabelSections().put(type.getName(), type);
}
public static void initCodeReviewLabel(ProjectConfig c) {
LabelType type = new LabelType("Code-Review", ImmutableList.of(
new LabelValue((short) 2, "Looks good to me, approved"),

View File

@@ -107,17 +107,7 @@ public class SchemaCreatorTest extends TestCase {
for (LabelType label : getLabelTypes().getLabelTypes()) {
labels.add(label.getName());
}
assertEquals(ImmutableList.of("Verified", "Code-Review"), labels);
}
public void testCreateSchema_Label_Verified() throws Exception {
LabelType verified = getLabelTypes().byLabel("Verified");
assertNotNull(verified);
assertEquals("Verified", verified.getName());
assertEquals("V", verified.getAbbreviatedName());
assertEquals("MaxWithBlock", verified.getFunctionName());
assertFalse(verified.isCopyMinScore());
assertValueRange(verified, 1, 0, -1);
assertEquals(ImmutableList.of("Code-Review"), labels);
}
public void testCreateSchema_Label_CodeReview() throws Exception {