String[] values = repoConfig.getStringList( ConfigConstants.CONFIG_BRANCH_SECTION, shortOldName, name); String[] existing = repoConfig.getStringList( ConfigConstants.CONFIG_BRANCH_SECTION, newName, name);
public Object getPropertyValue(Object id) { String[] list = myConfig.getStringList(RepositoriesView.REMOTE, myName, (String) id); if (list != null && list.length > 1) { // let's show this as "[some/uri][another/uri]" StringBuilder sb = new StringBuilder(); for (String s : list) { sb.append('['); sb.append(s); sb.append(']'); } return sb.toString(); } return myConfig.getString(RepositoriesView.REMOTE, myName, (String) id); }
/** {@inheritDoc} */ @Override public void addRemoteUrl(String name, String url) throws GitException, InterruptedException { try (Repository repo = getRepository()) { StoredConfig config = repo.getConfig(); List<String> urls = new ArrayList<>(); urls.addAll(Arrays.asList(config.getStringList("remote", name, "url"))); urls.add(url); config.setStringList("remote", name, "url", urls); config.save(); } catch (IOException e) { throw new GitException(e); } }
private void list(StoredConfig config) throws IOException, ConfigInvalidException { config.load(); Set<String> sections = config.getSections(); for (String section : sections) { Set<String> names = config.getNames(section); for (String name : names) { for (String value : config.getStringList(section, null, name)) outw.println(section + "." + name + "=" + value); //$NON-NLS-1$ //$NON-NLS-2$ } if (names.isEmpty()) { for (String subsection : config.getSubsections(section)) { names = config.getNames(section, subsection); for (String name : names) { for (String value : config.getStringList(section, subsection, name)) outw.println(section + "." + subsection + "." //$NON-NLS-1$ //$NON-NLS-2$ + name + "=" + value); //$NON-NLS-1$ } } } } } }
boolean hasPush = config.getStringList(REMOTE, remote.getObject(), PUSH).length > 0; if (hasPush) { String[] pushurls = config.getStringList(REMOTE, remote .getObject(), PUSHURL);
String[] values = repoConfig.getStringList( ConfigConstants.CONFIG_BRANCH_SECTION, shortOldName, name); String[] existing = repoConfig.getStringList( ConfigConstants.CONFIG_BRANCH_SECTION, newName, name);
String[] values = repoConfig.getStringList( ConfigConstants.CONFIG_BRANCH_SECTION, shortOldName, name); String[] existing = repoConfig.getStringList( ConfigConstants.CONFIG_BRANCH_SECTION, newName, name);