/** * {@inheritDoc} * <p> * Executes the {@code remote} command with all the options and parameters * collected by the setter methods of this class. */ @Override public List<RemoteConfig> call() throws GitAPIException { checkCallable(); try { return RemoteConfig.getAllRemoteConfigs(repo.getConfig()); } catch (URISyntaxException e) { throw new JGitInternalException(e.getMessage(), e); } }
private void findRemoteConfig() throws URISyntaxException { List<RemoteConfig> allRemoteConfigs = RemoteConfig.getAllRemoteConfigs(config); for (RemoteConfig rc : allRemoteConfigs) { if (rc.getName().equals(remoteName)) remoteConfig = rc; } }
/** * {@inheritDoc} * <p> * Executes the {@code remote} command with all the options and parameters * collected by the setter methods of this class. */ @Override public List<RemoteConfig> call() throws GitAPIException { checkCallable(); try { return RemoteConfig.getAllRemoteConfigs(repo.getConfig()); } catch (URISyntaxException e) { throw new JGitInternalException(e.getMessage(), e); } }
/** * Executes the {@code remote} command with all the options and parameters * collected by the setter methods of this class. * * @return a list of {@link RemoteConfig} objects. */ @Override public List<RemoteConfig> call() throws GitAPIException { checkCallable(); try { return RemoteConfig.getAllRemoteConfigs(repo.getConfig()); } catch (URISyntaxException e) { throw new JGitInternalException(e.getMessage(), e); } }
/** * Validates the remote repository URL. * * @param value value to validate. * @return {@link FormValidation}. * @throws java.io.IOException IOException. * @throws javax.servlet.ServletException ServletException. */ public FormValidation doCheckRepositoryUrl(@QueryParameter String value) throws IOException, ServletException { if (StringUtils.isEmpty(value)) { return FormValidation.error( hudson.plugins.git.Messages.GitSCM_Repository_IncorrectRepositoryFormatMsg()); } Config repoConfig = new Config(); repoConfig.setString("remote", GitUtils.DEFAULD_REPO_NAME, "url", value); try { RemoteConfig.getAllRemoteConfigs(repoConfig); } catch (Exception e) { return FormValidation.error( hudson.plugins.git.Messages.GitSCM_Repository_IncorrectRepositoryFormatMsg() + ": " + e.getMessage()); } return FormValidation.ok(); }
private RemoteConfig newRemoteConfig(String name, String refUrl, RefSpec... refSpec) { try { Config repoConfig = new Config(); // Make up a repo config from the request parameters repoConfig.setString("remote", name, "url", refUrl); List<String> str = new ArrayList<>(); if(refSpec != null && refSpec.length > 0) for (RefSpec rs: refSpec) str.add(rs.toString()); repoConfig.setStringList("remote", name, "fetch", str); return RemoteConfig.getAllRemoteConfigs(repoConfig).get(0); } catch (Exception ex) { throw new GitException("Error trying to create JGit configuration", ex); } }
protected FetchResult doRemoteUpdate() throws IOException { List<RemoteConfig> remoteConfig = null; try { LOGGER.debug("Fetching remote configurations from repository configuration"); remoteConfig = RemoteConfig.getAllRemoteConfigs(repository.getConfig()); } catch (URISyntaxException e) { throw new ScmException(e); } LOGGER.debug("Opening transport to {}", remoteConfig.get(0).getName()); Transport transport = Transport.open(repository, remoteConfig.get(0)); try { LOGGER.debug("Fetching content from remote repository"); return transport.fetch(NullProgressMonitor.INSTANCE, null); } finally { if (transport != null) { transport.close(); } } }
public static List<RemoteConfig> createRepositoryConfigurations(String[] urls, String[] repoNames, String[] refs) throws IOException { List<RemoteConfig> remoteRepositories; Config repoConfig = new Config(); // Make up a repo config from the request parameters String[] names = repoNames; names = GitUtils.fixupNames(names, urls); for (int i = 0; i < names.length; i++) { String url = urls[i]; if (url == null) { continue; } String name = names[i]; name = name.replace(' ', '_'); if (isBlank(refs[i])) { refs[i] = "+refs/heads/*:refs/remotes/" + name + "/*"; } repoConfig.setString("remote", name, "url", url); repoConfig.setStringList("remote", name, "fetch", new ArrayList<>(Arrays.asList(refs[i].split("\\s+")))); } try { remoteRepositories = RemoteConfig.getAllRemoteConfigs(repoConfig); } catch (Exception e) { throw new GitException("Error creating repositories", e); } return remoteRepositories; }
private SimplePushRefWizard(Repository repo, ObjectId objectId, String name, String title) throws URISyntaxException { final List<RemoteConfig> remotes = RemoteConfig .getAllRemoteConfigs(repo.getConfig()); this.nicePushName = name; this.pushObj = objectId; this.repo = repo; repoPage = new RepositorySelectionPage(false, remotes, null); targetPage = new SimplePushSpecPage(nicePushName, repo) { @Override public void setVisible(boolean visible) { super.setVisible(visible); if (visible) try { if (assist != null && assist.getRepository().equals( SimplePushRefWizard.this.repo) && assist.getRemoteURI().equals( repoPage.getSelection().getURI(true))) return; assist = new RefContentAssistProvider( SimplePushRefWizard.this.repo, repoPage .getSelection().getURI(true), getShell()); } finally { updateDestinationField(); } } }; setWindowTitle(title); }
/** * Create wizard for provided local repository. * * @param localDb * local repository to fetch to. * @throws URISyntaxException * when configuration of this repository contains illegal URIs. */ public FetchWizard(final Repository localDb) throws URISyntaxException { this.localDb = localDb; final List<RemoteConfig> remotes = RemoteConfig .getAllRemoteConfigs(localDb.getConfig()); repoPage = new RepositorySelectionPage(true, remotes, null); refSpecPage = new RefSpecPage(localDb, false) { @Override public void setVisible(boolean visible) { if (visible) { setSelection(repoPage.getSelection()); setCredentials(repoPage.getCredentials()); } super.setVisible(visible); } }; // TODO use/create another cool icon setDefaultPageImageDescriptor(UIIcons.WIZBAN_IMPORT_REPO); setNeedsProgressMonitor(true); }
allRemotes = RemoteConfig.getAllRemoteConfigs(repository .getConfig()); } catch (URISyntaxException e) {
allRemotes = RemoteConfig.getAllRemoteConfigs(repository .getConfig()); } catch (URISyntaxException e) {
for (RemoteConfig rc : RemoteConfig.getAllRemoteConfigs(repository .getConfig())) { if (rc.getURIs().size() > 0)
for (RemoteConfig rc : RemoteConfig.getAllRemoteConfigs(repository .getConfig())) { if (rc.getURIs().size() > 0)
this.localDb = localDb; final List<RemoteConfig> remotes = RemoteConfig .getAllRemoteConfigs(localDb.getConfig()); repoPage = new RepositorySelectionPage(false, remotes, null); repoPage.setHelpContext(HELP_CONTEXT);