Rewrite RebaseChange as a BatchUpdate.Op
This operation does the actual rebase before delegating to a PatchSetInserter. The actual PatchSetInserter object can't be created until after we create the rebased commit, which happens in RebaseChangeOp's updateRepo method. Thus the PatchSetInserter cannot be added to the enclosing BatchUpdate by the caller, and instead we hide that instance entirely in RebaseChange, passing through the subset of setters that is needed. We need to leave a non-BatchUpdate-related RebaseUtil class that contains canRebase, which is still used in several places. Refactor this slightly to avoid double-opening the repository in some cases. Change-Id: I586a85fe9e6f878fe6a7ba1ab4d641b98b1649ab
This commit is contained in:
@@ -36,6 +36,7 @@ import com.google.gerrit.server.cache.h2.DefaultCacheFactory;
|
||||
import com.google.gerrit.server.change.ChangeKindCacheImpl;
|
||||
import com.google.gerrit.server.change.MergeabilityCacheImpl;
|
||||
import com.google.gerrit.server.change.PatchSetInserter;
|
||||
import com.google.gerrit.server.change.RebaseChangeOp;
|
||||
import com.google.gerrit.server.config.CanonicalWebUrl;
|
||||
import com.google.gerrit.server.config.CanonicalWebUrlProvider;
|
||||
import com.google.gerrit.server.config.DisableReverseDnsLookup;
|
||||
@@ -110,6 +111,7 @@ public class BatchProgramModule extends FactoryModule {
|
||||
factory(BatchUpdate.Factory.class);
|
||||
factory(MergeUtil.Factory.class);
|
||||
factory(PatchSetInserter.Factory.class);
|
||||
factory(RebaseChangeOp.Factory.class);
|
||||
|
||||
bind(new TypeLiteral<Set<AccountGroup.UUID>>() {})
|
||||
.annotatedWith(GitUploadPackGroups.class)
|
||||
|
||||
Reference in New Issue
Block a user