Fix compilation against latest master branch of Gerrit - InheritableBoolean and SubmitType are moved to a different package. - Database query is replaced with InternalChangeQuery. Also remove some unnecessary `final` modifiers. Change-Id: Iede36fa4246fda372f5e2ba31322f9f03c919606
diff --git a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/CreateProjectStep.java b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/CreateProjectStep.java index da5cb29..c409da7 100644 --- a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/CreateProjectStep.java +++ b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/CreateProjectStep.java
@@ -18,8 +18,8 @@ import com.google.gerrit.common.data.GroupReference; import com.google.gerrit.common.data.Permission; import com.google.gerrit.common.data.PermissionRule; -import com.google.gerrit.extensions.common.InheritableBoolean; -import com.google.gerrit.extensions.common.SubmitType; +import com.google.gerrit.extensions.client.InheritableBoolean; +import com.google.gerrit.extensions.client.SubmitType; import com.google.gerrit.reviewdb.client.AccountGroup; import com.google.gerrit.reviewdb.client.Project; import com.google.gerrit.reviewdb.client.Project.NameKey;
diff --git a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/PullRequestCreateChange.java b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/PullRequestCreateChange.java index b850a3f..fcd3db4 100644 --- a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/PullRequestCreateChange.java +++ b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/PullRequestCreateChange.java
@@ -41,10 +41,13 @@ import com.google.gerrit.server.project.NoSuchProjectException; import com.google.gerrit.server.project.ProjectControl; import com.google.gerrit.server.project.RefControl; +import com.google.gerrit.server.query.change.ChangeData; +import com.google.gerrit.server.query.change.InternalChangeQuery; import com.google.gerrit.server.ssh.NoSshInfo; import com.google.gwtorm.server.OrmException; import com.google.gwtorm.server.ResultSet; import com.google.inject.Inject; +import com.google.inject.Provider; import org.eclipse.jgit.errors.IncorrectObjectTypeException; import org.eclipse.jgit.errors.MissingObjectException; @@ -75,21 +78,23 @@ private final PatchSetInserter.Factory patchSetInserterFactory; private final ProjectControl.Factory projectControlFactory; private final GenericFactory userFactory; - + private final Provider<InternalChangeQuery> queryProvider; @Inject - PullRequestCreateChange(final IdentifiedUser currentUser, - final CommitValidators.Factory commitValidatorsFactory, - final ChangeInserter.Factory changeInserterFactory, - final PatchSetInserter.Factory patchSetInserterFactory, - final ProjectControl.Factory projectControlFactory, - final IdentifiedUser.GenericFactory userFactory) { + PullRequestCreateChange(IdentifiedUser currentUser, + CommitValidators.Factory commitValidatorsFactory, + ChangeInserter.Factory changeInserterFactory, + PatchSetInserter.Factory patchSetInserterFactory, + ProjectControl.Factory projectControlFactory, + IdentifiedUser.GenericFactory userFactory, + Provider<InternalChangeQuery> queryProvider) { this.currentUser = currentUser; this.commitValidatorsFactory = commitValidatorsFactory; this.changeInserterFactory = changeInserterFactory; this.patchSetInserterFactory = patchSetInserterFactory; this.projectControlFactory = projectControlFactory; this.userFactory = userFactory; + this.queryProvider = queryProvider; } public Change.Id addCommitToChange(final ReviewDb db, final Project project, @@ -144,11 +149,10 @@ changeKey = new Change.Key("I" + computedChangeId.name()); } - List<Change> destChanges = - db.changes() - .byBranchKey( - new Branch.NameKey(project.getNameKey(), destRef.getName()), - changeKey).toList(); + List<ChangeData> destChanges = + queryProvider.get().byBranchKey( + new Branch.NameKey(project.getNameKey(), destRef.getName()), + changeKey); if (destChanges.size() > 1) { throw new InvalidChangeOperationException( @@ -159,7 +163,7 @@ } else if (destChanges.size() == 1) { // The change key exists on the destination branch: adding a new // patch-set - Change destChange = destChanges.get(0); + Change destChange = destChanges.get(0).change(); ChangeControl changeControl = projectControlFactory.controlFor(project.getNameKey()).controlFor(