Merge branch 'stable-2.11'
* stable-2.11: Update 2.11 release notes Make LabelTypeIT tests assume copy-score defaults now initialized herein Remove duplication of defaults for boolean label types in ProjectConfig Add tests for copyAllScoresIfNoChange in LabelTypeIT Change-Id: I035ce888508fcab47e3939a4332710966049bb91
This commit is contained in:
@@ -222,7 +222,8 @@ determining whether a change is submittable.
|
||||
=== `label.Label-Name.copyMinScore`
|
||||
|
||||
If true, the lowest possible negative value for the label is copied
|
||||
forward when a new patch set is uploaded.
|
||||
forward when a new patch set is uploaded. Defaults to false, except
|
||||
for All-Projects which has it true by default.
|
||||
|
||||
[[label_copyMaxScore]]
|
||||
=== `label.Label-Name.copyMaxScore`
|
||||
@@ -230,7 +231,7 @@ forward when a new patch set is uploaded.
|
||||
If true, the highest possible positive value for the label is copied
|
||||
forward when a new patch set is uploaded. This can be used to enable
|
||||
sticky approvals, reducing turn-around for trivial cleanups prior to
|
||||
submitting a change.
|
||||
submitting a change. Defaults to false.
|
||||
|
||||
[[label_copyAllScoresOnTrivialRebase]]
|
||||
=== `label.Label-Name.copyAllScoresOnTrivialRebase`
|
||||
|
@@ -7,6 +7,11 @@ Gerrit 2.11 is now available:
|
||||
link:https://gerrit-releases.storage.googleapis.com/gerrit-2.11.war[
|
||||
https://gerrit-releases.storage.googleapis.com/gerrit-2.11.war]
|
||||
|
||||
Gerrit 2.11 includes the bug fixes done with
|
||||
link:ReleaseNotes-2.10.1.html[Gerrit 2.10.1].
|
||||
These bug fixes are *not* listed in these release notes.
|
||||
|
||||
|
||||
Important Notes
|
||||
---------------
|
||||
|
||||
@@ -361,9 +366,6 @@ Allow projects to be configured to create a new change for every uploaded commit
|
||||
link:https://gerrit-documentation.storage.googleapis.com/Documentation/2.11/config-gerrit.html#container.daemonOpt[
|
||||
options to pass to the daemon].
|
||||
|
||||
* Remove support for Google accounts and add support for Launchpad accounts on
|
||||
the OpenID login page.
|
||||
|
||||
Daemon
|
||||
~~~~~~
|
||||
|
||||
@@ -524,22 +526,8 @@ If a user uploaded a change while `allowDrafts` was enabled, and then it was
|
||||
disabled by the administrator, the uploaded change could not be published and
|
||||
was stuck in the draft state.
|
||||
|
||||
* link:https://code.google.com/p/gerrit/issues/detail?id=3211[Issue 3211]:
|
||||
Fix crash in the `show-queues` command.
|
||||
+
|
||||
Running the `show-queues` command while an `ls-projects` command was executing
|
||||
would cause a crash.
|
||||
|
||||
|
||||
Authentication
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
* Improve LDAP login times and transfer 40x less data.
|
||||
+
|
||||
When recursively expanding LDAP groups, all attributes were fetched. However
|
||||
only one of the attributes is actually needed. By fetching only that attribute,
|
||||
the amount of data transferred is significantly reduced and the login time is
|
||||
decreased.
|
||||
* link:https://code.google.com/p/gerrit/issues/detail?id=3249[Issue 3249]:
|
||||
Fix server error when checking mergeability of a change.
|
||||
|
||||
|
||||
Secondary Index / Search
|
||||
@@ -717,6 +705,9 @@ now show the email address that matched, not the preferred email address.
|
||||
|
||||
* Fix accidental reviewer selection on slow networks.
|
||||
|
||||
* link:http://code.google.com/p/gerrit/issues/detail?id=3120[Issue 3120]:
|
||||
Align parent weblinks with parent commits in the commit box.
|
||||
|
||||
|
||||
Side-By-Side Diff
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
@@ -48,16 +48,16 @@ public class LabelTypeIT extends AbstractDaemonTest {
|
||||
public void setUp() throws Exception {
|
||||
ProjectConfig cfg = projectCache.checkedGet(allProjects).getConfig();
|
||||
codeReview = checkNotNull(cfg.getLabelSections().get("Code-Review"));
|
||||
codeReview.setCopyMinScore(false);
|
||||
codeReview.setCopyMaxScore(false);
|
||||
codeReview.setCopyAllScoresOnTrivialRebase(false);
|
||||
codeReview.setCopyAllScoresIfNoCodeChange(false);
|
||||
codeReview.setDefaultValue((short)-1);
|
||||
saveProjectConfig(cfg);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noCopyMinScoreOnRework() throws Exception {
|
||||
//allProjects only has it true by default
|
||||
codeReview.setCopyMinScore(false);
|
||||
saveLabelConfig();
|
||||
|
||||
PushOneCommit.Result r = createChange();
|
||||
revision(r).review(ReviewInput.reject());
|
||||
assertApproval(r, -2);
|
||||
@@ -71,7 +71,7 @@ public class LabelTypeIT extends AbstractDaemonTest {
|
||||
saveLabelConfig();
|
||||
PushOneCommit.Result r = createChange();
|
||||
revision(r).review(ReviewInput.reject());
|
||||
//assertApproval(r, -2);
|
||||
assertApproval(r, -2);
|
||||
r = amendChange(r.getChangeId());
|
||||
assertApproval(r, -2);
|
||||
}
|
||||
@@ -122,6 +122,22 @@ public class LabelTypeIT extends AbstractDaemonTest {
|
||||
assertApproval(r, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noCopyAllScoresIfNoChange() throws Exception {
|
||||
codeReview.setCopyAllScoresIfNoChange(false);
|
||||
saveLabelConfig();
|
||||
PushOneCommit.Result patchSet = readyPatchSetForNoChangeRebase();
|
||||
rebase(patchSet);
|
||||
assertApproval(patchSet, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void copyAllScoresIfNoChange() throws Exception {
|
||||
PushOneCommit.Result patchSet = readyPatchSetForNoChangeRebase();
|
||||
rebase(patchSet);
|
||||
assertApproval(patchSet, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noCopyAllScoresIfNoCodeChange() throws Exception {
|
||||
String file = "a.txt";
|
||||
@@ -267,6 +283,34 @@ public class LabelTypeIT extends AbstractDaemonTest {
|
||||
.get());
|
||||
}
|
||||
|
||||
private PushOneCommit.Result readyPatchSetForNoChangeRebase()
|
||||
throws Exception {
|
||||
String file = "a.txt";
|
||||
String contents = "contents";
|
||||
|
||||
PushOneCommit push = pushFactory.create(db, admin.getIdent(),
|
||||
PushOneCommit.SUBJECT, file, contents);
|
||||
PushOneCommit.Result base = push.to(git, "refs/for/master");
|
||||
merge(base);
|
||||
|
||||
push = pushFactory.create(db, admin.getIdent(),
|
||||
PushOneCommit.SUBJECT, file, contents + "M");
|
||||
PushOneCommit.Result basePlusM = push.to(git, "refs/for/master");
|
||||
merge(basePlusM);
|
||||
|
||||
push = pushFactory.create(db, admin.getIdent(),
|
||||
PushOneCommit.SUBJECT, file, contents);
|
||||
PushOneCommit.Result basePlusMMinusM = push.to(git, "refs/for/master");
|
||||
merge(basePlusMMinusM);
|
||||
|
||||
git.checkout().setName(base.getCommit().name()).call();
|
||||
push = pushFactory.create(db, admin.getIdent(),
|
||||
PushOneCommit.SUBJECT, file, contents + "MM");
|
||||
PushOneCommit.Result patchSet = push.to(git, "refs/for/master");
|
||||
revision(patchSet).review(ReviewInput.recommend());
|
||||
return patchSet;
|
||||
}
|
||||
|
||||
private void saveLabelConfig() throws Exception {
|
||||
ProjectConfig cfg = projectCache.checkedGet(allProjects).getConfig();
|
||||
cfg.getLabelSections().clear();
|
||||
|
@@ -25,6 +25,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class LabelType {
|
||||
public static final boolean DEF_CAN_OVERRIDE = true;
|
||||
public static final boolean DEF_COPY_ALL_SCORES_IF_NO_CHANGE = true;
|
||||
public static final boolean DEF_COPY_ALL_SCORES_IF_NO_CODE_CHANGE = false;
|
||||
public static final boolean DEF_COPY_ALL_SCORES_ON_TRIVIAL_REBASE = false;
|
||||
public static final boolean DEF_COPY_MAX_SCORE = false;
|
||||
public static final boolean DEF_COPY_MIN_SCORE = false;
|
||||
|
||||
public static LabelType withDefaultValues(String name) {
|
||||
checkName(name);
|
||||
List<LabelValue> values = new ArrayList<>(2);
|
||||
@@ -127,6 +134,12 @@ public class LabelType {
|
||||
maxPositive = values.get(values.size() - 1).getValue();
|
||||
}
|
||||
}
|
||||
setCanOverride(DEF_CAN_OVERRIDE);
|
||||
setCopyAllScoresIfNoChange(DEF_COPY_ALL_SCORES_IF_NO_CHANGE);
|
||||
setCopyAllScoresIfNoCodeChange(DEF_COPY_ALL_SCORES_IF_NO_CODE_CHANGE);
|
||||
setCopyAllScoresOnTrivialRebase(DEF_COPY_ALL_SCORES_ON_TRIVIAL_REBASE);
|
||||
setCopyMaxScore(DEF_COPY_MAX_SCORE);
|
||||
setCopyMinScore(DEF_COPY_MIN_SCORE);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
@@ -691,17 +691,23 @@ public class ProjectConfig extends VersionedMetaData implements ValidationError.
|
||||
KEY_DEFAULT_VALUE, dv, name)));
|
||||
}
|
||||
label.setCopyMinScore(
|
||||
rc.getBoolean(LABEL, name, KEY_COPY_MIN_SCORE, false));
|
||||
rc.getBoolean(LABEL, name, KEY_COPY_MIN_SCORE,
|
||||
LabelType.DEF_COPY_MIN_SCORE));
|
||||
label.setCopyMaxScore(
|
||||
rc.getBoolean(LABEL, name, KEY_COPY_MAX_SCORE, false));
|
||||
rc.getBoolean(LABEL, name, KEY_COPY_MAX_SCORE,
|
||||
LabelType.DEF_COPY_MAX_SCORE));
|
||||
label.setCopyAllScoresOnTrivialRebase(
|
||||
rc.getBoolean(LABEL, name, KEY_COPY_ALL_SCORES_ON_TRIVIAL_REBASE, false));
|
||||
rc.getBoolean(LABEL, name, KEY_COPY_ALL_SCORES_ON_TRIVIAL_REBASE,
|
||||
LabelType.DEF_COPY_ALL_SCORES_ON_TRIVIAL_REBASE));
|
||||
label.setCopyAllScoresIfNoCodeChange(
|
||||
rc.getBoolean(LABEL, name, KEY_COPY_ALL_SCORES_IF_NO_CODE_CHANGE, false));
|
||||
rc.getBoolean(LABEL, name, KEY_COPY_ALL_SCORES_IF_NO_CODE_CHANGE,
|
||||
LabelType.DEF_COPY_ALL_SCORES_IF_NO_CODE_CHANGE));
|
||||
label.setCopyAllScoresIfNoChange(
|
||||
rc.getBoolean(LABEL, name, KEY_COPY_ALL_SCORES_IF_NO_CHANGE, true));
|
||||
rc.getBoolean(LABEL, name, KEY_COPY_ALL_SCORES_IF_NO_CHANGE,
|
||||
LabelType.DEF_COPY_ALL_SCORES_IF_NO_CHANGE));
|
||||
label.setCanOverride(
|
||||
rc.getBoolean(LABEL, name, KEY_CAN_OVERRIDE, true));
|
||||
rc.getBoolean(LABEL, name, KEY_CAN_OVERRIDE,
|
||||
LabelType.DEF_CAN_OVERRIDE));
|
||||
label.setRefPatterns(getStringListOrNull(rc, LABEL, name, KEY_Branch));
|
||||
labelSections.put(name, label);
|
||||
}
|
||||
@@ -1034,37 +1040,22 @@ public class ProjectConfig extends VersionedMetaData implements ValidationError.
|
||||
toUnset.remove(name);
|
||||
rc.setString(LABEL, name, KEY_FUNCTION, label.getFunctionName());
|
||||
rc.setInt(LABEL, name, KEY_DEFAULT_VALUE, label.getDefaultValue());
|
||||
if (label.isCopyMinScore()) {
|
||||
rc.setBoolean(LABEL, name, KEY_COPY_MIN_SCORE, true);
|
||||
} else {
|
||||
rc.unset(LABEL, name, KEY_COPY_MIN_SCORE);
|
||||
}
|
||||
if (label.isCopyMaxScore()) {
|
||||
rc.setBoolean(LABEL, name, KEY_COPY_MAX_SCORE, true);
|
||||
} else {
|
||||
rc.unset(LABEL, name, KEY_COPY_MAX_SCORE);
|
||||
}
|
||||
if (label.isCopyAllScoresOnTrivialRebase()) {
|
||||
rc.setBoolean(LABEL, name, KEY_COPY_ALL_SCORES_ON_TRIVIAL_REBASE, true);
|
||||
} else {
|
||||
rc.unset(LABEL, name, KEY_COPY_ALL_SCORES_ON_TRIVIAL_REBASE);
|
||||
}
|
||||
if (label.isCopyAllScoresIfNoCodeChange()) {
|
||||
rc.setBoolean(LABEL, name, KEY_COPY_ALL_SCORES_IF_NO_CODE_CHANGE, true);
|
||||
} else {
|
||||
rc.unset(LABEL, name, KEY_COPY_ALL_SCORES_IF_NO_CODE_CHANGE);
|
||||
}
|
||||
if (!label.isCopyAllScoresIfNoChange()) {
|
||||
rc.setBoolean(LABEL, name, KEY_COPY_ALL_SCORES_IF_NO_CHANGE, false);
|
||||
} else {
|
||||
rc.unset(LABEL, name, KEY_COPY_ALL_SCORES_IF_NO_CHANGE);
|
||||
}
|
||||
if (!label.canOverride()) {
|
||||
rc.setBoolean(LABEL, name, KEY_CAN_OVERRIDE, false);
|
||||
} else {
|
||||
rc.unset(LABEL, name, KEY_CAN_OVERRIDE);
|
||||
}
|
||||
|
||||
setBooleanConfigKey(rc, name, KEY_COPY_MIN_SCORE, label.isCopyMinScore(),
|
||||
LabelType.DEF_COPY_MIN_SCORE);
|
||||
setBooleanConfigKey(rc, name, KEY_COPY_MAX_SCORE, label.isCopyMaxScore(),
|
||||
LabelType.DEF_COPY_MAX_SCORE);
|
||||
setBooleanConfigKey(rc, name, KEY_COPY_ALL_SCORES_ON_TRIVIAL_REBASE,
|
||||
label.isCopyAllScoresOnTrivialRebase(),
|
||||
LabelType.DEF_COPY_ALL_SCORES_ON_TRIVIAL_REBASE);
|
||||
setBooleanConfigKey(rc, name, KEY_COPY_ALL_SCORES_IF_NO_CODE_CHANGE,
|
||||
label.isCopyAllScoresIfNoCodeChange(),
|
||||
LabelType.DEF_COPY_ALL_SCORES_IF_NO_CODE_CHANGE);
|
||||
setBooleanConfigKey(rc, name, KEY_COPY_ALL_SCORES_IF_NO_CHANGE,
|
||||
label.isCopyAllScoresIfNoChange(),
|
||||
LabelType.DEF_COPY_ALL_SCORES_IF_NO_CHANGE);
|
||||
setBooleanConfigKey(rc, name, KEY_CAN_OVERRIDE, label.canOverride(),
|
||||
LabelType.DEF_CAN_OVERRIDE);
|
||||
List<String> values =
|
||||
Lists.newArrayListWithCapacity(label.getValues().size());
|
||||
for (LabelValue value : label.getValues()) {
|
||||
@@ -1078,6 +1069,15 @@ public class ProjectConfig extends VersionedMetaData implements ValidationError.
|
||||
}
|
||||
}
|
||||
|
||||
private static void setBooleanConfigKey(
|
||||
Config rc, String name, String key, boolean value, boolean defaultValue) {
|
||||
if (value == defaultValue) {
|
||||
rc.unset(LABEL, name, key);
|
||||
} else {
|
||||
rc.setBoolean(LABEL, name, key, value);
|
||||
}
|
||||
}
|
||||
|
||||
private void savePluginSections(Config rc) {
|
||||
List<String> existing = Lists.newArrayList(rc.getSubsections(PLUGIN));
|
||||
for (String name : existing) {
|
||||
|
Reference in New Issue
Block a user