private static boolean doesNotExist(RemoteConfig cfg) { return cfg.getURIs().isEmpty() && cfg.getPushURIs().isEmpty(); }
private static List<URIish> getURIs(final RemoteConfig cfg, final Operation op) { switch (op) { case FETCH: return cfg.getURIs(); case PUSH: { List<URIish> uris = cfg.getPushURIs(); if (uris.isEmpty()) uris = cfg.getURIs(); return uris; } default: throw new IllegalArgumentException(op.toString()); } }
List<URIish> uris = rc.getPushURIs(); if (uris.isEmpty()) { uris = rc.getURIs();
RemoteConfig remote = new RemoteConfig(config, name); if (push) { List<URIish> uris = remote.getPushURIs(); if (uris.size() > 1) { throw new JGitInternalException(
/** * Update this remote's definition within the configuration. * * @param rc * the configuration file to store ourselves into. */ public void update(Config rc) { final List<String> vlst = new ArrayList<>(); vlst.clear(); for (URIish u : getURIs()) vlst.add(u.toPrivateString()); rc.setStringList(SECTION, getName(), KEY_URL, vlst); vlst.clear(); for (URIish u : getPushURIs()) vlst.add(u.toPrivateString()); rc.setStringList(SECTION, getName(), KEY_PUSHURL, vlst); vlst.clear(); for (RefSpec u : getFetchRefSpecs()) vlst.add(u.toString()); rc.setStringList(SECTION, getName(), KEY_FETCH, vlst); vlst.clear(); for (RefSpec u : getPushRefSpecs()) vlst.add(u.toString()); rc.setStringList(SECTION, getName(), KEY_PUSH, vlst); set(rc, KEY_UPLOADPACK, getUploadPack(), DEFAULT_UPLOAD_PACK); set(rc, KEY_RECEIVEPACK, getReceivePack(), DEFAULT_RECEIVE_PACK); set(rc, KEY_TAGOPT, getTagOpt().option(), TagOpt.AUTO_FOLLOW.option()); set(rc, KEY_MIRROR, mirror, DEFAULT_MIRROR); set(rc, KEY_TIMEOUT, timeout, 0); }
private URIish getUri() { URIish urIish = null; if (remoteConfig.getPushURIs().size() > 0) urIish = remoteConfig.getPushURIs().get(0); else urIish = remoteConfig.getURIs().get(0); return urIish; }
private static boolean doesNotExist(RemoteConfig cfg) { return cfg.getURIs().isEmpty() && cfg.getPushURIs().isEmpty(); }
private static boolean doesNotExist(final RemoteConfig cfg) { return cfg.getURIs().isEmpty() && cfg.getPushURIs().isEmpty(); }
private List<RemoteConfig> getUsableConfigs(final List<RemoteConfig> remotes) { if (remotes == null) return null; List<RemoteConfig> result = new ArrayList<RemoteConfig>(); for (RemoteConfig config : remotes) if ((sourceSelection && !config.getURIs().isEmpty() || !sourceSelection && (!config.getPushURIs().isEmpty() || !config.getURIs() .isEmpty()))) result.add(config); if (!result.isEmpty()) return result; return null; }
private boolean hasUri(RemoteConfig remote, String uri) { List<URIish> remoteUris = new ArrayList<>(); remoteUris.addAll(remote.getURIs()); remoteUris.addAll(remote.getPushURIs()); if (remoteUris.isEmpty()) { return false; } for (URIish remoteUri: remoteUris) { if (!remoteUri.toString().equals(uri)) { return false; } } return true; }
/** * @return list of all push URIs - either the one specified as custom URI or * all push URIs of the selected configuration; if not push URIs * were specified, the first URI is returned */ public List<URIish> getPushURIs() { if (isURISelected()) return Collections.singletonList(uri); if (isConfigSelected()) { List<URIish> pushUris = new ArrayList<URIish>(); pushUris.addAll(config.getPushURIs()); if (pushUris.isEmpty()) pushUris.add(config.getURIs().get(0)); return pushUris; } return null; }
private static List<URIish> getURIs(final RemoteConfig cfg, final Operation op) { switch (op) { case FETCH: return cfg.getURIs(); case PUSH: { List<URIish> uris = cfg.getPushURIs(); if (uris.isEmpty()) uris = cfg.getURIs(); return uris; } default: throw new IllegalArgumentException(op.toString()); } }
private void configurePushURI() { List<URIish> pushURIs = new ArrayList<URIish>(remoteConfig.getPushURIs()); for (URIish urIish : pushURIs) { remoteConfig.removePushURI(urIish); } URIish pushURI = gerritConfiguration.getURI(); remoteConfig.addPushURI(pushURI); }
/** * Does the given remote exist in the repository? * * @param repository * @param remote * @return true if exists, false otherwise * @throws URISyntaxException */ protected static boolean hasRemote(final Repository repository, final String remote) throws URISyntaxException { final RemoteConfig config = new RemoteConfig(repository.getConfig(), remote); return !config.getURIs().isEmpty() || !config.getPushURIs().isEmpty(); }
private static List<URIish> getURIs(final RemoteConfig cfg, final Operation op) { switch (op) { case FETCH: return cfg.getURIs(); case PUSH: { List<URIish> uris = cfg.getPushURIs(); if (uris.isEmpty()) uris = cfg.getURIs(); return uris; } default: throw new IllegalArgumentException(op.toString()); } }
private String getTextForRemoteConfig(final RemoteConfig rc) { final StringBuilder sb = new StringBuilder(rc.getName()); sb.append(": "); //$NON-NLS-1$ boolean first = true; List<URIish> uris; if (sourceSelection) uris = rc.getURIs(); else { uris = rc.getPushURIs(); // if no push URIs are defined, use fetch URIs instead if (uris.isEmpty()) uris = rc.getURIs(); } for (final URIish u : uris) { final String uString = u.toString(); if (first) first = false; else { sb.append(", "); //$NON-NLS-1$ if (sb.length() + uString.length() > REMOTE_CONFIG_TEXT_MAX_LENGTH) { sb.append("..."); //$NON-NLS-1$ break; } } sb.append(uString); } return sb.toString(); }
@Override public boolean canFinish() { if (getContainer().getCurrentPage() == repoPage) { RepositorySelection sel = repoPage.getSelection(); if (sel.isConfigSelected()) { RemoteConfig config = sel.getConfig(); return !config.getPushURIs().isEmpty() || !config.getURIs().isEmpty(); } } return super.canFinish(); }
private void updateControls() { boolean anyFetchUri = !config.getURIs().isEmpty(); boolean anyPushUri = !config.getPushURIs().isEmpty(); boolean anyUri = anyFetchUri || anyPushUri; setErrorMessage(null); uriViewer.getTable().setEnabled(anyPushUri); if (anyPushUri) uriViewer.setInput(config.getPushURIs()); else if (anyFetchUri) uriViewer.setInput(new String[] { NLS.bind(
/** * Update this remote's definition within the configuration. * * @param rc * the configuration file to store ourselves into. */ public void update(Config rc) { final List<String> vlst = new ArrayList<>(); vlst.clear(); for (URIish u : getURIs()) vlst.add(u.toPrivateString()); rc.setStringList(SECTION, getName(), KEY_URL, vlst); vlst.clear(); for (URIish u : getPushURIs()) vlst.add(u.toPrivateString()); rc.setStringList(SECTION, getName(), KEY_PUSHURL, vlst); vlst.clear(); for (RefSpec u : getFetchRefSpecs()) vlst.add(u.toString()); rc.setStringList(SECTION, getName(), KEY_FETCH, vlst); vlst.clear(); for (RefSpec u : getPushRefSpecs()) vlst.add(u.toString()); rc.setStringList(SECTION, getName(), KEY_PUSH, vlst); set(rc, KEY_UPLOADPACK, getUploadPack(), DEFAULT_UPLOAD_PACK); set(rc, KEY_RECEIVEPACK, getReceivePack(), DEFAULT_RECEIVE_PACK); set(rc, KEY_TAGOPT, getTagOpt().option(), TagOpt.AUTO_FOLLOW.option()); set(rc, KEY_MIRROR, mirror, DEFAULT_MIRROR); set(rc, KEY_TIMEOUT, timeout, 0); }
/** * Update this remote's definition within the configuration. * * @param rc * the configuration file to store ourselves into. */ public void update(final Config rc) { final List<String> vlst = new ArrayList<String>(); vlst.clear(); for (final URIish u : getURIs()) vlst.add(u.toPrivateString()); rc.setStringList(SECTION, getName(), KEY_URL, vlst); vlst.clear(); for (final URIish u : getPushURIs()) vlst.add(u.toPrivateString()); rc.setStringList(SECTION, getName(), KEY_PUSHURL, vlst); vlst.clear(); for (final RefSpec u : getFetchRefSpecs()) vlst.add(u.toString()); rc.setStringList(SECTION, getName(), KEY_FETCH, vlst); vlst.clear(); for (final RefSpec u : getPushRefSpecs()) vlst.add(u.toString()); rc.setStringList(SECTION, getName(), KEY_PUSH, vlst); set(rc, KEY_UPLOADPACK, getUploadPack(), DEFAULT_UPLOAD_PACK); set(rc, KEY_RECEIVEPACK, getReceivePack(), DEFAULT_RECEIVE_PACK); set(rc, KEY_TAGOPT, getTagOpt().option(), TagOpt.AUTO_FOLLOW.option()); set(rc, KEY_MIRROR, mirror, DEFAULT_MIRROR); set(rc, KEY_TIMEOUT, timeout, 0); }