in src/main/java/com/googlesource/gerrit/plugins/replication/pull/StartFetchCommand.java [65:112]
protected void run() throws Failure {
if (all && projectPatterns.size() > 0) {
throw new UnloggedFailure(1, "error: cannot combine --all and PROJECT");
}
ReplicationState state =
fetchReplicationStateFactory.create(
new FetchResultProcessing.CommandProcessing(this, eventDispatcher.get()));
Future<?> future = null;
ReplicationFilter projectFilter;
if (all) {
projectFilter = ReplicationFilter.all();
} else {
projectFilter = new ReplicationFilter(projectPatterns);
}
future =
fetchFactory
.create(urlMatch, projectFilter, state, replicationType(now))
.schedule(0, TimeUnit.SECONDS);
if (wait) {
if (future != null) {
try {
future.get();
} catch (InterruptedException e) {
fetchStateLog.error(
"Thread was interrupted while waiting for FetchAll operation to finish", e, state);
return;
} catch (ExecutionException e) {
fetchStateLog.error("An exception was thrown in FetchAll operation", e, state);
return;
}
}
if (state.hasFetchTask()) {
try {
state.waitForReplication();
} catch (InterruptedException e) {
writeStdErrSync("We are interrupted while waiting replication to complete");
}
} else {
writeStdOutSync("Nothing to replicate");
}
}
}