Merge "Move patch script class to the server tree."

This commit is contained in:
Shawn Pearce
2013-05-17 15:58:04 +00:00
committed by Gerrit Code Review
5 changed files with 11 additions and 18 deletions

View File

@@ -20,6 +20,7 @@ import com.google.gerrit.common.data.PatchScript;
import com.google.gerrit.common.data.ReviewResult; import com.google.gerrit.common.data.ReviewResult;
import com.google.gerrit.common.errors.NoSuchEntityException; import com.google.gerrit.common.errors.NoSuchEntityException;
import com.google.gerrit.httpd.rpc.BaseServiceImplementation; 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.httpd.rpc.changedetail.ChangeDetailFactory;
import com.google.gerrit.reviewdb.client.AccountDiffPreference; import com.google.gerrit.reviewdb.client.AccountDiffPreference;
import com.google.gerrit.reviewdb.client.Change; 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.reviewdb.server.ReviewDb;
import com.google.gerrit.server.CurrentUser; import com.google.gerrit.server.CurrentUser;
import com.google.gerrit.server.changedetail.DeleteDraftPatchSet; 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.patch.PatchSetInfoNotAvailableException;
import com.google.gerrit.server.project.NoSuchChangeException; import com.google.gerrit.server.project.NoSuchChangeException;
import com.google.gerrit.server.project.NoSuchProjectException; import com.google.gerrit.server.project.NoSuchProjectException;
@@ -72,7 +74,8 @@ class PatchDetailServiceImpl extends BaseServiceImplementation implements
callback.onFailure(new NoSuchEntityException()); callback.onFailure(new NoSuchEntityException());
return; 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, public void saveDraft(final PatchLineComment comment,

View File

@@ -28,11 +28,9 @@ public class PatchModule extends RpcServletModule {
install(new FactoryModule() { install(new FactoryModule() {
@Override @Override
protected void configure() { protected void configure() {
factory(PatchScriptFactory.Factory.class);
factory(SaveDraft.Factory.class); factory(SaveDraft.Factory.class);
} }
}); });
bind(PatchScriptBuilder.class);
rpc(PatchDetailServiceImpl.class); rpc(PatchDetailServiceImpl.class);
} }
} }

View File

@@ -92,6 +92,7 @@ import com.google.gerrit.server.mail.RebasedPatchSetSender;
import com.google.gerrit.server.mail.ReplacePatchSetSender; import com.google.gerrit.server.mail.ReplacePatchSetSender;
import com.google.gerrit.server.mail.VelocityRuntimeProvider; import com.google.gerrit.server.mail.VelocityRuntimeProvider;
import com.google.gerrit.server.patch.PatchListCacheImpl; 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.patch.PatchSetInfoFactory;
import com.google.gerrit.server.project.AccessControlModule; import com.google.gerrit.server.project.AccessControlModule;
import com.google.gerrit.server.project.ChangeControl; import com.google.gerrit.server.project.ChangeControl;
@@ -186,6 +187,7 @@ public class GerritGlobalModule extends FactoryModule {
factory(MergedSender.Factory.class); factory(MergedSender.Factory.class);
factory(MergeFailSender.Factory.class); factory(MergeFailSender.Factory.class);
factory(MergeUtil.Factory.class); factory(MergeUtil.Factory.class);
factory(PatchScriptFactory.Factory.class);
factory(PerformCreateGroup.Factory.class); factory(PerformCreateGroup.Factory.class);
factory(PerformRenameGroup.Factory.class); factory(PerformRenameGroup.Factory.class);
factory(PluginUser.Factory.class); factory(PluginUser.Factory.class);

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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.CommentDetail;
import com.google.gerrit.common.data.PatchScript; 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.Project;
import com.google.gerrit.reviewdb.client.AccountDiffPreference.Whitespace; import com.google.gerrit.reviewdb.client.AccountDiffPreference.Whitespace;
import com.google.gerrit.server.FileTypeRegistry; 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 com.google.inject.Inject;
import eu.medsea.mimeutil.MimeType; import eu.medsea.mimeutil.MimeType;

View File

@@ -12,11 +12,10 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // 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.CommentDetail;
import com.google.gerrit.common.data.PatchScript; 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.Account;
import com.google.gerrit.reviewdb.client.AccountDiffPreference; import com.google.gerrit.reviewdb.client.AccountDiffPreference;
import com.google.gerrit.reviewdb.client.Change; 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.account.AccountInfoCacheFactory;
import com.google.gerrit.server.git.GitRepositoryManager; import com.google.gerrit.server.git.GitRepositoryManager;
import com.google.gerrit.server.git.LargeObjectException; 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.ChangeControl;
import com.google.gerrit.server.project.NoSuchChangeException; import com.google.gerrit.server.project.NoSuchChangeException;
import com.google.gwtorm.server.OrmException; import com.google.gwtorm.server.OrmException;
@@ -55,12 +49,13 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.Callable;
import javax.annotation.Nullable; import javax.annotation.Nullable;
class PatchScriptFactory extends Handler<PatchScript> { public class PatchScriptFactory implements Callable<PatchScript> {
interface Factory { public interface Factory {
PatchScriptFactory create(Patch.Key patchKey, PatchScriptFactory create(Patch.Key patchKey,
@Assisted("patchSetA") PatchSet.Id patchSetA, @Assisted("patchSetA") PatchSet.Id patchSetA,
@Assisted("patchSetB") PatchSet.Id patchSetB, @Assisted("patchSetB") PatchSet.Id patchSetB,