Merge branch 'stable-2.15'
* stable-2.15: ChangeQueryBuilder: Remove unused Config parameter from constructor Release 2.15-rc3 Schema_159: Don't set closed changes as WIP/private Change default of migrating draft changes to WIP, not private Remove handling of change.allowDrafts Remove documentation on change.allowDrafts Change-Id: I841e44ca792371d89b5f646df8f69739ec1284be
This commit is contained in:
commit
2f4a121825
@ -1126,13 +1126,6 @@ Allow blame on side by side diff. If set to false, blame cannot be used.
|
||||
+
|
||||
Default is true.
|
||||
|
||||
[[change.allowDrafts]]change.allowDrafts::
|
||||
+
|
||||
Allow drafts workflow. If set to false, drafts cannot be created,
|
||||
deleted or published.
|
||||
+
|
||||
Default is true.
|
||||
|
||||
[[change.api.allowedIdentifier]]change.api.allowedIdentifier::
|
||||
+
|
||||
Change identifier(s) that are allowed on the API. See
|
||||
|
@ -60,8 +60,6 @@ public class ServerInfo extends JavaScriptObject {
|
||||
protected ServerInfo() {}
|
||||
|
||||
public static class ChangeConfigInfo extends JavaScriptObject {
|
||||
public final native boolean allowDrafts() /*-{ return this.allow_drafts || false; }-*/;
|
||||
|
||||
public final native boolean allowBlame() /*-{ return this.allow_blame || false; }-*/;
|
||||
|
||||
public final native int largeChange() /*-{ return this.large_change || 0; }-*/;
|
||||
|
@ -17,7 +17,6 @@ package com.google.gerrit.extensions.common;
|
||||
public class ChangeConfigInfo {
|
||||
public Boolean allowBlame;
|
||||
public Boolean showAssigneeInChangesTable;
|
||||
public Boolean allowDrafts;
|
||||
public Boolean disablePrivateChanges;
|
||||
public int largeChange;
|
||||
public String replyLabel;
|
||||
|
@ -58,7 +58,6 @@ import com.google.gerrit.server.account.VersionedAccountQueries;
|
||||
import com.google.gerrit.server.change.ChangeTriplet;
|
||||
import com.google.gerrit.server.config.AllProjectsName;
|
||||
import com.google.gerrit.server.config.AllUsersName;
|
||||
import com.google.gerrit.server.config.GerritServerConfig;
|
||||
import com.google.gerrit.server.git.GitRepositoryManager;
|
||||
import com.google.gerrit.server.git.strategy.SubmitDryRun;
|
||||
import com.google.gerrit.server.index.change.ChangeField;
|
||||
@ -92,7 +91,6 @@ import java.util.function.Function;
|
||||
import java.util.regex.Pattern;
|
||||
import org.eclipse.jgit.errors.ConfigInvalidException;
|
||||
import org.eclipse.jgit.errors.RepositoryNotFoundException;
|
||||
import org.eclipse.jgit.lib.Config;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
|
||||
/** Parses a query string meant to be applied to change objects. */
|
||||
@ -215,7 +213,6 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData> {
|
||||
final Provider<ReviewDb> db;
|
||||
final StarredChangesUtil starredChangesUtil;
|
||||
final SubmitDryRun submitDryRun;
|
||||
final boolean allowsDrafts;
|
||||
final GroupMembers groupMembers;
|
||||
|
||||
private final Provider<CurrentUser> self;
|
||||
@ -248,7 +245,6 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData> {
|
||||
IndexConfig indexConfig,
|
||||
StarredChangesUtil starredChangesUtil,
|
||||
AccountCache accountCache,
|
||||
@GerritServerConfig Config cfg,
|
||||
NotesMigration notesMigration,
|
||||
GroupMembers groupMembers) {
|
||||
this(
|
||||
@ -277,7 +273,6 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData> {
|
||||
indexConfig,
|
||||
starredChangesUtil,
|
||||
accountCache,
|
||||
cfg == null ? true : cfg.getBoolean("change", "allowDrafts", true),
|
||||
notesMigration,
|
||||
groupMembers);
|
||||
}
|
||||
@ -308,7 +303,6 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData> {
|
||||
IndexConfig indexConfig,
|
||||
StarredChangesUtil starredChangesUtil,
|
||||
AccountCache accountCache,
|
||||
boolean allowsDrafts,
|
||||
NotesMigration notesMigration,
|
||||
GroupMembers groupMembers) {
|
||||
this.db = db;
|
||||
@ -335,7 +329,6 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData> {
|
||||
this.indexConfig = indexConfig;
|
||||
this.starredChangesUtil = starredChangesUtil;
|
||||
this.accountCache = accountCache;
|
||||
this.allowsDrafts = allowsDrafts;
|
||||
this.hasOperands = hasOperands;
|
||||
this.notesMigration = notesMigration;
|
||||
this.groupMembers = groupMembers;
|
||||
@ -368,7 +361,6 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData> {
|
||||
indexConfig,
|
||||
starredChangesUtil,
|
||||
accountCache,
|
||||
allowsDrafts,
|
||||
notesMigration,
|
||||
groupMembers);
|
||||
}
|
||||
|
@ -38,15 +38,10 @@ import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import org.eclipse.jgit.lib.Config;
|
||||
import org.eclipse.jgit.lib.ObjectId;
|
||||
import org.eclipse.jgit.revwalk.RevWalk;
|
||||
|
||||
class DeleteChangeOp implements BatchUpdateOp {
|
||||
static boolean allowDrafts(Config cfg) {
|
||||
return cfg.getBoolean("change", "allowDrafts", true);
|
||||
}
|
||||
|
||||
private final PatchSetUtil psUtil;
|
||||
private final StarredChangesUtil starredChangesUtil;
|
||||
private final DynamicItem<AccountPatchReviewStore> accountPatchReviewStore;
|
||||
|
@ -231,7 +231,6 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
|
||||
private ChangeConfigInfo getChangeInfo(Config cfg) {
|
||||
ChangeConfigInfo info = new ChangeConfigInfo();
|
||||
info.allowBlame = toBoolean(cfg.getBoolean("change", "allowBlame", true));
|
||||
info.allowDrafts = toBoolean(cfg.getBoolean("change", "allowDrafts", true));
|
||||
boolean hasAssigneeInIndex =
|
||||
indexes.getSearchIndex().getSchema().hasField(ChangeField.ASSIGNEE);
|
||||
info.showAssigneeInChangesTable =
|
||||
|
@ -35,26 +35,32 @@ public class Schema_159 extends SchemaVersion {
|
||||
|
||||
@Override
|
||||
protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException {
|
||||
DraftWorkflowMigrationStrategy strategy = DraftWorkflowMigrationStrategy.PRIVATE;
|
||||
if (ui.yesno(
|
||||
false, "Migrate draft changes to work-in-progress changes (default is private)?")) {
|
||||
strategy = DraftWorkflowMigrationStrategy.WORK_IN_PROGRESS;
|
||||
DraftWorkflowMigrationStrategy strategy = DraftWorkflowMigrationStrategy.WORK_IN_PROGRESS;
|
||||
if (ui.yesno(false, "Migrate draft changes to private changes (default is work-in-progress)")) {
|
||||
strategy = DraftWorkflowMigrationStrategy.PRIVATE;
|
||||
}
|
||||
ui.message(
|
||||
String.format("Replace draft changes with %s changes ...", strategy.name().toLowerCase()));
|
||||
try (StatementExecutor e = newExecutor(db)) {
|
||||
String column =
|
||||
strategy == DraftWorkflowMigrationStrategy.PRIVATE ? "is_private" : "work_in_progress";
|
||||
// Mark changes private/wip if changes have status draft or
|
||||
// if they have any draft patch sets.
|
||||
// Mark changes private/WIP and NEW if either:
|
||||
// * they have status DRAFT
|
||||
// * they have status NEW and have any draft patch sets
|
||||
e.execute(
|
||||
String.format(
|
||||
"UPDATE changes SET %s = 'Y', created_on = created_on WHERE status = 'd' OR "
|
||||
+ "EXISTS (SELECT * FROM patch_sets WHERE "
|
||||
+ "patch_sets.change_id = changes.change_id AND patch_sets.draft = 'Y')",
|
||||
"UPDATE changes "
|
||||
+ "SET %s = 'Y', "
|
||||
+ " status = 'n', "
|
||||
+ " created_on = created_on "
|
||||
+ "WHERE status = 'd' "
|
||||
+ " OR (status = 'n' "
|
||||
+ " AND EXISTS "
|
||||
+ " (SELECT * "
|
||||
+ " FROM patch_sets "
|
||||
+ " WHERE patch_sets.change_id = changes.change_id "
|
||||
+ " AND patch_sets.draft = 'Y')) ",
|
||||
column));
|
||||
// Change change status from draft to new.
|
||||
e.execute("UPDATE changes SET status = 'n', created_on = created_on WHERE status = 'd'");
|
||||
}
|
||||
ui.message("done");
|
||||
}
|
||||
|
@ -56,7 +56,6 @@ public class ServerInfoIT extends AbstractDaemonTest {
|
||||
@GerritConfig(name = "auth.httpPasswordUrl", value = "https://example.com/password")
|
||||
|
||||
// change
|
||||
@GerritConfig(name = "change.allowDrafts", value = "false")
|
||||
@GerritConfig(name = "change.largeChange", value = "300")
|
||||
@GerritConfig(name = "change.replyTooltip", value = "Publish votes and draft comments")
|
||||
@GerritConfig(name = "change.replyLabel", value = "Vote")
|
||||
@ -101,7 +100,6 @@ public class ServerInfoIT extends AbstractDaemonTest {
|
||||
assertThat(i.auth.httpPasswordUrl).isNull();
|
||||
|
||||
// change
|
||||
assertThat(i.change.allowDrafts).isNull();
|
||||
assertThat(i.change.largeChange).isEqualTo(300);
|
||||
assertThat(i.change.replyTooltip).startsWith("Publish votes and draft comments");
|
||||
assertThat(i.change.replyLabel).isEqualTo("Vote\u2026");
|
||||
@ -175,7 +173,6 @@ public class ServerInfoIT extends AbstractDaemonTest {
|
||||
assertThat(i.auth.httpPasswordUrl).isNull();
|
||||
|
||||
// change
|
||||
assertThat(i.change.allowDrafts).isTrue();
|
||||
assertThat(i.change.largeChange).isEqualTo(500);
|
||||
assertThat(i.change.replyTooltip).startsWith("Reply and score");
|
||||
assertThat(i.change.replyLabel).isEqualTo("Reply\u2026");
|
||||
|
@ -27,7 +27,7 @@ public class FakeQueryBuilder extends ChangeQueryBuilder {
|
||||
new FakeQueryBuilder.Definition<>(FakeQueryBuilder.class),
|
||||
new ChangeQueryBuilder.Arguments(
|
||||
null, null, null, null, null, null, null, null, null, null, null, null, null, null,
|
||||
null, null, null, null, null, indexes, null, null, null, null, null, null, null, null));
|
||||
null, null, null, null, null, indexes, null, null, null, null, null, null, null));
|
||||
}
|
||||
|
||||
@Operator
|
||||
|
Loading…
x
Reference in New Issue
Block a user