private Map<String, String> getReplacements(final Config config, final String keyName) { final Map<String, String> replacements = new HashMap<>(); for (String url : config.getSubsections(KEY_URL)) for (String insteadOf : config.getStringList(KEY_URL, url, keyName)) replacements.put(insteadOf, url); return replacements; }
private void loadPathNames() { pathToName = null; if (modulesConfig != null) { HashMap<String, String> pathNames = new HashMap<>(); for (String name : modulesConfig .getSubsections(ConfigConstants.CONFIG_SUBMODULE_SECTION)) { pathNames.put(modulesConfig.getString( ConfigConstants.CONFIG_SUBMODULE_SECTION, name, ConfigConstants.CONFIG_KEY_PATH), name); } pathToName = pathNames; } }
/** * Parse all remote blocks in an existing configuration file, looking for * remotes configuration. * * @param rc * the existing configuration to get the remote settings from. * The configuration must already be loaded into memory. * @return all remotes configurations existing in provided repository * configuration. Returned configurations are ordered * lexicographically by names. * @throws java.net.URISyntaxException * one of the URIs within the remote's configuration is invalid. */ public static List<RemoteConfig> getAllRemoteConfigs(Config rc) throws URISyntaxException { final List<String> names = new ArrayList<>(rc .getSubsections(SECTION)); Collections.sort(names); final List<RemoteConfig> result = new ArrayList<>(names .size()); for (String name : names) result.add(new RemoteConfig(rc, name)); return result; }
public static void main(String[] args) throws IOException { try (Repository repository = CookbookHelper.openJGitCookbookRepository()) { Config storedConfig = repository.getConfig(); Set<String> remotes = storedConfig.getSubsections("remote"); for (String remoteName : remotes) { String url = storedConfig.getString("remote", remoteName, "url"); System.out.println(remoteName + " " + url); } } } }
public static void main(String[] args) throws IOException { try (Repository repository = CookbookHelper.openJGitCookbookRepository()) { Config storedConfig = repository.getConfig(); Set<String> remotes = storedConfig.getSubsections("remote"); for (String remoteName : remotes) { String url = storedConfig.getString("remote", remoteName, "url"); System.out.println(remoteName + " " + url); } } } }
Config cfg = repo.getConfig(); String localName = getLocalName(cfg); for (String name : cfg.getSubsections(CONFIG_KEY_REMOTE)) { if (!hasParticipation(cfg, name)) { continue;
c.fromText(gitModulesContents); for (String subsection : c.getSubsections(CONFIG_SUBMODULE_SECTION)) { assertValidSubmoduleName(subsection);
redirectLimit = MAX_REDIRECTS; String match = findMatch(config.getSubsections(HTTP), uri); if (match != null) {
private Map<String, String> getReplacements(final Config config, final String keyName) { final Map<String, String> replacements = new HashMap<String, String>(); for (String url : config.getSubsections(KEY_URL)) for (String insteadOf : config.getStringList(KEY_URL, url, keyName)) replacements.put(insteadOf, url); return replacements; }
private Map<String, String> getReplacements(final Config config, final String keyName) { final Map<String, String> replacements = new HashMap<>(); for (String url : config.getSubsections(KEY_URL)) for (String insteadOf : config.getStringList(KEY_URL, url, keyName)) replacements.put(insteadOf, url); return replacements; }
public static List<RemoteConfig> getAllGitRepositories(final Config rc) throws URISyntaxException { final List<String> names = new ArrayList<String>(rc.getSubsections(REMOTE_SECTION)); Collections.sort(names); final List<RemoteConfig> result = new ArrayList<RemoteConfig>(names.size()); for (final String name : names) { result.add(new GitRepository(rc, name)); } return result; }
private void loadPathNames() { pathToName = null; if (modulesConfig != null) { HashMap<String, String> pathNames = new HashMap<>(); for (String name : modulesConfig .getSubsections(ConfigConstants.CONFIG_SUBMODULE_SECTION)) { pathNames.put(modulesConfig.getString( ConfigConstants.CONFIG_SUBMODULE_SECTION, name, ConfigConstants.CONFIG_KEY_PATH), name); } pathToName = pathNames; } }
/** * Parse all remote blocks in an existing configuration file, looking for * remotes configuration. * * @param rc * the existing configuration to get the remote settings from. * The configuration must already be loaded into memory. * @return all remotes configurations existing in provided repository * configuration. Returned configurations are ordered * lexicographically by names. * @throws java.net.URISyntaxException * one of the URIs within the remote's configuration is invalid. */ public static List<RemoteConfig> getAllRemoteConfigs(Config rc) throws URISyntaxException { final List<String> names = new ArrayList<>(rc .getSubsections(SECTION)); Collections.sort(names); final List<RemoteConfig> result = new ArrayList<>(names .size()); for (String name : names) result.add(new RemoteConfig(rc, name)); return result; }
/** * Parse all remote blocks in an existing configuration file, looking for * remotes configuration. * * @param rc * the existing configuration to get the remote settings from. * The configuration must already be loaded into memory. * @return all remotes configurations existing in provided repository * configuration. Returned configurations are ordered * lexicographically by names. * @throws URISyntaxException * one of the URIs within the remote's configuration is invalid. */ public static List<RemoteConfig> getAllRemoteConfigs(final Config rc) throws URISyntaxException { final List<String> names = new ArrayList<String>(rc .getSubsections(SECTION)); Collections.sort(names); final List<RemoteConfig> result = new ArrayList<RemoteConfig>(names .size()); for (final String name : names) result.add(new RemoteConfig(rc, name)); return result; }
private List<Git.Remote> getRemotes(final Repository repository) { Config config = repository.getConfig(); List<Git.Remote> remotes = new ArrayList<>(); for (String remote : config.getSubsections("remote")) { String url = config.getString("remote", remote, "url"); remotes.add(new Git.Remote(remote, url)); } return remotes; } }
private List<Git.Remote> getRemotes(final Repository repository) { Config config = repository.getConfig(); List<Git.Remote> remotes = new ArrayList<>(); for (String remote : config.getSubsections("remote")) { String url = config.getString("remote", remote, "url"); remotes.add(new Git.Remote(remote, url)); } return remotes; } }
public Object[] getChildren(Object o) { if (children == null) { List<Object> allChildren = new ArrayList<Object>(); Set<String> subSectionNames = parent.config .getSubsections(name); for (String subSectionName : subSectionNames) allChildren.add(new SubSection(parent.config, this, subSectionName)); Set<String> entryNames = parent.config.getNames(name); for (String entryName : entryNames) { String[] values = parent.config.getStringList(name, null, entryName); if (values.length == 1) allChildren.add(new Entry(this, entryName, values[0], -1)); else { int index = 0; for (String value : values) allChildren.add(new Entry(this, entryName, value, index++)); } } children = allChildren.toArray(); } return children; }
void loadFrom(Config cfg) { projects.clear(); consumedProjects.clear(); cqs.clear(); projects.addAll(parseProjects(cfg, S_PROJECT)); consumedProjects.addAll(parseProjects(cfg, S_CONSUMES)); for (String id : cfg.getSubsections(S_CQ)) { CQ cq = new CQ(Long.parseLong(id)); cq.setDescription(cfg.getString(S_CQ, id, K_DESCRIPTION)); cq.setLicense(cfg.getString(S_CQ, id, K_LICENSE)); cq.setUse(cfg.getString(S_CQ, id, K_USE)); cq.setState(cfg.getString(S_CQ, id, K_STATE)); cq.setComments(cfg.getString(S_CQ, id, K_COMMENTS)); cqs.add(cq); } reviewUrl = cfg.getString(S_REVIEW, null, K_URL); }
private List<Project> parseProjects(final Config cfg, final String sectionName) { final List<Project> dst = new ArrayList<Project>(); for (String id : cfg.getSubsections(sectionName)) { String name = cfg.getString(sectionName, id, K_NAME); Project project = new Project(id, name); project.setVersion(cfg.getString(sectionName, id, K_VERSION)); project.setComments(cfg.getString(sectionName, id, K_COMMENTS)); for (String c : cfg.getStringList(sectionName, id, K_SKIP_COMMIT)) project.addSkipCommit(ObjectId.fromString(c)); for (String license : cfg.getStringList(sectionName, id, K_LICENSE)) project.addLicense(license); dst.add(project); } return dst; }
redirectLimit = MAX_REDIRECTS; String match = findMatch(config.getSubsections(HTTP), uri); if (match != null) {