diff options
Diffstat (limited to 'src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java')
-rw-r--r-- | src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java | 16 |
1 files changed, 11 insertions, 5 deletions
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; |