private Set<Ref> getRemoteRefs(IRemoteRepo remote) { Set<Ref> remoteRefs = Sets.newHashSet(remote.listRefs(repository(), true, true)); Optional<Ref> headRef = remote.headRef(); if (headRef.isPresent()) { remoteRefs.add(headRef.get()); } return remoteRefs; }
private Set<Ref> getRemoteRefs(IRemoteRepo remote) { Set<Ref> remoteRefs = Sets.newHashSet(remote.listRefs(repository(), true, true)); Optional<Ref> headRef = remote.headRef(); if (headRef.isPresent()) { remoteRefs.add(headRef.get()); } return remoteRefs; }
private static Ref pingRemote(Remote remote) throws Exception { Optional<IRemoteRepo> remoteRepo; try { Hints hints = Hints.readOnly(); Repository localRepo = GlobalContextBuilder.builder().build(hints).repository(); remoteRepo = RemoteResolver.newRemote(remote, null); if (!remoteRepo.isPresent()) { throw new IllegalArgumentException("Repository not found or not reachable"); } else { IRemoteRepo repo = remoteRepo.get(); try { repo.open(); Optional<Ref> head = repo.headRef(); return head.orNull(); } finally { repo.close(); } } } catch (Exception e) { throw new IllegalArgumentException("Unable to connect: " + e.getMessage(), e); } }
remoteRefs = remoteRepo.listRefs(repository(), getBranches, getTags); if (getHead) { headRef = remoteRepo.headRef();
remoteRefs = remoteRepo.listRefs(repository(), getBranches, getTags); if (getHead) { headRef = remoteRepo.headRef();
private void remotePing(CommandContext context, final Context geogig) { Optional<Remote> remote; try { remote = geogig.command(RemoteResolve.class).setName(remoteName).call(); } catch (RemoteException re) { throw new CommandSpecException(re.statusCode.toString(), HttpStatus.BAD_REQUEST); } boolean remotePingResponse = false; if (remote.isPresent()) { try (IRemoteRepo rr = geogig.command(OpenRemote.class).setRemote(remote.get()) .readOnly().call()) { rr.headRef(); remotePingResponse = true; } catch (Exception e) { // Do nothing, we will write the response later. } } final boolean pingSuccess = remotePingResponse; context.setResponseContent(new CommandResponse() { @Override public void write(ResponseWriter out) throws Exception { out.start(); out.writeRemotePingResponse(pingSuccess); out.finish(); } }); }
setDepth(cloneRepo, depth); localRemoteRefs = fetchRemoteData(cloneRepo, remote, depth, fetchIndexes); headRef = remoteRepo.headRef();
Optional<Ref> remoteHead = remoteRepo.headRef(); if (remoteHead.isPresent() && !remoteHead.get().getObjectId().isNull()) { updateLocalRef(remoteHead.get(), remote, localRemoteRefs);
Optional<Ref> remoteHead = remoteRepo.headRef(); if (remoteHead.isPresent() && !remoteHead.get().getObjectId().isNull()) { updateLocalRef(remoteHead.get(), remote, localRemoteRefs);