@Override protected ImmutableList<ObjectId> getParentsInternal(ObjectId commitId) { return source.getParents(commitId); }
@Override protected boolean existsInDestination(ObjectId commitId) { return destination.objectExists(commitId); } };
@Override protected Evaluation evaluate(CommitNode commitNode) { if (limit.isPresent() && commitNode.getDepth() > limit.get()) { return Evaluation.EXCLUDE_AND_PRUNE; } else if (!source.objectExists(commitNode.getObjectId())) { // remote history is shallow return Evaluation.EXCLUDE_AND_PRUNE; } boolean exists = destination.objectExists(commitNode.getObjectId()); if (!limit.isPresent() && exists) { // calculate the new fetch limit limit = Optional.of( destination.getDepth(commitNode.getObjectId()) + commitNode.getDepth() - 1); } if (exists) { return Evaluation.EXCLUDE_AND_CONTINUE; } return Evaluation.INCLUDE_AND_CONTINUE; }
/** * Returns the appropriate commit traverser to use for the fetch operation. * * @param fetchLimit the fetch limit to use * @return the {@link CommitTraverser} to use. */ protected CommitTraverser getFetchTraverser(Repository local, Optional<Integer> fetchLimit) { RepositoryWrapper localWrapper = new LocalRepositoryWrapper(local); RepositoryWrapper remoteWrapper = getRemoteWrapper(); CommitTraverser traverser; if (localWrapper.getRepoDepth().isPresent()) { traverser = new ShallowCommitTraverser(remoteWrapper, localWrapper, fetchLimit); } else if (remoteWrapper.getRepoDepth().isPresent()) { traverser = new ShallowFullCommitTraverser(remoteWrapper, localWrapper); } else { traverser = new FullCommitTraverser(remoteWrapper, localWrapper); } return traverser; }
@Override protected Evaluation evaluate(CommitNode commitNode) { if (limit.isPresent() && commitNode.getDepth() > limit.get()) { return Evaluation.EXCLUDE_AND_PRUNE; } else if (!source.objectExists(commitNode.getObjectId())) { // remote history is shallow return Evaluation.EXCLUDE_AND_PRUNE; } boolean exists = destination.objectExists(commitNode.getObjectId()); if (!limit.isPresent() && exists) { // calculate the new fetch limit limit = Optional.of( destination.getDepth(commitNode.getObjectId()) + commitNode.getDepth() - 1); } if (exists) { return Evaluation.EXCLUDE_AND_CONTINUE; } return Evaluation.INCLUDE_AND_CONTINUE; }
/** * Returns the appropriate commit traverser to use for the fetch operation. * * @param fetchLimit the fetch limit to use * @return the {@link CommitTraverser} to use. */ protected CommitTraverser getFetchTraverser(Repository local, Optional<Integer> fetchLimit) { RepositoryWrapper localWrapper = new LocalRepositoryWrapper(local); RepositoryWrapper remoteWrapper = getRemoteWrapper(); CommitTraverser traverser; if (localWrapper.getRepoDepth().isPresent()) { traverser = new ShallowCommitTraverser(remoteWrapper, localWrapper, fetchLimit); } else if (remoteWrapper.getRepoDepth().isPresent()) { traverser = new ShallowFullCommitTraverser(remoteWrapper, localWrapper); } else { traverser = new FullCommitTraverser(remoteWrapper, localWrapper); } return traverser; }
@Override protected boolean existsInDestination(ObjectId commitId) { return destination.objectExists(commitId); } }
@Override protected ImmutableList<ObjectId> getParentsInternal(ObjectId commitId) { return source.getParents(commitId); }
/** * Returns the appropriate commit traverser to use for the push operation. * * @param remoteRef the remote ref to push to * @return the {@link CommitTraverser} to use. */ protected CommitTraverser getPushTraverser(Repository local, Optional<Ref> remoteRef) throws SynchronizationException { RepositoryWrapper localWrapper = new LocalRepositoryWrapper(local); RepositoryWrapper remoteWrapper = getRemoteWrapper(); CommitTraverser traverser; if (remoteWrapper.getRepoDepth().isPresent()) { Optional<Integer> pushDepth = Optional.absent(); if (!remoteRef.isPresent()) { pushDepth = remoteWrapper.getRepoDepth(); } traverser = new ShallowCommitTraverser(localWrapper, remoteWrapper, pushDepth); } else if (local.getDepth().isPresent()) { traverser = new ShallowFullCommitTraverser(localWrapper, remoteWrapper); } else { traverser = new FullCommitTraverser(localWrapper, remoteWrapper); } return traverser; }
@Override protected boolean existsInDestination(ObjectId commitId) { return destination.objectExists(commitId); } }
@Override protected ImmutableList<ObjectId> getParentsInternal(ObjectId commitId) { return source.getParents(commitId); }
/** * Returns the appropriate commit traverser to use for the push operation. * * @param remoteRef the remote ref to push to * @return the {@link CommitTraverser} to use. */ protected CommitTraverser getPushTraverser(Repository local, Optional<Ref> remoteRef) throws SynchronizationException { RepositoryWrapper localWrapper = new LocalRepositoryWrapper(local); RepositoryWrapper remoteWrapper = getRemoteWrapper(); CommitTraverser traverser; if (remoteWrapper.getRepoDepth().isPresent()) { Optional<Integer> pushDepth = Optional.absent(); if (!remoteRef.isPresent()) { pushDepth = remoteWrapper.getRepoDepth(); } traverser = new ShallowCommitTraverser(localWrapper, remoteWrapper, pushDepth); } else if (local.getDepth().isPresent()) { traverser = new ShallowFullCommitTraverser(localWrapper, remoteWrapper); } else { traverser = new FullCommitTraverser(localWrapper, remoteWrapper); } return traverser; }
@Override protected boolean existsInDestination(ObjectId commitId) { return destination.objectExists(commitId); } };
@Override protected ImmutableList<ObjectId> getParentsInternal(ObjectId commitId) { return source.getParents(commitId); }
@Override protected boolean existsInDestination(ObjectId commitId) { return destination.objectExists(commitId); }
@Override protected ImmutableList<ObjectId> getParentsInternal(ObjectId commitId) { return source.getParents(commitId); }
@Override protected boolean existsInDestination(ObjectId commitId) { return destination.objectExists(commitId); }
@Override protected ImmutableList<ObjectId> getParentsInternal(ObjectId commitId) { return source.getParents(commitId); }
@Override protected Evaluation evaluate(CommitNode commitNode) { if (destination.objectExists(commitNode.getObjectId())) { return Evaluation.EXCLUDE_AND_PRUNE; } else { return Evaluation.INCLUDE_AND_CONTINUE; } }
@Override protected ImmutableList<ObjectId> getParentsInternal(ObjectId commitId) { return source.getParents(commitId); }