summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java3
-rw-r--r--src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java16
2 files changed, 13 insertions, 6 deletions
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java b/src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java
index 241ca49..c4fcaf3 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java
@@ -397,7 +397,8 @@ class PushOne implements ProjectRunnable, CanceledWhileRunning {
if (pool.isCreateMissingRepos()) {
try {
Ref head = git.exactRef(Constants.HEAD);
- if (replicationQueue.createProject(projectName, head != null ? getName(head) : null)) {
+ if (replicationQueue.createProject(
+ config.getName(), projectName, head != null ? getName(head) : null)) {
repLog.warn("Missing repository created; retry replication to {}", uri);
pool.reschedule(this, Destination.RetryReason.REPOSITORY_MISSING);
} else {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java
index d818742..f73530d 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java
@@ -18,6 +18,7 @@ import static com.googlesource.gerrit.plugins.replication.AdminApiFactory.isGerr
import static com.googlesource.gerrit.plugins.replication.AdminApiFactory.isSSH;
import com.google.common.base.Strings;
+import com.google.gerrit.common.Nullable;
import com.google.gerrit.extensions.events.GitReferenceUpdatedListener;
import com.google.gerrit.extensions.events.HeadUpdatedListener;
import com.google.gerrit.extensions.events.LifecycleListener;
@@ -159,7 +160,7 @@ public class ReplicationQueue
@Override
public void onProjectDeleted(ProjectDeletedListener.Event event) {
Project.NameKey projectName = new Project.NameKey(event.getProjectName());
- for (URIish uri : getURIs(projectName, FilterType.PROJECT_DELETION)) {
+ for (URIish uri : getURIs(null, projectName, FilterType.PROJECT_DELETION)) {
deleteProject(uri, projectName);
}
}
@@ -167,12 +168,13 @@ public class ReplicationQueue
@Override
public void onHeadUpdated(HeadUpdatedListener.Event event) {
Project.NameKey project = new Project.NameKey(event.getProjectName());
- for (URIish uri : getURIs(project, FilterType.ALL)) {
+ for (URIish uri : getURIs(null, project, FilterType.ALL)) {
updateHead(uri, project, event.getNewHeadName());
}
}
- private Set<URIish> getURIs(Project.NameKey projectName, FilterType filterType) {
+ private Set<URIish> getURIs(
+ @Nullable String remoteName, Project.NameKey projectName, FilterType filterType) {
if (config.getDestinations(filterType).isEmpty()) {
return Collections.emptySet();
}
@@ -187,6 +189,10 @@ public class ReplicationQueue
continue;
}
+ if (remoteName != null && !config.getRemoteConfigName().equals(remoteName)) {
+ continue;
+ }
+
boolean adminURLUsed = false;
for (String url : config.getAdminUrls()) {
@@ -229,9 +235,9 @@ public class ReplicationQueue
return uris;
}
- public boolean createProject(Project.NameKey project, String head) {
+ public boolean createProject(String remoteName, Project.NameKey project, String head) {
boolean success = true;
- for (URIish uri : getURIs(project, FilterType.PROJECT_CREATION)) {
+ for (URIish uri : getURIs(remoteName, project, FilterType.PROJECT_CREATION)) {
success &= createProject(uri, project, head);
}
return success;