/** * @param remoteName the name or URL of a remote repository to fetch from * @return {@code this} */ public FetchOp addRemote(final String remoteName) { checkNotNull(remoteName); return addRemote(command(RemoteResolve.class).setName(remoteName)); }
@Override public Optional<Remote> get() { return call(); } }
ConfigDatabase config = configDatabase(); List<String> allRemotes = config.getAllSubsections("remote"); if (allRemotes.contains(name)) {
/** * @param remoteName the name or URL of a remote repository to fetch from * @return {@code this} */ public PullOp setRemote(final String remoteName) { Preconditions.checkNotNull(remoteName); return setRemote(command(RemoteResolve.class).setName(remoteName)); }
/** * @param remoteName the name or URL of a remote repository to fetch from * @return {@code this} */ public FetchOp addRemote(final String remoteName) { checkNotNull(remoteName); return addRemote(command(RemoteResolve.class).setName(remoteName)); }
private Remote addRemote(Repository clone) { final boolean sparse = clone.isSparse(); if (sparse) { checkArgument(this.branch.isPresent(), "No branch specified for sparse clone."); } {// won't be necessary once ClopeOp actually creates the clone repo Optional<Remote> remote = clone.command(RemoteResolve.class).setName(remoteName).call(); if (remote.isPresent()) { clone.command(RemoteRemoveOp.class).setName(remoteName).call(); } } final @Nullable String branch = this.branch.orNull(); Remote remote = clone.command(RemoteAddOp.class)// .setName(remoteName)// .setURL(remoteURI.toString())// .setMapped(sparse)// .setUserName(username)// .setPassword(password)// .setBranch(branch).// call(); return remote; }
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(); } }); }
private void createFilterFile(Map<String, String> filters) { String filterBlob = ""; for (Entry<String, String> entry : filters.entrySet()) { String featurePath = entry.getKey(); String filter = entry.getValue(); filterBlob += "[" + featurePath + "]\n"; filterBlob += "type = CQL\n"; filterBlob += "filter = " + filter + "\n"; } try { localGeogig.repo.blobStore().putBlob(Blobs.SPARSE_FILTER_BLOB_KEY, filterBlob.getBytes()); Optional<Remote> remoteInfo = localGeogig.geogig.command(RemoteResolve.class) .setName(REMOTE_NAME).call(); Preconditions.checkState(remoteInfo.isPresent()); LocalMappedRemoteRepo remoteRepo; remoteRepo = spy( new LocalMappedRemoteRepo(remoteInfo.get(), remoteGeogig.envHome.toURI())); doNothing().when(remoteRepo).close(); remoteRepo.setRepository(remoteGeogig.geogig.getRepository()); localGeogig.remoteOverride.put(REMOTE_NAME, remoteRepo); } catch (Exception e) { e.printStackTrace(); throw e; } }