diff options
author | Dariusz Luksza <dariusz@luksza.org> | 2015-05-11 15:31:44 +0200 |
---|---|---|
committer | David Pursehouse <david.pursehouse@sonymobile.com> | 2016-04-21 13:25:46 +0000 |
commit | b80cd8168ae8ba065c0186b1ddfec366a6368cb6 (patch) | |
tree | 410e45e0c7463524db07bea024eebc3db16a4153 /src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java | |
parent | d5cd908c0d7938a5d253d49f68ed352bbc7449cf (diff) |
Add new configuration option to control replication of hidden projects
In some cases we would like to replicate hidden projects to given
remotes. Right now it is not possible to achieve this, all hidden
projects are not replicated.
New remote.NAME.replicateHiddenProjects configuration allow to control
this behavior. By default it is set to 'false' to be consistent with
previous versions.
Change-Id: Ie7d7330ae685e104937037a89141cef2febbf5f1
Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
Diffstat (limited to 'src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java')
-rw-r--r-- | src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java b/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java index 98a642e..8164c09 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java +++ b/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java @@ -199,13 +199,15 @@ public class Destination { return cnt; } - private boolean isVisible(final Project.NameKey project, + private boolean shouldReplicate(final Project.NameKey project, ReplicationState... states) { try { return threadScoper.scope(new Callable<Boolean>() { @Override public Boolean call() throws NoSuchProjectException { - return controlFor(project).isVisible(); + ProjectControl projectControl = controlFor(project); + return projectControl.isReadable() && (!projectControl.isHidden() + || config.replicateHiddenProjects()); } }).call(); } catch (NoSuchProjectException err) { @@ -221,7 +223,7 @@ public class Destination { void schedule(Project.NameKey project, String ref, URIish uri, ReplicationState state) { repLog.info("scheduling replication {}:{} => {}", project, ref, uri); - if (!isVisible(project, state)) { + if (!shouldReplicate(project, state)) { return; } @@ -385,7 +387,7 @@ public class Destination { } boolean wouldPushProject(Project.NameKey project) { - if (!isVisible(project)) { + if (!shouldReplicate(project)) { return false; } |