private @Nullable ObjectId findShallowestCommonAncestor(ObjectId tip, Set<ObjectId> otherTips) { ObjectDatabase localdb = objectDatabase(); Set<ObjectId> commonAncestors = new HashSet<>(); for (ObjectId remoteTip : otherTips) { if (!commonAncestors.contains(remoteTip) && localdb.exists(remoteTip)) { Optional<ObjectId> commonAncestor = command(FindCommonAncestor.class).setLeftId(tip) .setRightId(remoteTip).call(); if (commonAncestor.isPresent()) { commonAncestors.add(commonAncestor.get()); } } } int depth = Integer.MAX_VALUE; ObjectId shallowestCommonAncestor = null; for (ObjectId ca : commonAncestors) { int depthTo = depthTo(tip, ca); if (depthTo < depth) { shallowestCommonAncestor = ca; depth = depthTo; } } return shallowestCommonAncestor; }
private @Nullable ObjectId findShallowestCommonAncestor(ObjectId tip, Set<ObjectId> otherTips) { ObjectDatabase localdb = objectDatabase(); Set<ObjectId> commonAncestors = new HashSet<>(); for (ObjectId remoteTip : otherTips) { if (!commonAncestors.contains(remoteTip) && localdb.exists(remoteTip)) { Optional<ObjectId> commonAncestor = command(FindCommonAncestor.class).setLeftId(tip) .setRightId(remoteTip).call(); if (commonAncestor.isPresent()) { commonAncestors.add(commonAncestor.get()); } } } int depth = Integer.MAX_VALUE; ObjectId shallowestCommonAncestor = null; for (ObjectId ca : commonAncestors) { int depthTo = depthTo(tip, ca); if (depthTo < depth) { shallowestCommonAncestor = ca; depth = depthTo; } } return shallowestCommonAncestor; }
.setLeftId(lastCommit.getId()).setRightId(oldestCommitId).call(); if (ancestor.isPresent()) { stopPoints.add(ancestor.get());
.setLeftId(lastCommit.getId()).setRightId(oldestCommitId).call(); if (ancestor.isPresent()) { stopPoints.add(ancestor.get());
if (i != 0) { Optional<ObjectId> commonAncestor = from.command(FindCommonAncestor.class) .setLeftId(commit.getParentIds().get(0)).setRightId(parentId).call(); if (commonAncestor.isPresent()) { if (from.command(CheckSparsePath.class).setStart(parentId)
} else if (local.blobExists(remoteObjectId)) { Optional<ObjectId> ancestor = local.command(FindCommonAncestor.class) .setLeftId(remoteObjectId).setRightId(localObjectId).call(); if (!ancestor.isPresent()) {
} else if (local.blobExists(mappedId)) { Optional<ObjectId> ancestor = local.command(FindCommonAncestor.class) .setLeftId(mappedId).setRightId(ref.getObjectId()).call(); if (!ancestor.isPresent()) {
} else if (local.blobExists(remoteObjectId)) { Optional<ObjectId> ancestor = local.command(FindCommonAncestor.class) .setLeftId(remoteObjectId).setRightId(localObjectId).call(); if (!ancestor.isPresent()) {
} else if (local.blobExists(mappedId)) { Optional<ObjectId> ancestor = local.command(FindCommonAncestor.class) .setLeftId(mappedId).setRightId(ref.getObjectId()).call(); if (!ancestor.isPresent()) {
private ObjectId findCommonAncestor(PR pr, Ref targetBranch) { Ref issuerBranch; ObjectId commonAncestor; final Repository issuerRepo = pr.openRemote(); try { issuerBranch = pr.resolveRemoteBranch(issuerRepo); commonAncestor = command(FindCommonAncestor.class)// .setLeftId(targetBranch.getObjectId())// .setLeftSource(graphDatabase())// .setRightId(issuerBranch.getObjectId())// .setRightSource(issuerRepo.graphDatabase())// .call().orNull(); } finally { issuerRepo.close(); } checkArgument(commonAncestor != null, "Local branch %s and remote %s do not have a common ancestor", pr.getTargetBranch(), issuerBranch.getName()); return commonAncestor; }
} else if (objectDatabase().exists(remoteObjectId)) { Optional<ObjectId> ancestor = command(FindCommonAncestor.class) .setLeftId(remoteObjectId).setRightId(localObjectId).call(); if (!ancestor.isPresent()) {
} else if (objectDatabase().exists(remoteObjectId)) { Optional<ObjectId> ancestor = command(FindCommonAncestor.class) .setLeftId(remoteObjectId).setRightId(localObjectId).call(); if (!ancestor.isPresent()) {
if (i != 0) { Optional<ObjectId> commonAncestor = from.command(FindCommonAncestor.class) .setLeftId(commit.getParentIds().get(0)).setRightId(parentId).call(); if (commonAncestor.isPresent()) { if (from.command(CheckSparsePath.class).setStart(parentId)
if (i != 0) { Optional<ObjectId> commonAncestor = from.command(FindCommonAncestor.class) .setLeftId(commit.getParentIds().get(0)).setRightId(parentId).call(); if (commonAncestor.isPresent()) { if (from.command(CheckSparsePath.class).setStart(parentId)