/** * Executes the remote-list operation. * * @return {@code List<Remote>} of all remotes found in the config database, may be empty. */ @Override protected ImmutableList<Remote> _call() { ConfigDatabase config = configDatabase(); List<String> remotes = config.getAllSubsections("remote"); List<Remote> allRemotes = new ArrayList<Remote>(); for (String remoteName : remotes) { String remoteSection = "remote." + remoteName; Optional<String> remoteFetchURL = config.get(remoteSection + ".url"); Optional<String> remoteFetch = config.get(remoteSection + ".fetch"); Optional<String> remoteMapped = config.get(remoteSection + ".mapped"); Optional<String> remoteMappedBranch = config.get(remoteSection + ".mappedBranch"); Optional<String> remoteUserName = config.get(remoteSection + ".username"); Optional<String> remotePassword = config.get(remoteSection + ".password"); if (remoteFetchURL.isPresent() && remoteFetch.isPresent()) { Optional<String> remotePushURL = config.get(remoteSection + ".pushurl"); allRemotes.add(new Remote(remoteName, remoteFetchURL.get(), remotePushURL.or(remoteFetchURL.get()), remoteFetch.get(), remoteMapped.or("false").equals("true"), remoteMappedBranch.orNull(), remoteUserName.orNull(), remotePassword.orNull())); } } return ImmutableList.copyOf(allRemotes); } }
/** * Executes the remote-list operation. * * @return {@code List<Remote>} of all remotes found in the config database, may be empty. */ @Override protected ImmutableList<Remote> _call() { ConfigDatabase config = configDatabase(); List<String> remotes = config.getAllSubsections("remote"); List<Remote> allRemotes = new ArrayList<Remote>(); for (String remoteName : remotes) { String remoteSection = "remote." + remoteName; Optional<String> remoteFetchURL = config.get(remoteSection + ".url"); Optional<String> remoteFetch = config.get(remoteSection + ".fetch"); Optional<String> remoteMapped = config.get(remoteSection + ".mapped"); Optional<String> remoteMappedBranch = config.get(remoteSection + ".mappedBranch"); Optional<String> remoteUserName = config.get(remoteSection + ".username"); Optional<String> remotePassword = config.get(remoteSection + ".password"); if (remoteFetchURL.isPresent() && remoteFetch.isPresent()) { Optional<String> remotePushURL = config.get(remoteSection + ".pushurl"); allRemotes.add(new Remote(remoteName, remoteFetchURL.get(), remotePushURL.or(remoteFetchURL.get()), remoteFetch.get(), remoteMapped.or("false").equals("true"), remoteMappedBranch.orNull(), remoteUserName.orNull(), remotePassword.orNull())); } } return ImmutableList.copyOf(allRemotes); } }