Move patch script class to the server tree.
The PatchScriptFactory and PatchScriptBuilder were previously in the
httpd tree. Move them to the server tree so the implementation of the
revision diff REST API can share the logic. Also, update
PatchScriptFactory to implement Callable instead of Handler, so
there is not a circular dependency.
Prior-Id: Ic20fbf81a2da5ad5e2fd5c3542e6caa47df33cea
(cherry picked from commit 2c29e73e6b
)
Change-Id: I4a24fa75a3f83ab8ec1129fe8fef06cd64e730a3
This commit is contained in:

committed by
Shawn Pearce

parent
2f2466a05a
commit
010daed12d
@@ -20,6 +20,7 @@ import com.google.gerrit.common.data.PatchScript;
|
||||
import com.google.gerrit.common.data.ReviewResult;
|
||||
import com.google.gerrit.common.errors.NoSuchEntityException;
|
||||
import com.google.gerrit.httpd.rpc.BaseServiceImplementation;
|
||||
import com.google.gerrit.httpd.rpc.Handler;
|
||||
import com.google.gerrit.httpd.rpc.changedetail.ChangeDetailFactory;
|
||||
import com.google.gerrit.reviewdb.client.AccountDiffPreference;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
@@ -29,6 +30,7 @@ import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
import com.google.gerrit.server.changedetail.DeleteDraftPatchSet;
|
||||
import com.google.gerrit.server.patch.PatchScriptFactory;
|
||||
import com.google.gerrit.server.patch.PatchSetInfoNotAvailableException;
|
||||
import com.google.gerrit.server.project.NoSuchChangeException;
|
||||
import com.google.gerrit.server.project.NoSuchProjectException;
|
||||
@@ -72,7 +74,8 @@ class PatchDetailServiceImpl extends BaseServiceImplementation implements
|
||||
callback.onFailure(new NoSuchEntityException());
|
||||
return;
|
||||
}
|
||||
patchScriptFactoryFactory.create(patchKey, psa, psb, dp).to(callback);
|
||||
Handler.wrap(patchScriptFactoryFactory.create(patchKey, psa, psb, dp))
|
||||
.to(callback);
|
||||
}
|
||||
|
||||
public void saveDraft(final PatchLineComment comment,
|
||||
|
@@ -28,11 +28,9 @@ public class PatchModule extends RpcServletModule {
|
||||
install(new FactoryModule() {
|
||||
@Override
|
||||
protected void configure() {
|
||||
factory(PatchScriptFactory.Factory.class);
|
||||
factory(SaveDraft.Factory.class);
|
||||
}
|
||||
});
|
||||
bind(PatchScriptBuilder.class);
|
||||
rpc(PatchDetailServiceImpl.class);
|
||||
}
|
||||
}
|
||||
|
@@ -92,6 +92,7 @@ import com.google.gerrit.server.mail.RebasedPatchSetSender;
|
||||
import com.google.gerrit.server.mail.ReplacePatchSetSender;
|
||||
import com.google.gerrit.server.mail.VelocityRuntimeProvider;
|
||||
import com.google.gerrit.server.patch.PatchListCacheImpl;
|
||||
import com.google.gerrit.server.patch.PatchScriptFactory;
|
||||
import com.google.gerrit.server.patch.PatchSetInfoFactory;
|
||||
import com.google.gerrit.server.project.AccessControlModule;
|
||||
import com.google.gerrit.server.project.ChangeControl;
|
||||
@@ -186,6 +187,7 @@ public class GerritGlobalModule extends FactoryModule {
|
||||
factory(MergedSender.Factory.class);
|
||||
factory(MergeFailSender.Factory.class);
|
||||
factory(MergeUtil.Factory.class);
|
||||
factory(PatchScriptFactory.Factory.class);
|
||||
factory(PerformCreateGroup.Factory.class);
|
||||
factory(PerformRenameGroup.Factory.class);
|
||||
factory(PluginUser.Factory.class);
|
||||
|
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.httpd.rpc.patch;
|
||||
package com.google.gerrit.server.patch;
|
||||
|
||||
import com.google.gerrit.common.data.CommentDetail;
|
||||
import com.google.gerrit.common.data.PatchScript;
|
||||
@@ -26,11 +26,6 @@ import com.google.gerrit.reviewdb.client.PatchLineComment;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.reviewdb.client.AccountDiffPreference.Whitespace;
|
||||
import com.google.gerrit.server.FileTypeRegistry;
|
||||
import com.google.gerrit.server.patch.IntraLineDiff;
|
||||
import com.google.gerrit.server.patch.IntraLineDiffKey;
|
||||
import com.google.gerrit.server.patch.PatchListCache;
|
||||
import com.google.gerrit.server.patch.PatchListEntry;
|
||||
import com.google.gerrit.server.patch.Text;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import eu.medsea.mimeutil.MimeType;
|
@@ -12,11 +12,10 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.httpd.rpc.patch;
|
||||
package com.google.gerrit.server.patch;
|
||||
|
||||
import com.google.gerrit.common.data.CommentDetail;
|
||||
import com.google.gerrit.common.data.PatchScript;
|
||||
import com.google.gerrit.httpd.rpc.Handler;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.AccountDiffPreference;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
@@ -32,11 +31,6 @@ import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.account.AccountInfoCacheFactory;
|
||||
import com.google.gerrit.server.git.GitRepositoryManager;
|
||||
import com.google.gerrit.server.git.LargeObjectException;
|
||||
import com.google.gerrit.server.patch.PatchList;
|
||||
import com.google.gerrit.server.patch.PatchListCache;
|
||||
import com.google.gerrit.server.patch.PatchListEntry;
|
||||
import com.google.gerrit.server.patch.PatchListKey;
|
||||
import com.google.gerrit.server.patch.PatchListNotAvailableException;
|
||||
import com.google.gerrit.server.project.ChangeControl;
|
||||
import com.google.gerrit.server.project.NoSuchChangeException;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
@@ -55,12 +49,13 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
class PatchScriptFactory extends Handler<PatchScript> {
|
||||
interface Factory {
|
||||
public class PatchScriptFactory implements Callable<PatchScript> {
|
||||
public interface Factory {
|
||||
PatchScriptFactory create(Patch.Key patchKey,
|
||||
@Assisted("patchSetA") PatchSet.Id patchSetA,
|
||||
@Assisted("patchSetB") PatchSet.Id patchSetB,
|
Reference in New Issue
Block a user