/** * @see ForEachRef */ private ImmutableSet<Ref> locallyKnownRefs(final Remote remoteConfig) { Predicate<Ref> filter = input -> { java.util.Optional<String> remoteRef = remoteConfig.mapToRemote(input.getName()); return remoteRef.isPresent(); }; return command(ForEachRef.class).setFilter(filter).call(); }
private Ref toLocal(Ref remoteRef) { Optional<String> localName = remote.mapToRemote(remoteRef.getName()); Preconditions.checkArgument(localName.isPresent(), "Can't map %s to local ref using %s", remoteRef.getName(), remote.getFetchSpec()); Ref localRef; if (remoteRef instanceof SymRef) { Ref target = toLocal(remoteRef.peel()); localRef = new SymRef(localName.get(), target); } else { localRef = new Ref(localName.get(), remoteRef.getObjectId()); } return localRef; }
for (LocalRemoteRefSpec spec : remote.getFetchSpecs()) { java.util.Optional<String> remoteName; remoteName = remote.mapToRemote(localRemote.getName()); boolean isNew = false, remoteDeleted = false; if (remoteName.isPresent()) {
private void verifyFetchedIndexes(AbstractGeoGigOp<?> command, TransferSummary ts) { Set<String> remotes = ts.getRefDiffs().keySet(); for (String remoteURI : remotes) { FetchOp op = (FetchOp) command; Remote remoteObj = op.getRemotes().stream() .filter(r -> remoteURI.equals(r.getFetchURL())).findFirst().get(); String fetchURL = remoteObj.getFetchURL(); Repository remote = (Repository) command.getClientData().get(fetchURL); Collection<RefDiff> collection = ts.getRefDiffs().get(remoteURI); for (RefDiff rd : collection) { if (rd.isDelete()) { continue; } Ref newRef = rd.getNewRef(); Repository local = command.context().repository(); String localRef = newRef.getName(); String remoteBranch = remoteObj.mapToRemote(localRef).orElse(null); verifyClonedIndexes(local, remote, Optional.of(localRef), Optional.of(remoteBranch)); } } }