Search in sources :

Example 1 with PullPolicyResult

use of io.fabric8.git.PullPushPolicy.PullPolicyResult in project fabric8 by jboss-fuse.

the class DummyBatchingProgressMonitor method doPullInternal.

private PullPolicyResult doPullInternal(GitContext context, CredentialsProvider credentialsProvider, boolean allowVersionDelete, boolean allowPush, int forcedTimeoutInSeconds) {
    PullPolicyResult pullResult = pullPushPolicy.doPull(context, credentialsProvider, allowVersionDelete, allowPush, forcedTimeoutInSeconds);
    if (pullResult.getLastException() == null) {
        Map<String, PullPushPolicy.BranchChange> updatedVersions = pullResult.localUpdateVersions();
        if (!updatedVersions.isEmpty()) {
            if (updatedVersions.containsKey(GitHelpers.MASTER_BRANCH)) {
                versionCache.invalidateAll();
            } else {
                for (String version : updatedVersions.keySet()) {
                    versionCache.invalidate(version);
                }
            }
            notificationRequired = true;
        }
        Set<String> pullVersions = pullResult.getVersions();
        if (!pullVersions.isEmpty() && !pullVersions.equals(versions)) {
            versions.clear();
            for (String v : pullVersions) {
                if (!v.startsWith("patches-") && !v.startsWith("patch-") && !v.equals(HISTORY_BRANCH) && !v.equals(ADMIN_HISTORY_BRANCH)) {
                    versions.add(v);
                }
            }
        }
        if (pullResult.remoteUpdateRequired()) {
            doPushInternal(context, credentialsProvider);
        }
    }
    return pullResult;
}
Also used : PullPolicyResult(io.fabric8.git.PullPushPolicy.PullPolicyResult)

Aggregations

PullPolicyResult (io.fabric8.git.PullPushPolicy.PullPolicyResult)1