Merge changes I5c6d9b49,Icf9cb1f3
* changes: AbstractSubmit: reuse own assertMerged to remove duplicated status check Merge branch 'stable-2.12'
This commit is contained in:
commit
ef3ac04874
|
@ -478,6 +478,16 @@ public abstract class AbstractDaemonTest {
|
|||
.create(new BranchInput());
|
||||
}
|
||||
|
||||
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)
|
||||
|
|
|
@ -284,7 +284,7 @@ public abstract class AbstractSubmit extends AbstractDaemonTest {
|
|||
return;
|
||||
}
|
||||
ChangeInfo change = gApi.changes().id(changeId).info();
|
||||
assertThat(change.status).isEqualTo(ChangeStatus.MERGED);
|
||||
assertMerged(change.changeId);
|
||||
if (checkMergeResult) {
|
||||
checkMergeResult(change);
|
||||
}
|
||||
|
@ -338,6 +338,11 @@ public abstract class AbstractSubmit extends AbstractDaemonTest {
|
|||
assertThat(new Account.Id(cr.all.get(0)._accountId)).isEqualTo(admin.getId());
|
||||
}
|
||||
|
||||
protected void assertMerged(String changeId) throws RestApiException {
|
||||
ChangeStatus status = gApi.changes().id(changeId).info().status;
|
||||
assertThat(status).isEqualTo(ChangeStatus.MERGED);
|
||||
}
|
||||
|
||||
protected void assertPersonEquals(PersonIdent expected,
|
||||
PersonIdent actual) {
|
||||
assertThat(actual.getEmailAddress())
|
||||
|
|
|
@ -27,8 +27,10 @@ import com.google.gerrit.extensions.client.InheritableBoolean;
|
|||
import com.google.gerrit.extensions.client.SubmitType;
|
||||
import com.google.gerrit.extensions.common.ChangeInfo;
|
||||
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
||||
import com.google.gerrit.reviewdb.client.Branch;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.server.change.Submit.TestSubmitInput;
|
||||
|
||||
import org.eclipse.jgit.lib.ObjectId;
|
||||
|
@ -84,7 +86,6 @@ public class SubmitByRebaseIfNecessaryIT extends AbstractSubmit {
|
|||
assertPersonEquals(admin.getIdent(), head.getCommitterIdent());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void submitWithRebaseMultipleChanges() throws Exception {
|
||||
RevCommit initialHead = getRemoteHead();
|
||||
|
@ -261,4 +262,19 @@ public class SubmitByRebaseIfNecessaryIT extends AbstractSubmit {
|
|||
approve(id2);
|
||||
submit(id1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void submitChangesAfterBranchOnSecond() throws Exception {
|
||||
PushOneCommit.Result change = createChange();
|
||||
approve(change.getChangeId());
|
||||
|
||||
PushOneCommit.Result change2nd = createChange();
|
||||
approve(change2nd.getChangeId());
|
||||
Project.NameKey project = change2nd.getChange().change().getProject();
|
||||
Branch.NameKey branch = new Branch.NameKey(project, "branch");
|
||||
createBranchWithRevision(branch, change2nd.getCommit().getName());
|
||||
gApi.changes().id(change2nd.getChangeId()).current().submit();
|
||||
assertMerged(change2nd.getChangeId());
|
||||
assertMerged(change.getChangeId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,9 +61,6 @@ public class Reindex extends SiteProgram {
|
|||
@Option(name = "--verbose", usage = "Output debug information for each change")
|
||||
private boolean verbose;
|
||||
|
||||
@Option(name = "--dry-run", usage = "Dry run: don't write anything to index")
|
||||
private boolean dryRun;
|
||||
|
||||
private Injector dbInjector;
|
||||
private Injector sysInjector;
|
||||
private Config globalConfig;
|
||||
|
|
|
@ -51,7 +51,10 @@ public class RebaseSorter {
|
|||
rw.resetRetain(canMergeFlag);
|
||||
rw.markStart(n);
|
||||
for (RevCommit c : accepted) {
|
||||
rw.markUninteresting(c);
|
||||
// n also tip of directly pushed branch => n remains 'interesting' here
|
||||
if (!c.equals(n)) {
|
||||
rw.markUninteresting(c);
|
||||
}
|
||||
}
|
||||
|
||||
CodeReviewCommit c;
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
package com.google.gerrit.server.git;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFutureTask;
|
||||
import com.google.gerrit.extensions.events.LifecycleListener;
|
||||
import com.google.gerrit.lifecycle.LifecycleModule;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
|
@ -384,24 +383,29 @@ public class WorkQueue {
|
|||
@Override
|
||||
public String toString() {
|
||||
//This is a workaround to be able to print a proper name when the task
|
||||
//is wrapped into a ListenableFutureTask.
|
||||
if (runnable instanceof ListenableFutureTask<?>) {
|
||||
String errorMessage;
|
||||
try {
|
||||
for (Field field : ListenableFutureTask.class.getSuperclass()
|
||||
.getDeclaredFields()) {
|
||||
if (field.getType().isAssignableFrom(Callable.class)) {
|
||||
//is wrapped into a TrustedListenableFutureTask.
|
||||
try {
|
||||
if (runnable.getClass().isAssignableFrom(Class.forName(
|
||||
"com.google.common.util.concurrent.TrustedListenableFutureTask"))) {
|
||||
Class<?> trustedFutureInterruptibleTask = Class.forName(
|
||||
"com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask");
|
||||
for (Field field : runnable.getClass().getDeclaredFields()) {
|
||||
if (field.getType().isAssignableFrom(trustedFutureInterruptibleTask)) {
|
||||
field.setAccessible(true);
|
||||
return ((Callable<?>) field.get(runnable)).toString();
|
||||
Object innerObj = field.get(runnable);
|
||||
for (Field innerField : innerObj.getClass().getDeclaredFields()) {
|
||||
if (innerField.getType().isAssignableFrom(Callable.class)) {
|
||||
innerField.setAccessible(true);
|
||||
return ((Callable<?>) innerField.get(innerObj)).toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
errorMessage = "Cannot find wrapped Callable field";
|
||||
} catch (SecurityException | IllegalArgumentException
|
||||
| IllegalAccessException e) {
|
||||
errorMessage = "Cannot call toString on Callable field";
|
||||
}
|
||||
log.debug("Cannot get a proper name for ListenableFutureTask: {}",
|
||||
errorMessage);
|
||||
} catch (ClassNotFoundException | IllegalArgumentException
|
||||
| IllegalAccessException e) {
|
||||
log.debug("Cannot get a proper name for TrustedListenableFutureTask: {}",
|
||||
e.getMessage());
|
||||
}
|
||||
return runnable.toString();
|
||||
}
|
||||
|
|
|
@ -84,7 +84,6 @@ public class PatchListLoader implements Callable<PatchList> {
|
|||
private final PatchListKey key;
|
||||
private final Project.NameKey project;
|
||||
private final long timeoutMillis;
|
||||
private final Object lock;
|
||||
|
||||
@AssistedInject
|
||||
PatchListLoader(GitRepositoryManager mgr,
|
||||
|
@ -101,7 +100,6 @@ public class PatchListLoader implements Callable<PatchList> {
|
|||
autoMerger = am;
|
||||
key = k;
|
||||
project = p;
|
||||
lock = new Object();
|
||||
timeoutMillis =
|
||||
ConfigUtil.getTimeUnit(cfg, "cache", PatchListCacheImpl.FILE_NAME,
|
||||
"timeout", TimeUnit.MILLISECONDS.convert(5, TimeUnit.SECONDS),
|
||||
|
@ -228,7 +226,7 @@ public class PatchListLoader implements Callable<PatchList> {
|
|||
Future<FileHeader> result = diffExecutor.submit(new Callable<FileHeader>() {
|
||||
@Override
|
||||
public FileHeader call() throws IOException {
|
||||
synchronized (lock) {
|
||||
synchronized (diffEntry) {
|
||||
return diffFormatter.toFileHeader(diffEntry);
|
||||
}
|
||||
}
|
||||
|
@ -244,7 +242,7 @@ public class PatchListLoader implements Callable<PatchList> {
|
|||
+ " comparing " + diffEntry.getOldId().name()
|
||||
+ ".." + diffEntry.getNewId().name());
|
||||
result.cancel(true);
|
||||
synchronized (lock) {
|
||||
synchronized (diffEntry) {
|
||||
return toFileHeaderWithoutMyersDiff(diffFormatter, diffEntry);
|
||||
}
|
||||
} catch (ExecutionException e) {
|
||||
|
|
Loading…
Reference in New Issue