public static List<RemoteConfig> createRepositoryConfigurations(String[] pUrls, String[] repoNames, String[] refSpecs) throws IOException { File temp = File.createTempFile("tmp", "config"); try { return createRepositoryConfigurations(pUrls, repoNames, refSpecs, temp); } finally { temp.delete(); } }
@Deprecated public static List<RemoteConfig> createRepositoryConfigurations(String[] urls, String[] repoNames, String[] refSpecs) throws IOException, FormException { return createRepositoryConfigurations(urls, repoNames, refSpecs, new String[]{""}); }
private void updateFromUserData() throws GitException { // do what newInstance used to do directly from the request data if (userRemoteConfigs == null) { return; /* Prevent NPE when no remote config defined */ } try { String[] pUrls = new String[userRemoteConfigs.size()]; String[] repoNames = new String[userRemoteConfigs.size()]; String[] refSpecs = new String[userRemoteConfigs.size()]; for (int i = 0; i < userRemoteConfigs.size(); ++i) { pUrls[i] = userRemoteConfigs.get(i).getUrl(); repoNames[i] = userRemoteConfigs.get(i).getName(); refSpecs[i] = userRemoteConfigs.get(i).getRefspec(); } this.remoteRepositories = DescriptorImpl.createRepositoryConfigurations(pUrls, repoNames, refSpecs); // TODO: replace with new repositories } catch (IOException e1) { throw new GitException("Error creating repositories", e1); } }
public SCM newInstance(StaplerRequest req, JSONObject formData) throws FormException { List<RemoteConfig> remoteRepositories; try { remoteRepositories = createRepositoryConfigurations(req.getParameterValues("git.repo.url"), req.getParameterValues("git.repo.name"), req.getParameterValues("git.repo.refspec"));
public SCM newInstance(StaplerRequest req, JSONObject formData) throws FormException { List<RemoteConfig> remoteRepositories; try { remoteRepositories = createRepositoryConfigurations(req.getParameterValues("git.repo.url"), req.getParameterValues("git.repo.name"), req.getParameterValues("git.repo.refspec"),
/** * A convenience constructor that sets everything to default. * * @param repositoryUrl Repository URL to clone from. * @throws java.io.IOException exception. */ public GitSCM(String repositoryUrl) throws IOException { this( DescriptorImpl.createRepositoryConfigurations(new String[]{repositoryUrl}, new String[]{null}, new String[]{null}), Collections.singletonList(new BranchSpec("")), new PreBuildMergeOptions(), false, Collections.<SubmoduleConfig>emptyList(), false, false, new DefaultBuildChooser(), null, null, false, null, null, null, null, false, false, null, null, false); }
/** * A convenience constructor that sets everything to default. * * @param repositoryUrl Repository URL to clone from. * @throws java.io.IOException exception. */ public GitSCM(String repositoryUrl) throws IOException, Descriptor.FormException { this( DescriptorImpl.createRepositoryConfigurations(new String[]{repositoryUrl}, new String[]{null}, new String[]{null}), Collections.singletonList(new BranchSpec("")), new PreBuildMergeOptions(), false, Collections.<SubmoduleConfig>emptyList(), false, false, new DefaultBuildChooser(), null, null, false, null, null, null, false, false, false, null, null, false, null, false); }