/** * Add the given commit's parents to the traversal queue. * * @param commitNode the commit whose parents need to be added */ private void addParents(CommitNode commitNode, ImmutableList<ObjectId> parents) { for (ObjectId parent : parents) { CommitNode parentNode = new CommitNode(parent, commitNode.getDepth() + 1); if (commitQueue.contains(parentNode)) { commitQueue.remove(parentNode); } commitQueue.add(parentNode); } }
/** * Add the given commit's parents to the traversal queue. * * @param commitNode the commit whose parents need to be added */ private void addParents(CommitNode commitNode, ImmutableList<ObjectId> parents) { for (ObjectId parent : parents) { CommitNode parentNode = new CommitNode(parent, commitNode.getDepth() + 1); if (commitQueue.contains(parentNode)) { commitQueue.remove(parentNode); } commitQueue.add(parentNode); } }
@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; }
@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; }