RebaseSorter: leave commit /merge candidate as interesting if referenced
Before this fix, an error used to show up in the UI upon submitting a change or commit that was referred-to by a branch. Such a branch may exist if either directly pushed or created directly in the repository. Add a corresponding test to SubmitByRebaseIfNecessaryIT. Purpose of the test being, to exercise this specific /fixed case with the necessary coverage. Hence testing this by using two changes with the branch referring to the second (tip) change. Having the branch referring to the first (parent) change instead does not trigger that error. Add reusable helper methods to AbstractDaemonTest and AbstractSubmit, to first serve that new test. Bug: Issue 4087 Change-Id: Id01a3cabcd5bd58e562d3d7e7879e7905df6ca19
This commit is contained in:
@@ -32,6 +32,8 @@ import com.google.gerrit.common.data.PermissionRule;
|
||||
import com.google.gerrit.extensions.api.GerritApi;
|
||||
import com.google.gerrit.extensions.api.changes.ReviewInput;
|
||||
import com.google.gerrit.extensions.api.changes.RevisionApi;
|
||||
import com.google.gerrit.extensions.api.projects.BranchApi;
|
||||
import com.google.gerrit.extensions.api.projects.BranchInput;
|
||||
import com.google.gerrit.extensions.api.projects.ProjectInput;
|
||||
import com.google.gerrit.extensions.client.InheritableBoolean;
|
||||
import com.google.gerrit.extensions.client.ListChangesOption;
|
||||
@@ -40,6 +42,7 @@ import com.google.gerrit.extensions.common.ChangeInfo;
|
||||
import com.google.gerrit.extensions.common.EditInfo;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.reviewdb.client.AccountGroup;
|
||||
import com.google.gerrit.reviewdb.client.Branch;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.AnonymousUser;
|
||||
@@ -424,6 +427,16 @@ public abstract class AbstractDaemonTest {
|
||||
return result;
|
||||
}
|
||||
|
||||
protected BranchApi createBranchWithRevision(Branch.NameKey branch,
|
||||
String revision) throws Exception {
|
||||
BranchInput in = new BranchInput();
|
||||
in.revision = revision;
|
||||
return gApi.projects()
|
||||
.name(branch.getParentKey().get())
|
||||
.branch(branch.get())
|
||||
.create(in);
|
||||
}
|
||||
|
||||
private static final List<Character> RANDOM =
|
||||
Chars.asList(new char[]{'a','b','c','d','e','f','g','h'});
|
||||
protected PushOneCommit.Result amendChange(String changeId)
|
||||
|
||||
Reference in New Issue
Block a user