private URL getResultFromNamedRepository(GitChangeSet changeSet) throws MalformedURLException { GitSCM scm = getScmFromProject(changeSet); return new URL(scm.getRepositoryByName(getRepoUrl()).getURIs().get(0).toString()); }
public Boolean invoke(File workspace, VirtualChannel channel) throws IOException { IGitAPI git = new GitAPI(gitExe, new FilePath(workspace), listener, environment); RemoteConfig remote = gitSCM.getRepositoryByName(targetRepo); if (remote == null) { listener.getLogger() .println("No repository found for target repo name " + targetRepo); return false; } listener.getLogger().println("Pushing HEAD to branch " + branchName + " at repo " + targetRepo); git.push(remote, "HEAD:" + branchName); return true; } });
public FormValidation doCheckRemote( @AncestorInPath AbstractProject project, StaplerRequest req) throws IOException, ServletException { String remote = req.getParameter("value"); boolean isMerge = req.getParameter("isMerge") != null; // Added isMerge because we don't want to allow empty remote names // for tag/branch pushes. if (remote.length() == 0 && isMerge) return FormValidation.ok(); FormValidation validation = checkFieldNotEmpty(remote, Messages.GitPublisher_Check_RemoteName()); if (validation.kind != FormValidation.Kind.OK) return validation; if (!(project.getScm() instanceof GitSCM)) { return FormValidation.warning("Project not currently configured to use Git; cannot check remote repository"); } GitSCM scm = (GitSCM) project.getScm(); if (scm.getRepositoryByName(remote) == null) return FormValidation .error("No remote repository configured with name '" + remote + "'"); return FormValidation.ok(); }
RemoteConfig remote = scm.getRepositoryByName(value); if (remote == null) return FormValidation.errorWithMarkup("There is no remote with the name <tt>" + value + "</tt>");
public Boolean invoke(File workspace, VirtualChannel channel) throws IOException { IGitAPI git = new GitAPI(gitExe, new FilePath(workspace), listener, environment); try { RemoteConfig remote = gitSCM.getRepositoryByName(targetRepo); if (remote == null) { listener.getLogger() .println("No repository found for target repo name " + targetRepo); return false; } listener.getLogger().println("Pushing HEAD to branch " + branchName + " at repo " + targetRepo); git.push(remote, "HEAD:" + branchName); } finally { git.close(); } return true; } });
public Boolean invoke(File workspace, VirtualChannel channel) throws IOException { IGitAPI git = new GitAPI(gitExe, new FilePath(workspace), listener, environment); RemoteConfig remote = gitSCM.getRepositoryByName(targetRepo); if (remote == null) { listener.getLogger() .println("No repository found for target repo name " + targetRepo); return false; } if (t.isCreateTag()) { if (git.tagExists(tagName)) { listener.getLogger() .println("Tag " + tagName + " already exists and Create Tag is specified, so failing."); return false; } git.tag(tagName, "Hudson Git plugin tagging with " + tagName); } else if (!git.tagExists(tagName)) { listener.getLogger() .println("Tag " + tagName + " does not exist and Create Tag is not specified, so failing."); return false; } listener.getLogger().println("Pushing tag " + tagName + " to repo " + targetRepo); git.push(remote, tagName); return true; } });
listener, environment); try { RemoteConfig remote = gitSCM.getRepositoryByName(targetRepo);
RemoteConfig remote = gitSCM.getRepositoryByName(t.getTargetRepoName()); RemoteConfig remote = gitSCM.getRepositoryByName(b.getTargetRepoName()); RemoteConfig remote = gitSCM.getRepositoryByName(b.getTargetRepoName());