summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@sonymobile.com>2014-10-24 00:16:02 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-10-24 00:16:03 +0000
commit50e3b57294f445a51252c6d858aaf402ea3a24c7 (patch)
tree062e8f70a8f1c8a1beb7e27940e84c36179c95b6
parent44b951dd29b915e69b466a484f5efec6534bfd06 (diff)
parente88c762d02d82d0160c11c75ce776cb2d63b2a36 (diff)
Merge "Merge branch 'stable-2.9' into stable-2.10" into stable-2.10v2.10.1v2.10-rc2v2.10-rc1v2.10
-rw-r--r--src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java32
1 files changed, 19 insertions, 13 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 14337d6..ef659f2 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java
@@ -199,28 +199,30 @@ class Destination {
return cfg.getInt("remote", rc.getName(), name, defValue);
}
- void schedule(final Project.NameKey project, final String ref,
- final URIish uri, ReplicationState state) {
+ private boolean isVisible(final Project.NameKey project,
+ ReplicationState... states) {
try {
- repLog.info("scheduling replication {}:{} => {}", project, ref, uri);
- boolean visible = threadScoper.scope(new Callable<Boolean>(){
+ return threadScoper.scope(new Callable<Boolean>() {
@Override
public Boolean call() throws NoSuchProjectException {
return controlFor(project).isVisible();
}
}).call();
- if (!visible) {
- stateLog.warn(String.format("project %s is not visible", project),
- state);
- return;
- }
} catch (NoSuchProjectException err) {
- stateLog.error(String.format(
- "source project %s not available", project), err, state);
- return;
+ stateLog.error(String.format("source project %s not available", project),
+ err, states);
} catch (Exception e) {
throw Throwables.propagate(e);
}
+ return false;
+ }
+
+ void schedule(final Project.NameKey project, final String ref,
+ final URIish uri, ReplicationState state) {
+ repLog.info("scheduling replication {}:{} => {}", project, ref, uri);
+ if (!isVisible(project, state)) {
+ return;
+ }
if (!replicatePermissions) {
PushOne e;
@@ -384,7 +386,11 @@ class Destination {
}
}
- boolean wouldPushProject(Project.NameKey project) {
+ boolean wouldPushProject(final Project.NameKey project) {
+ if (!isVisible(project)) {
+ return false;
+ }
+
// by default push all projects
if (projects.length < 1) {
return true;