Merge branch 'stable-3.1' into stable-3.2
* stable-3.1: PrologOptions: Enable error logging for dryrun options when debug is enabled config-project-config.txt: reformat submit-section TestSubmitType: Enable logErrors when debug logging is enabled TestSubmitRule: Enable logErrors when debug logging is enabled Fix typos in test.submit_rule and test.submit_type examples RestApiServlet: Log JSON parse error at debug level Change-Id: I7bd6bf5f4fd26b5853b8c1594d39ed7e7f51a223
This commit is contained in:
@@ -316,27 +316,35 @@ the parent project.
|
|||||||
The submit section includes configuration of project-specific
|
The submit section includes configuration of project-specific
|
||||||
submit settings:
|
submit settings:
|
||||||
|
|
||||||
[[content_merge]]
|
[[content_merge]]submit.mergeContent::
|
||||||
- 'mergeContent': Defines whether Gerrit will try to
|
+
|
||||||
|
Defines whether Gerrit will try to
|
||||||
do a content merge when a path conflict occurs. Valid values are
|
do a content merge when a path conflict occurs. Valid values are
|
||||||
'true', 'false', or 'INHERIT'. Default is 'INHERIT'. This option can
|
'true', 'false', or 'INHERIT'. Default is 'INHERIT'. This option can
|
||||||
be modified by any project owner through the project console, `Browse`
|
be modified by any project owner through the project console, `Browse`
|
||||||
> `Repositories` > my/project > `Allow content merges`.
|
> `Repositories` > my/project > `Allow content merges`.
|
||||||
|
|
||||||
- 'action': Defines the link:#submit-type[submit type]. Valid
|
[[submit.action]]submit.action::
|
||||||
|
+
|
||||||
|
Defines the link:#submit-type[submit type]. Valid
|
||||||
values are 'fast forward only', 'merge if necessary', 'rebase if necessary',
|
values are 'fast forward only', 'merge if necessary', 'rebase if necessary',
|
||||||
'rebase always', 'merge always' and 'cherry pick'. The default is 'merge if necessary'.
|
'rebase always', 'merge always' and 'cherry pick'. The default is 'merge if necessary'.
|
||||||
|
|
||||||
- 'matchAuthorToCommitterDate': Defines whether to the author date will be changed to match the
|
[[submit.matchAuthorToCommitterDate]]submit.matchAuthorToCommitterDate::
|
||||||
submitter date upon submit, so that git log shows when the change was submitted instead of when the
|
+
|
||||||
author last committed. Valid values are 'true', 'false', or 'INHERIT'. The default is 'INHERIT'.
|
Defines whether the author date will be changed to match the submitter date upon submit, so that
|
||||||
This option only takes effect in submit strategies which already modify the commit, i.e.
|
git log shows when the change was submitted instead of when the author last committed. Valid
|
||||||
Cherry Pick, Rebase Always, and (perhaps) Rebase If Necessary.
|
values are 'true', 'false', or 'INHERIT'. The default is 'INHERIT'. This option only takes effect
|
||||||
|
in submit strategies which already modify the commit, i.e. Cherry Pick, Rebase Always, and
|
||||||
|
(when rebase is necessary) Rebase If Necessary.
|
||||||
|
|
||||||
- 'rejectEmptyCommit': Defines whether empty commits should be rejected when a change is merged.
|
[[submit.rejectEmptyCommit]]submit.rejectEmptyCommit::
|
||||||
Changes might not seem empty at first but when attempting to merge, rebasing can lead to an empty
|
+
|
||||||
commit. If this option is set to 'true' the merge would fail. An empty commit is still allowed as
|
Defines whether empty commits should be rejected when a change is merged. When using
|
||||||
the initial commit on a branch.
|
link:#submit.action[submit action] Cherry Pick, Rebase If Necessary or Rebase Always changes may
|
||||||
|
become empty upon submit, since the rebase|cherry-pick can lead to an empty commit. If this option
|
||||||
|
is set to 'true' the merge would fail in such a case. An empty commit is still allowed as the
|
||||||
|
initial commit on a branch.
|
||||||
|
|
||||||
[[submit-type]]
|
[[submit-type]]
|
||||||
==== Submit Type
|
==== Submit Type
|
||||||
|
|||||||
@@ -4471,7 +4471,7 @@ a project-specific rule.
|
|||||||
.Request
|
.Request
|
||||||
----
|
----
|
||||||
POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_type HTTP/1.0
|
POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_type HTTP/1.0
|
||||||
Content-Type: text/plain; charset-UTF-8
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
|
||||||
submit_type(cherry_pick).
|
submit_type(cherry_pick).
|
||||||
----
|
----
|
||||||
@@ -4502,7 +4502,7 @@ a project-specific rule.
|
|||||||
.Request
|
.Request
|
||||||
----
|
----
|
||||||
POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_rule?filters=SKIP HTTP/1.0
|
POST /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/current/test.submit_rule?filters=SKIP HTTP/1.0
|
||||||
Content-Type: text/plain; charset-UTF-8
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
|
||||||
submit_rule(submit(R)) :-
|
submit_rule(submit(R)) :-
|
||||||
R = label('Any-Label-Name', reject(_)).
|
R = label('Any-Label-Name', reject(_)).
|
||||||
|
|||||||
@@ -601,6 +601,7 @@ public class RestApiServlet extends HttpServlet {
|
|||||||
}
|
}
|
||||||
} catch (MalformedJsonException | JsonParseException e) {
|
} catch (MalformedJsonException | JsonParseException e) {
|
||||||
cause = Optional.of(e);
|
cause = Optional.of(e);
|
||||||
|
logger.atFine().withCause(e).log("REST call failed on JSON parsing");
|
||||||
responseBytes =
|
responseBytes =
|
||||||
replyError(
|
replyError(
|
||||||
req, res, statusCode = SC_BAD_REQUEST, "Invalid " + JSON_TYPE + " in request", e);
|
req, res, statusCode = SC_BAD_REQUEST, "Invalid " + JSON_TYPE + " in request", e);
|
||||||
|
|||||||
@@ -15,18 +15,21 @@
|
|||||||
package com.google.gerrit.server.rules;
|
package com.google.gerrit.server.rules;
|
||||||
|
|
||||||
import com.google.auto.value.AutoValue;
|
import com.google.auto.value.AutoValue;
|
||||||
|
import com.google.common.flogger.FluentLogger;
|
||||||
import com.google.gerrit.common.Nullable;
|
import com.google.gerrit.common.Nullable;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@AutoValue
|
@AutoValue
|
||||||
public abstract class PrologOptions {
|
public abstract class PrologOptions {
|
||||||
|
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||||
|
|
||||||
public static PrologOptions defaultOptions() {
|
public static PrologOptions defaultOptions() {
|
||||||
return new AutoValue_PrologOptions.Builder().logErrors(true).skipFilters(false).build();
|
return new AutoValue_PrologOptions.Builder().logErrors(true).skipFilters(false).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PrologOptions dryRunOptions(String ruleToTest, boolean skipFilters) {
|
public static PrologOptions dryRunOptions(String ruleToTest, boolean skipFilters) {
|
||||||
return new AutoValue_PrologOptions.Builder()
|
return new AutoValue_PrologOptions.Builder()
|
||||||
.logErrors(false)
|
.logErrors(logger.atFine().isEnabled())
|
||||||
.skipFilters(skipFilters)
|
.skipFilters(skipFilters)
|
||||||
.rule(ruleToTest)
|
.rule(ruleToTest)
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
Reference in New Issue
Block a user