BatchUpdate: Add a combined operation spanning all phases
A common pattern thus far has been to communicate between ChangeOps and subsequent Callables using AtomicReferences in the caller. This works, but using so many AtomicReferences smells kind of wrong, particularly since the caller-provided portions of BatchUpdate are single-threaded. Instead, create a single class Op, which may have steps for each of the several phases, including a new repo-updating phase. Each of these steps is passed in a Context object, which includes a phase-specific view of the BatchUpdate. This encapsulation prevents operations from doing unsupported things like adding new operations in the middle of the execute process. Ops can now communicate between different phases or with the caller using instance variables. Change-Id: Id97dbb772d2e3051d6a74bb8e819d691843a45e1
This commit is contained in:
@@ -253,9 +253,10 @@ public abstract class AbstractSubmit extends AbstractDaemonTest {
|
||||
assertThat(c.revisions.get(expectedId.name())._number).isEqualTo(expectedNum);
|
||||
try (Repository repo =
|
||||
repoManager.openRepository(new Project.NameKey(c.project))) {
|
||||
Ref ref = repo.getRef(
|
||||
new PatchSet.Id(new Change.Id(c._number), expectedNum).toRefName());
|
||||
assertThat(ref).isNotNull();
|
||||
String refName = new PatchSet.Id(new Change.Id(c._number), expectedNum)
|
||||
.toRefName();
|
||||
Ref ref = repo.getRef(refName);
|
||||
assertThat(ref).named(refName).isNotNull();
|
||||
assertThat(ref.getObjectId()).isEqualTo(expectedId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user