Merge "Add AnyWithBlock prolog function"

This commit is contained in:
Shawn Pearce
2013-08-09 17:22:14 +00:00
committed by Gerrit Code Review
3 changed files with 19 additions and 1 deletions

View File

@@ -203,6 +203,12 @@ the highest possible positive value is required to enable submit. There
must be at least one positive value, or else submit will never be must be at least one positive value, or else submit will never be
enabled. To permit blocking submits, ensure a negative value is defined. enabled. To permit blocking submits, ensure a negative value is defined.
* `AnyWithBlock`
+
The lowest possible negative value, if present, blocks a submit, Any
other value enables a submit. To permit blocking submits, ensure
that a negative value is defined.
* `MaxNoBlock` * `MaxNoBlock`
+ +
The highest possible positive value is required to enable submit, but The highest possible positive value is required to enable submit, but

View File

@@ -128,7 +128,7 @@ public class ProjectConfig extends VersionedMetaData {
private static final String KEY_VALUE = "value"; private static final String KEY_VALUE = "value";
private static final String KEY_CAN_OVERRIDE = "canOverride"; private static final String KEY_CAN_OVERRIDE = "canOverride";
private static final Set<String> LABEL_FUNCTIONS = ImmutableSet.of( private static final Set<String> LABEL_FUNCTIONS = ImmutableSet.of(
"MaxWithBlock", "MaxNoBlock", "NoBlock", "NoOp"); "MaxWithBlock", "AnyWithBlock", "MaxNoBlock", "NoBlock", "NoOp");
private static final SubmitType defaultSubmitAction = private static final SubmitType defaultSubmitAction =
SubmitType.MERGE_IF_NECESSARY; SubmitType.MERGE_IF_NECESSARY;

View File

@@ -239,6 +239,7 @@ default_submit([Type | Types], Tmp, Out) :-
%% Apply the old -2..+2 style logic. %% Apply the old -2..+2 style logic.
%% %%
legacy_submit_rule('MaxWithBlock', Label, Min, Max, T) :- !, max_with_block(Label, Min, Max, T). legacy_submit_rule('MaxWithBlock', Label, Min, Max, T) :- !, max_with_block(Label, Min, Max, T).
legacy_submit_rule('AnyWithBlock', Label, Min, Max, T) :- !, any_with_block(Label, Min, T).
legacy_submit_rule('MaxNoBlock', Label, Min, Max, T) :- !, max_no_block(Label, Max, T). legacy_submit_rule('MaxNoBlock', Label, Min, Max, T) :- !, max_no_block(Label, Max, T).
legacy_submit_rule('NoBlock', Label, Min, Max, T) :- !, T = may(_). legacy_submit_rule('NoBlock', Label, Min, Max, T) :- !, T = may(_).
legacy_submit_rule('NoOp', Label, Min, Max, T) :- !, T = may(_). legacy_submit_rule('NoOp', Label, Min, Max, T) :- !, T = may(_).
@@ -267,6 +268,7 @@ max_with_block(Label, Min, Max, ok(Who)) :-
max_with_block(Label, Min, Max, need(Max)) :- max_with_block(Label, Min, Max, need(Max)) :-
true true
. .
%TODO Uncomment this clause when group suggesting is possible. %TODO Uncomment this clause when group suggesting is possible.
%max_with_block(Label, Min, Max, need(Max, Group)) :- %max_with_block(Label, Min, Max, need(Max, Group)) :-
% \+ check_label_range_permission(Label, Max, ok(_)), % \+ check_label_range_permission(Label, Max, ok(_)),
@@ -276,6 +278,16 @@ max_with_block(Label, Min, Max, need(Max)) :-
% \+ check_label_range_permission(Label, Max, ask(Group)) % \+ check_label_range_permission(Label, Max, ask(Group))
% . % .
%% any_with_block:
%%
%% - The maximum is never used.
%%
any_with_block(Label, Min, reject(Who)) :-
check_label_range_permission(Label, Min, ok(Who)),
!
.
any_with_block(Label, Min, may(_)).
%% max_no_block: %% max_no_block:
%% %%