Move ReceiveCommits and related classes to their own package
After naively moving the classes, there were almost no incoming references from the rest of the server packages into the new server.receive package. This means with only a little more work, it was possible to create a new java_library target containing just the srcs in this new package. This is a modest step in the direction of breaking up the giant //gerrit-server:server package, which will improve compile times when making modifications that don't change the interface. Change-Id: I449018a4933a999c688611142dc7ed9c18b4c828
This commit is contained in:
parent
8562864736
commit
798b883b40
@ -10,6 +10,7 @@ PROVIDED = [
|
||||
"//gerrit-lucene:lucene",
|
||||
"//gerrit-pgm:init",
|
||||
"//gerrit-reviewdb:server",
|
||||
"//gerrit-server:receive",
|
||||
"//gerrit-server:server",
|
||||
"//lib:gson",
|
||||
"//lib:jsch",
|
||||
|
@ -27,7 +27,7 @@ import com.google.gerrit.lucene.LuceneIndexModule;
|
||||
import com.google.gerrit.pgm.Daemon;
|
||||
import com.google.gerrit.pgm.Init;
|
||||
import com.google.gerrit.server.config.GerritServerConfig;
|
||||
import com.google.gerrit.server.git.AsyncReceiveCommits;
|
||||
import com.google.gerrit.server.git.receive.AsyncReceiveCommits;
|
||||
import com.google.gerrit.server.ssh.NoSshModule;
|
||||
import com.google.gerrit.server.util.ManualRequestContext;
|
||||
import com.google.gerrit.server.util.OneOffRequestContext;
|
||||
|
@ -28,11 +28,11 @@ import com.google.gerrit.server.RemotePeer;
|
||||
import com.google.gerrit.server.RequestCleanup;
|
||||
import com.google.gerrit.server.config.GerritRequestModule;
|
||||
import com.google.gerrit.server.config.RequestScopedReviewDbProvider;
|
||||
import com.google.gerrit.server.git.AsyncReceiveCommits;
|
||||
import com.google.gerrit.server.git.ReceiveCommits;
|
||||
import com.google.gerrit.server.git.ReceivePackInitializer;
|
||||
import com.google.gerrit.server.git.TransferConfig;
|
||||
import com.google.gerrit.server.git.VisibleRefFilter;
|
||||
import com.google.gerrit.server.git.receive.AsyncReceiveCommits;
|
||||
import com.google.gerrit.server.git.receive.ReceiveCommits;
|
||||
import com.google.gerrit.server.git.validators.UploadValidators;
|
||||
import com.google.gerrit.server.project.NoSuchProjectException;
|
||||
import com.google.gerrit.server.project.ProjectControl;
|
||||
|
@ -20,6 +20,7 @@ java_library(
|
||||
"//gerrit-pgm:util",
|
||||
"//gerrit-reviewdb:server",
|
||||
"//gerrit-server:prolog-common",
|
||||
"//gerrit-server:receive",
|
||||
"//gerrit-server:server",
|
||||
"//gerrit-server:testutil",
|
||||
"//gerrit-sshd:sshd",
|
||||
|
@ -64,7 +64,7 @@ import com.google.gerrit.reviewdb.client.ChangeMessage;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gerrit.server.ChangeMessagesUtil;
|
||||
import com.google.gerrit.server.git.ProjectConfig;
|
||||
import com.google.gerrit.server.git.ReceiveCommits;
|
||||
import com.google.gerrit.server.git.receive.ReceiveCommits;
|
||||
import com.google.gerrit.server.mail.Address;
|
||||
import com.google.gerrit.server.project.Util;
|
||||
import com.google.gerrit.server.query.change.ChangeData;
|
||||
|
@ -39,8 +39,8 @@ import com.google.gerrit.reviewdb.client.RefNames;
|
||||
import com.google.gerrit.server.config.AllUsersName;
|
||||
import com.google.gerrit.server.config.AnonymousCowardName;
|
||||
import com.google.gerrit.server.git.ProjectConfig;
|
||||
import com.google.gerrit.server.git.ReceiveCommitsAdvertiseRefsHook;
|
||||
import com.google.gerrit.server.git.VisibleRefFilter;
|
||||
import com.google.gerrit.server.git.receive.ReceiveCommitsAdvertiseRefsHook;
|
||||
import com.google.gerrit.server.notedb.ChangeNoteUtil;
|
||||
import com.google.gerrit.server.notedb.NoteDbChangeState.PrimaryStorage;
|
||||
import com.google.gerrit.server.project.Util;
|
||||
|
@ -29,8 +29,8 @@ import org.eclipse.jgit.transport.ReceivePack;
|
||||
* Pre-receive hook to check signed pushes.
|
||||
*
|
||||
* <p>If configured, prior to processing any push using {@link
|
||||
* com.google.gerrit.server.git.ReceiveCommits}, requires that any push certificate present must be
|
||||
* valid.
|
||||
* com.google.gerrit.server.git.receive.ReceiveCommits}, requires that any push certificate present
|
||||
* must be valid.
|
||||
*/
|
||||
@Singleton
|
||||
public class SignedPushPreReceiveHook implements PreReceiveHook {
|
||||
|
@ -26,6 +26,7 @@ java_library(
|
||||
"//gerrit-patch-jgit:server",
|
||||
"//gerrit-prettify:server",
|
||||
"//gerrit-reviewdb:server",
|
||||
"//gerrit-server:receive",
|
||||
"//gerrit-server:server",
|
||||
"//gerrit-util-cli:cli",
|
||||
"//gerrit-util-http:http",
|
||||
|
@ -24,11 +24,11 @@ import com.google.gerrit.server.AccessPath;
|
||||
import com.google.gerrit.server.AnonymousUser;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
import com.google.gerrit.server.cache.CacheModule;
|
||||
import com.google.gerrit.server.git.AsyncReceiveCommits;
|
||||
import com.google.gerrit.server.git.GitRepositoryManager;
|
||||
import com.google.gerrit.server.git.ReceiveCommits;
|
||||
import com.google.gerrit.server.git.TransferConfig;
|
||||
import com.google.gerrit.server.git.VisibleRefFilter;
|
||||
import com.google.gerrit.server.git.receive.AsyncReceiveCommits;
|
||||
import com.google.gerrit.server.git.receive.ReceiveCommits;
|
||||
import com.google.gerrit.server.git.validators.UploadValidators;
|
||||
import com.google.gerrit.server.permissions.PermissionBackend;
|
||||
import com.google.gerrit.server.permissions.PermissionBackendException;
|
||||
|
@ -28,7 +28,7 @@ import com.google.gerrit.server.config.AuthConfig;
|
||||
import com.google.gerrit.server.config.GerritOptions;
|
||||
import com.google.gerrit.server.config.GerritRequestModule;
|
||||
import com.google.gerrit.server.config.GitwebCgiConfig;
|
||||
import com.google.gerrit.server.git.AsyncReceiveCommits;
|
||||
import com.google.gerrit.server.git.receive.AsyncReceiveCommits;
|
||||
import com.google.gerrit.server.util.GuiceRequestScopePropagator;
|
||||
import com.google.gerrit.server.util.RequestScopePropagator;
|
||||
import com.google.inject.Inject;
|
||||
|
@ -29,6 +29,8 @@ BASE_JETTY_DEPS = [
|
||||
|
||||
DEPS = BASE_JETTY_DEPS + [
|
||||
"//gerrit-reviewdb:server",
|
||||
"//gerrit-server:module",
|
||||
"//gerrit-server:receive",
|
||||
"//lib:gwtorm",
|
||||
"//lib/log:jsonevent-layout",
|
||||
]
|
||||
|
@ -65,9 +65,9 @@ import com.google.gerrit.server.config.GerritServerConfig;
|
||||
import com.google.gerrit.server.config.RestCacheAdminModule;
|
||||
import com.google.gerrit.server.events.StreamEventsApiListener;
|
||||
import com.google.gerrit.server.git.GarbageCollectionModule;
|
||||
import com.google.gerrit.server.git.ReceiveCommitsExecutorModule;
|
||||
import com.google.gerrit.server.git.SearchingChangeCacheImpl;
|
||||
import com.google.gerrit.server.git.WorkQueue;
|
||||
import com.google.gerrit.server.git.receive.ReceiveCommitsExecutorModule;
|
||||
import com.google.gerrit.server.index.DummyIndexModule;
|
||||
import com.google.gerrit.server.index.IndexModule;
|
||||
import com.google.gerrit.server.index.IndexModule.IndexType;
|
||||
|
@ -53,10 +53,10 @@ import com.google.gerrit.server.config.GerritServerConfig;
|
||||
import com.google.gerrit.server.config.GitReceivePackGroups;
|
||||
import com.google.gerrit.server.config.GitUploadPackGroups;
|
||||
import com.google.gerrit.server.git.MergeUtil;
|
||||
import com.google.gerrit.server.git.ReceiveCommitsExecutorModule;
|
||||
import com.google.gerrit.server.git.SearchingChangeCacheImpl;
|
||||
import com.google.gerrit.server.git.TagCache;
|
||||
import com.google.gerrit.server.git.VisibleRefFilter;
|
||||
import com.google.gerrit.server.git.receive.ReceiveCommitsExecutorModule;
|
||||
import com.google.gerrit.server.group.GroupModule;
|
||||
import com.google.gerrit.server.mail.send.ReplacePatchSetSender;
|
||||
import com.google.gerrit.server.notedb.NoteDbModule;
|
||||
|
@ -5,9 +5,15 @@ CONSTANTS_SRC = [
|
||||
"src/main/java/com/google/gerrit/server/documentation/Constants.java",
|
||||
]
|
||||
|
||||
GERRIT_GLOBAL_MODULE_SRC = [
|
||||
"src/main/java/com/google/gerrit/server/config/GerritGlobalModule.java",
|
||||
]
|
||||
|
||||
RECEIVE_SRCS = glob(["src/main/java/com/google/gerrit/server/git/receive/**/*.java"])
|
||||
|
||||
SRCS = glob(
|
||||
["src/main/java/**/*.java"],
|
||||
exclude = CONSTANTS_SRC,
|
||||
exclude = CONSTANTS_SRC + GERRIT_GLOBAL_MODULE_SRC + RECEIVE_SRCS,
|
||||
)
|
||||
|
||||
RESOURCES = glob(["src/main/resources/**/*"])
|
||||
@ -25,6 +31,12 @@ prolog_cafe_library(
|
||||
deps = [":server"],
|
||||
)
|
||||
|
||||
# Giant kitchen-sink target.
|
||||
#
|
||||
# The only reason this hasn't been split up further is because we have too many
|
||||
# tangled dependencies (and Guice unfortunately makes it quite easy to get into
|
||||
# this state). Which means if you see an opportunity to split something off, you
|
||||
# should seize it.
|
||||
java_library(
|
||||
name = "server",
|
||||
srcs = SRCS,
|
||||
@ -94,7 +106,49 @@ java_library(
|
||||
],
|
||||
)
|
||||
|
||||
# Large modules that import things from all across the server package
|
||||
# hierarchy, so they need lots of dependencies.
|
||||
java_library(
|
||||
name = "module",
|
||||
srcs = GERRIT_GLOBAL_MODULE_SRC,
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":receive",
|
||||
":server",
|
||||
"//gerrit-extension-api:api",
|
||||
"//lib:blame-cache",
|
||||
"//lib:guava",
|
||||
"//lib:soy",
|
||||
"//lib:velocity",
|
||||
"//lib/guice",
|
||||
"//lib/jgit/org.eclipse.jgit:jgit",
|
||||
],
|
||||
)
|
||||
|
||||
java_library(
|
||||
name = "receive",
|
||||
srcs = RECEIVE_SRCS,
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":server",
|
||||
"//gerrit-common:annotations",
|
||||
"//gerrit-common:server",
|
||||
"//gerrit-extension-api:api",
|
||||
"//gerrit-reviewdb:server",
|
||||
"//gerrit-util-cli:cli",
|
||||
"//lib:args4j",
|
||||
"//lib:guava",
|
||||
"//lib:gwtorm",
|
||||
"//lib/auto:auto-value",
|
||||
"//lib/guice",
|
||||
"//lib/guice:guice-assistedinject",
|
||||
"//lib/jgit/org.eclipse.jgit:jgit",
|
||||
"//lib/log:api",
|
||||
],
|
||||
)
|
||||
|
||||
TESTUTIL_DEPS = [
|
||||
":module",
|
||||
":server",
|
||||
"//gerrit-common:annotations",
|
||||
"//gerrit-common:server",
|
||||
|
@ -119,10 +119,10 @@ import com.google.gerrit.server.git.MergeUtil;
|
||||
import com.google.gerrit.server.git.MergedByPushOp;
|
||||
import com.google.gerrit.server.git.NotesBranchUtil;
|
||||
import com.google.gerrit.server.git.ReceivePackInitializer;
|
||||
import com.google.gerrit.server.git.ReplaceOp;
|
||||
import com.google.gerrit.server.git.TagCache;
|
||||
import com.google.gerrit.server.git.TransferConfig;
|
||||
import com.google.gerrit.server.git.VisibleRefFilter;
|
||||
import com.google.gerrit.server.git.receive.ReceiveCommitsModule;
|
||||
import com.google.gerrit.server.git.strategy.SubmitStrategy;
|
||||
import com.google.gerrit.server.git.validators.CommitValidationListener;
|
||||
import com.google.gerrit.server.git.validators.MergeValidationListener;
|
||||
@ -237,6 +237,7 @@ public class GerritGlobalModule extends FactoryModule {
|
||||
install(new GroupModule());
|
||||
install(new NoteDbModule(cfg));
|
||||
install(new PrologModule());
|
||||
install(new ReceiveCommitsModule());
|
||||
install(new SshAddressesModule());
|
||||
install(ThreadLocalRequestContext.module());
|
||||
|
||||
@ -398,7 +399,6 @@ public class GerritGlobalModule extends FactoryModule {
|
||||
factory(MergeValidators.Factory.class);
|
||||
factory(ProjectConfigValidator.Factory.class);
|
||||
factory(NotesBranchUtil.Factory.class);
|
||||
factory(ReplaceOp.Factory.class);
|
||||
factory(MergedByPushOp.Factory.class);
|
||||
factory(GitModules.Factory.class);
|
||||
factory(VersionedAuthorizedKeys.Factory.class);
|
||||
|
@ -25,7 +25,6 @@ public class GitModule extends FactoryModule {
|
||||
factory(RenameGroupOp.Factory.class);
|
||||
factory(MetaDataUpdate.InternalFactory.class);
|
||||
bind(MetaDataUpdate.Server.class);
|
||||
bind(ReceiveConfig.class);
|
||||
DynamicSet.bind(binder(), PostUploadHook.class).to(UploadPackMetricsHook.class);
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Helper for assigning groups to commits during {@link ReceiveCommits}.
|
||||
* Helper for assigning groups to commits during {@code ReceiveCommits}.
|
||||
*
|
||||
* <p>For each commit encountered along a walk between the branch tip and the tip of the push, the
|
||||
* group of a commit is defined as follows:
|
||||
|
@ -173,7 +173,7 @@ public class MergeOpRepoManager implements AutoCloseable {
|
||||
openRepos = new HashMap<>();
|
||||
}
|
||||
|
||||
void setContext(ReviewDb db, Timestamp ts, IdentifiedUser caller, RequestId submissionId) {
|
||||
public void setContext(ReviewDb db, Timestamp ts, IdentifiedUser caller, RequestId submissionId) {
|
||||
this.db = db;
|
||||
this.ts = ts;
|
||||
this.caller = caller;
|
||||
|
@ -12,11 +12,13 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.server.git;
|
||||
package com.google.gerrit.server.git.receive;
|
||||
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.server.config.ConfigUtil;
|
||||
import com.google.gerrit.server.config.GerritServerConfig;
|
||||
import com.google.gerrit.server.git.MultiProgressMonitor;
|
||||
import com.google.gerrit.server.git.ProjectRunnable;
|
||||
import com.google.gerrit.server.project.ProjectControl;
|
||||
import com.google.gerrit.server.util.RequestScopePropagator;
|
||||
import com.google.inject.Inject;
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.server.git;
|
||||
package com.google.gerrit.server.git.receive;
|
||||
|
||||
import com.google.gerrit.server.update.BatchUpdateOp;
|
||||
import com.google.gerrit.server.update.ChangeContext;
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.server.git;
|
||||
package com.google.gerrit.server.git.receive;
|
||||
|
||||
import com.google.gerrit.extensions.registration.DynamicSet;
|
||||
import com.google.inject.Inject;
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.server.git;
|
||||
package com.google.gerrit.server.git.receive;
|
||||
|
||||
import static com.google.common.base.MoreObjects.firstNonNull;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
@ -21,6 +21,7 @@ import static com.google.gerrit.common.FooterConstants.CHANGE_ID;
|
||||
import static com.google.gerrit.reviewdb.client.RefNames.REFS_CHANGES;
|
||||
import static com.google.gerrit.server.change.HashtagsUtil.cleanupHashtag;
|
||||
import static com.google.gerrit.server.git.MultiProgressMonitor.UNKNOWN;
|
||||
import static com.google.gerrit.server.git.validators.CommitValidators.NEW_PATCHSET_PATTERN;
|
||||
import static com.google.gerrit.server.mail.MailUtil.getRecipientsFromFooters;
|
||||
import static java.util.Comparator.comparingInt;
|
||||
import static java.util.stream.Collectors.joining;
|
||||
@ -94,7 +95,22 @@ import com.google.gerrit.server.config.ProjectConfigEntry;
|
||||
import com.google.gerrit.server.edit.ChangeEdit;
|
||||
import com.google.gerrit.server.edit.ChangeEditUtil;
|
||||
import com.google.gerrit.server.events.CommitReceivedEvent;
|
||||
import com.google.gerrit.server.git.BanCommit;
|
||||
import com.google.gerrit.server.git.GroupCollector;
|
||||
import com.google.gerrit.server.git.HackPushNegotiateHook;
|
||||
import com.google.gerrit.server.git.MergeOp;
|
||||
import com.google.gerrit.server.git.MergeOpRepoManager;
|
||||
import com.google.gerrit.server.git.MergedByPushOp;
|
||||
import com.google.gerrit.server.git.MultiProgressMonitor;
|
||||
import com.google.gerrit.server.git.MultiProgressMonitor.Task;
|
||||
import com.google.gerrit.server.git.ProjectConfig;
|
||||
import com.google.gerrit.server.git.ReceivePackInitializer;
|
||||
import com.google.gerrit.server.git.SubmoduleException;
|
||||
import com.google.gerrit.server.git.SubmoduleOp;
|
||||
import com.google.gerrit.server.git.TagCache;
|
||||
import com.google.gerrit.server.git.TransferConfig;
|
||||
import com.google.gerrit.server.git.ValidationError;
|
||||
import com.google.gerrit.server.git.VisibleRefFilter;
|
||||
import com.google.gerrit.server.git.validators.CommitValidationException;
|
||||
import com.google.gerrit.server.git.validators.CommitValidationMessage;
|
||||
import com.google.gerrit.server.git.validators.CommitValidators;
|
||||
@ -153,7 +169,6 @@ import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import org.eclipse.jgit.errors.ConfigInvalidException;
|
||||
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
|
||||
import org.eclipse.jgit.errors.MissingObjectException;
|
||||
@ -190,9 +205,6 @@ public class ReceiveCommits {
|
||||
private static final Logger log = LoggerFactory.getLogger(ReceiveCommits.class);
|
||||
private static final String BYPASS_REVIEW = "bypass-review";
|
||||
|
||||
public static final Pattern NEW_PATCHSET =
|
||||
Pattern.compile("^" + REFS_CHANGES + "(?:[0-9][0-9]/)?([1-9][0-9]*)(?:/new)?$");
|
||||
|
||||
private static final String COMMAND_REJECTION_MESSAGE_FOOTER =
|
||||
"Please read the documentation and contact an administrator\n"
|
||||
+ "if you feel the configuration is incorrect";
|
||||
@ -898,7 +910,7 @@ public class ReceiveCommits {
|
||||
};
|
||||
}
|
||||
|
||||
Matcher m = NEW_PATCHSET.matcher(cmd.getRefName());
|
||||
Matcher m = NEW_PATCHSET_PATTERN.matcher(cmd.getRefName());
|
||||
if (m.matches()) {
|
||||
// The referenced change must exist and must still be open.
|
||||
//
|
||||
@ -2762,7 +2774,7 @@ public class ReceiveCommits {
|
||||
PermissionBackend.ForRef perm = permissions.ref(ctl.getRefName());
|
||||
if (!RefNames.REFS_CONFIG.equals(cmd.getRefName())
|
||||
&& !(MagicBranch.isMagicBranch(cmd.getRefName())
|
||||
|| NEW_PATCHSET.matcher(cmd.getRefName()).matches())
|
||||
|| NEW_PATCHSET_PATTERN.matcher(cmd.getRefName()).matches())
|
||||
&& pushOptions.containsKey(BYPASS_REVIEW)) {
|
||||
try {
|
||||
perm.check(RefPermission.BYPASS_REVIEW);
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.server.git;
|
||||
package com.google.gerrit.server.git.receive;
|
||||
|
||||
import static org.eclipse.jgit.lib.RefDatabase.ALL;
|
||||
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.server.git;
|
||||
package com.google.gerrit.server.git.receive;
|
||||
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
@ -12,12 +12,14 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.server.git;
|
||||
package com.google.gerrit.server.git.receive;
|
||||
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import com.google.gerrit.server.config.GerritServerConfig;
|
||||
import com.google.gerrit.server.git.SendEmailExecutor;
|
||||
import com.google.gerrit.server.git.WorkQueue;
|
||||
import com.google.gerrit.server.update.ChangeUpdateExecutor;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Provides;
|
||||
@ -28,7 +30,12 @@ import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.eclipse.jgit.lib.Config;
|
||||
|
||||
/** Module providing the {@link ReceiveCommitsExecutor}. */
|
||||
/**
|
||||
* Module providing the {@link ReceiveCommitsExecutor}.
|
||||
*
|
||||
* <p>Unlike {@link ReceiveCommitsModule}, this module is intended to be installed only in top-level
|
||||
* injectors like in {@code Daemon}, not in the {@code sysInjector}.
|
||||
*/
|
||||
public class ReceiveCommitsExecutorModule extends AbstractModule {
|
||||
@Override
|
||||
protected void configure() {}
|
@ -0,0 +1,25 @@
|
||||
// Copyright (C) 2017 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.server.git.receive;
|
||||
|
||||
import com.google.gerrit.extensions.config.FactoryModule;
|
||||
|
||||
public class ReceiveCommitsModule extends FactoryModule {
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(ReceiveConfig.class);
|
||||
factory(ReplaceOp.Factory.class);
|
||||
}
|
||||
}
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.server.git;
|
||||
package com.google.gerrit.server.git.receive;
|
||||
|
||||
import static com.google.gerrit.common.data.GlobalCapability.BATCH_CHANGES_LIMIT;
|
||||
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.server.git;
|
||||
package com.google.gerrit.server.git.receive;
|
||||
|
||||
import static com.google.gerrit.common.FooterConstants.CHANGE_ID;
|
||||
import static com.google.gerrit.server.mail.MailUtil.getRecipientsFromFooters;
|
||||
@ -45,7 +45,9 @@ import com.google.gerrit.server.change.ChangeKindCache;
|
||||
import com.google.gerrit.server.change.EmailReviewComments;
|
||||
import com.google.gerrit.server.extensions.events.CommentAdded;
|
||||
import com.google.gerrit.server.extensions.events.RevisionCreated;
|
||||
import com.google.gerrit.server.git.ReceiveCommits.MagicBranchInput;
|
||||
import com.google.gerrit.server.git.MergedByPushOp;
|
||||
import com.google.gerrit.server.git.SendEmailExecutor;
|
||||
import com.google.gerrit.server.git.receive.ReceiveCommits.MagicBranchInput;
|
||||
import com.google.gerrit.server.mail.MailUtil.MailRecipients;
|
||||
import com.google.gerrit.server.mail.send.ReplacePatchSetSender;
|
||||
import com.google.gerrit.server.notedb.ChangeNotes;
|
@ -15,8 +15,8 @@
|
||||
package com.google.gerrit.server.git.validators;
|
||||
|
||||
import static com.google.gerrit.reviewdb.client.Change.CHANGE_ID_PATTERN;
|
||||
import static com.google.gerrit.reviewdb.client.RefNames.REFS_CHANGES;
|
||||
import static com.google.gerrit.reviewdb.client.RefNames.REFS_CONFIG;
|
||||
import static com.google.gerrit.server.git.ReceiveCommits.NEW_PATCHSET;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
import com.google.common.base.CharMatcher;
|
||||
@ -78,6 +78,9 @@ import org.slf4j.LoggerFactory;
|
||||
public class CommitValidators {
|
||||
private static final Logger log = LoggerFactory.getLogger(CommitValidators.class);
|
||||
|
||||
public static final Pattern NEW_PATCHSET_PATTERN =
|
||||
Pattern.compile("^" + REFS_CHANGES + "(?:[0-9][0-9]/)?([1-9][0-9]*)(?:/new)?$");
|
||||
|
||||
@Singleton
|
||||
public static class Factory {
|
||||
private final PersonIdent gerritIdent;
|
||||
@ -266,7 +269,7 @@ public class CommitValidators {
|
||||
|
||||
private static boolean shouldValidateChangeId(CommitReceivedEvent event) {
|
||||
return MagicBranch.isMagicBranch(event.command.getRefName())
|
||||
|| NEW_PATCHSET.matcher(event.command.getRefName()).matches();
|
||||
|| NEW_PATCHSET_PATTERN.matcher(event.command.getRefName()).matches();
|
||||
}
|
||||
|
||||
private CommitValidationMessage getMissingChangeIdErrorMsg(String errMsg, RevCommit c) {
|
||||
|
@ -17,13 +17,11 @@ package com.google.gerrit.server.update;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
import com.google.gerrit.server.git.ReceiveCommits;
|
||||
import com.google.inject.BindingAnnotation;
|
||||
import java.lang.annotation.Retention;
|
||||
|
||||
/**
|
||||
* Marker on the global {@link ListeningExecutorService} used by {@link ReceiveCommits} to create or
|
||||
* replace changes.
|
||||
* Marker on the global {@link ListeningExecutorService} used by asynchronous {@link BatchUpdate}s.
|
||||
*/
|
||||
@Retention(RUNTIME)
|
||||
@BindingAnnotation
|
||||
|
@ -14,6 +14,7 @@ java_library(
|
||||
"//gerrit-lucene:lucene",
|
||||
"//gerrit-patch-jgit:server",
|
||||
"//gerrit-reviewdb:server",
|
||||
"//gerrit-server:receive",
|
||||
"//gerrit-server:server",
|
||||
"//gerrit-util-cli:cli",
|
||||
"//lib:args4j",
|
||||
|
@ -24,8 +24,8 @@ import com.google.gerrit.server.PeerDaemonUser;
|
||||
import com.google.gerrit.server.RemotePeer;
|
||||
import com.google.gerrit.server.config.GerritRequestModule;
|
||||
import com.google.gerrit.server.config.GerritServerConfig;
|
||||
import com.google.gerrit.server.git.AsyncReceiveCommits;
|
||||
import com.google.gerrit.server.git.QueueProvider;
|
||||
import com.google.gerrit.server.git.receive.AsyncReceiveCommits;
|
||||
import com.google.gerrit.server.plugins.ModuleGenerator;
|
||||
import com.google.gerrit.server.plugins.ReloadPluginListener;
|
||||
import com.google.gerrit.server.plugins.StartPluginListener;
|
||||
|
@ -17,9 +17,9 @@ package com.google.gerrit.sshd.commands;
|
||||
import com.google.gerrit.common.data.Capable;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.git.AsyncReceiveCommits;
|
||||
import com.google.gerrit.server.git.ReceiveCommits;
|
||||
import com.google.gerrit.server.git.VisibleRefFilter;
|
||||
import com.google.gerrit.server.git.receive.AsyncReceiveCommits;
|
||||
import com.google.gerrit.server.git.receive.ReceiveCommits;
|
||||
import com.google.gerrit.sshd.AbstractGitCommand;
|
||||
import com.google.gerrit.sshd.CommandMetaData;
|
||||
import com.google.gerrit.sshd.SshSession;
|
||||
|
@ -18,7 +18,9 @@ java_library(
|
||||
"//gerrit-pgm:init-api",
|
||||
"//gerrit-pgm:util",
|
||||
"//gerrit-reviewdb:server",
|
||||
"//gerrit-server:module",
|
||||
"//gerrit-server:prolog-common",
|
||||
"//gerrit-server:receive",
|
||||
"//gerrit-server:server",
|
||||
"//gerrit-sshd:sshd",
|
||||
"//lib:guava",
|
||||
|
@ -49,9 +49,9 @@ import com.google.gerrit.server.config.SitePath;
|
||||
import com.google.gerrit.server.events.StreamEventsApiListener;
|
||||
import com.google.gerrit.server.git.GarbageCollectionModule;
|
||||
import com.google.gerrit.server.git.GitRepositoryManagerModule;
|
||||
import com.google.gerrit.server.git.ReceiveCommitsExecutorModule;
|
||||
import com.google.gerrit.server.git.SearchingChangeCacheImpl;
|
||||
import com.google.gerrit.server.git.WorkQueue;
|
||||
import com.google.gerrit.server.git.receive.ReceiveCommitsExecutorModule;
|
||||
import com.google.gerrit.server.index.IndexModule;
|
||||
import com.google.gerrit.server.index.IndexModule.IndexType;
|
||||
import com.google.gerrit.server.mail.SignedTokenEmailTokenVerifier;
|
||||
|
Loading…
x
Reference in New Issue
Block a user