Merge "Clean up code in gr-apply-fix-dialog"
diff --git a/Documentation/config-labels.txt b/Documentation/config-labels.txt
index 857725d..b7493a3 100644
--- a/Documentation/config-labels.txt
+++ b/Documentation/config-labels.txt
@@ -133,7 +133,7 @@
----
[label "Verified"]
- function = MaxWithBlock
+ function = NoBlock
value = -1 Fails
value = 0 No score
value = +1 Verified
@@ -159,6 +159,23 @@
+
*Any +1 enables submit.*
+Set the function to "NoBlock" to enable configuring submit-requirements.
+All other possible label function values are deprecated. The default is still
+"MaxWithBlock" which doesn't allow using the more flexible submit-requirements.
+
+Add a submit-requirement for the "Verified" label to define which
+conditions are required to make the change submittable:
+
+----
+ [submit-requirement "Verified"]
+ submittableIf = label:Verified=MAX AND -label:Verified=MIN
+ applicableIf = -branch:refs/meta/config
+----
+
+See the
+link:config-submit-requirements.html#examples[submit-requirements
+documentation] for more details.
+
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.
@@ -568,12 +585,25 @@
----
[label "Copyright-Check"]
- function = MaxWithBlock
+ function = NoBlock
value = -1 Do not have copyright
value = 0 No score
value = +1 Copyright clear
----
+Add a submit-requirement for the "Copyright-Check" label to define which
+score is required to make the change submittable:
+
+----
+ [submit-requirement "Copyright-Check"]
+ submittableIf = label:Copyright-Check=MAX AND -label:Copyright-Check=MIN
+ applicableIf = -branch:refs/meta/config
+----
+
+See the
+link:config-submit-requirements.html#examples[submit-requirements
+documentation] for more details.
+
The new column will appear at the end of the table, and `-1 Do not have
copyright` will block submit, while `+1 Copyright clear` is required to
enable submit.
diff --git a/plugins/replication b/plugins/replication
index 60693ef..90c6420 160000
--- a/plugins/replication
+++ b/plugins/replication
@@ -1 +1 @@
-Subproject commit 60693efae661105fb6278c16cae9502d29bfa7f3
+Subproject commit 90c64204e1e27ec245f41b3d08b10f431dd72faf
diff --git a/polygerrit-ui/app/elements/settings/gr-preferences/gr-preferences.ts b/polygerrit-ui/app/elements/settings/gr-preferences/gr-preferences.ts
index c97a036..a65c8a4 100644
--- a/polygerrit-ui/app/elements/settings/gr-preferences/gr-preferences.ts
+++ b/polygerrit-ui/app/elements/settings/gr-preferences/gr-preferences.ts
@@ -124,15 +124,13 @@
() => this.getConfigModel().docsBaseUrl$,
docsBaseUrl => (this.docsBaseUrl = docsBaseUrl)
);
- if (this.flagsService.isEnabled(KnownExperimentId.ML_SUGGESTED_EDIT_V2)) {
- subscribe(
- this,
- () => this.getPluginLoader().pluginsModel.suggestionsPlugins$,
- // We currently support results from only 1 provider.
- suggestionsPlugins =>
- (this.suggestionsProvider = suggestionsPlugins?.[0]?.provider)
- );
- }
+ subscribe(
+ this,
+ () => this.getPluginLoader().pluginsModel.suggestionsPlugins$,
+ // We currently support results from only 1 provider.
+ suggestionsPlugins =>
+ (this.suggestionsProvider = suggestionsPlugins?.[0]?.provider)
+ );
}
static override get styles() {
diff --git a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
index b55c9fd..7a3b7ec 100644
--- a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
+++ b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
@@ -436,32 +436,29 @@
this.autocompleteComment();
}
);
- if (this.flagsService.isEnabled(KnownExperimentId.ML_SUGGESTED_EDIT_V2)) {
- subscribe(
- this,
- () =>
- this.generateSuggestionTrigger$.pipe(
- debounceTime(GENERATE_SUGGESTION_DEBOUNCE_DELAY_MS)
- ),
- () => {
- this.generateSuggestEdit();
+ subscribe(
+ this,
+ () =>
+ this.generateSuggestionTrigger$.pipe(
+ debounceTime(GENERATE_SUGGESTION_DEBOUNCE_DELAY_MS)
+ ),
+ () => {
+ this.generateSuggestEdit();
+ }
+ );
+ subscribe(
+ this,
+ () => this.getUserModel().preferences$,
+ prefs => {
+ this.autocompleteEnabled = !!prefs.allow_autocompleting_comments;
+ if (
+ this.generateSuggestion !==
+ !!prefs.allow_suggest_code_while_commenting
+ ) {
+ this.generateSuggestion = !!prefs.allow_suggest_code_while_commenting;
}
- );
- subscribe(
- this,
- () => this.getUserModel().preferences$,
- prefs => {
- this.autocompleteEnabled = !!prefs.allow_autocompleting_comments;
- if (
- this.generateSuggestion !==
- !!prefs.allow_suggest_code_while_commenting
- ) {
- this.generateSuggestion =
- !!prefs.allow_suggest_code_while_commenting;
- }
- }
- );
- }
+ }
+ );
}
override connectedCallback() {
@@ -1150,7 +1147,6 @@
// private but used in test
showGeneratedSuggestion() {
return (
- this.flagsService.isEnabled(KnownExperimentId.ML_SUGGESTED_EDIT_V2) &&
this.suggestionsProvider &&
this.editing &&
!this.permanentEditingMode &&
@@ -1224,14 +1220,8 @@
if (this.generateSuggestion) {
this.generateSuggestionTrigger$.next();
} else {
- if (
- this.flagsService.isEnabled(
- KnownExperimentId.ML_SUGGESTED_EDIT_V2
- )
- ) {
- this.generatedFixSuggestion = undefined;
- this.autoSaveTrigger$.next();
- }
+ this.generatedFixSuggestion = undefined;
+ this.autoSaveTrigger$.next();
}
this.reporting.reportInteraction(
this.generateSuggestion
@@ -1240,9 +1230,7 @@
);
}}
/>
- ${this.flagsService.isEnabled(KnownExperimentId.ML_SUGGESTED_EDIT_V2)
- ? 'Attach AI-suggested fix'
- : 'Generate Suggestion'}
+ Attach AI-suggested fix
${when(
this.suggestionLoading,
() => html`<span class="loadingSpin"></span>`,
@@ -1278,13 +1266,7 @@
}
}
- private generateSuggestEdit() {
- if (this.flagsService.isEnabled(KnownExperimentId.ML_SUGGESTED_EDIT_V2)) {
- this.generateSuggestEdit_v2();
- }
- }
-
- private async generateSuggestEdit_v2() {
+ private async generateSuggestEdit() {
const suggestionsProvider = this.suggestionsProvider;
const changeInfo = this.getChangeModel().getChange();
if (
@@ -1854,8 +1836,6 @@
}
getFixSuggestions(): FixSuggestionInfo[] | undefined {
- if (!this.flagsService.isEnabled(KnownExperimentId.ML_SUGGESTED_EDIT_V2))
- return undefined;
if (!this.generateSuggestion) return undefined;
if (!this.generatedFixSuggestion) return undefined;
// Disable fix suggestions when the comment already has a user suggestion
diff --git a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.ts b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.ts
index 7292c64..fe19d9b 100644
--- a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.ts
@@ -48,7 +48,6 @@
CommentsModel,
commentsModelToken,
} from '../../../models/comments/comments-model';
-import {KnownExperimentId} from '../../../services/flags/flags';
import {GrSuggestionDiffPreview} from '../gr-suggestion-diff-preview/gr-suggestion-diff-preview';
suite('gr-comment tests', () => {
@@ -1005,11 +1004,6 @@
},
],
};
- setup(async () => {
- stubFlags('isEnabled')
- .withArgs(KnownExperimentId.ML_SUGGESTED_EDIT_V2)
- .returns(true);
- });
test('renders suggestions in comment', async () => {
const comment = {
diff --git a/polygerrit-ui/app/services/flags/flags.ts b/polygerrit-ui/app/services/flags/flags.ts
index 0bf3c97..750b421 100644
--- a/polygerrit-ui/app/services/flags/flags.ts
+++ b/polygerrit-ui/app/services/flags/flags.ts
@@ -19,7 +19,6 @@
CHECKS_DEVELOPER = 'UiFeature__checks_developer',
PUSH_NOTIFICATIONS_DEVELOPER = 'UiFeature__push_notifications_developer',
PUSH_NOTIFICATIONS = 'UiFeature__push_notifications',
- ML_SUGGESTED_EDIT_V2 = 'UiFeature__ml_suggested_edit_v2',
REVISION_PARENTS_DATA = 'UiFeature__revision_parents_data',
COMMENT_AUTOCOMPLETION = 'UiFeature__comment_autocompletion_enabled',
SAVE_PROJECT_CONFIG_FOR_REVIEW = 'UiFeature__save_project_config_for_review',
diff --git a/tools/bzl/classpath.bzl b/tools/bzl/classpath.bzl
index 3c80fc3..e196c10 100644
--- a/tools/bzl/classpath.bzl
+++ b/tools/bzl/classpath.bzl
@@ -1,3 +1,5 @@
+load("@rules_java//java:defs.bzl", "JavaInfo")
+
def _classpath_collector(ctx):
all = []
for d in ctx.attr.deps:
diff --git a/tools/bzl/javadoc.bzl b/tools/bzl/javadoc.bzl
index 5aba90e..131254e 100644
--- a/tools/bzl/javadoc.bzl
+++ b/tools/bzl/javadoc.bzl
@@ -14,6 +14,8 @@
# Javadoc rule.
+load("@rules_java//java:defs.bzl", "JavaInfo", "java_common")
+
def _impl(ctx):
zip_output = ctx.outputs.zip
diff --git a/tools/bzl/pkg_war.bzl b/tools/bzl/pkg_war.bzl
index 52fa1dd..1c3444e 100644
--- a/tools/bzl/pkg_war.bzl
+++ b/tools/bzl/pkg_war.bzl
@@ -14,6 +14,7 @@
# War packaging.
+load("@rules_java//java:defs.bzl", "JavaInfo")
load("//tools:deps.bzl", "AUTO_VALUE_GSON_VERSION")
load("//tools:nongoogle.bzl", "AUTO_FACTORY_VERSION", "AUTO_VALUE_VERSION")