public List<External> invoke(File ws, VirtualChannel channel) throws IOException { manager = createSvnClientManager(authProvider); this.ws = ws; try { List<External> externals = perform(); checkClockOutOfSync(); return externals; } catch (InterruptedException e) { throw (InterruptedIOException) new InterruptedIOException().initCause(e); } finally { manager.dispose(); } }
/** * Creates {@link SVNClientManager} for code running on the master. * <p> * CAUTION: this code only works when invoked on master. On slaves, use * {@link #createSvnClientManager(ISVNAuthenticationProvider)} and get {@link ISVNAuthenticationProvider} * from the master via remoting. */ public static SvnClientManager createClientManager(AbstractProject context) { return new SvnClientManager(createSvnClientManager(descriptor().createAuthenticationProvider(context))); }
/** * Gets the SVN metadata for the remote repository. * * @param remoteUrl The target to run "svn info". */ private static SVNInfo parseSvnInfo(SVNURL remoteUrl, ISVNAuthenticationProvider authProvider) throws SVNException { final SVNClientManager manager = createSvnClientManager(authProvider); try { final SVNWCClient svnWc = manager.getWCClient(); return svnWc.doInfo(remoteUrl, SVNRevision.HEAD, SVNRevision.HEAD); } finally { manager.dispose(); } }
/** * Creates {@link SVNClientManager} for code running on the master. * <p/> * CAUTION: this code only works when invoked on master. On slaves, use * {@link #createSvnClientManager(ISVNAuthenticationProvider)} and get {@link ISVNAuthenticationProvider} * from the master via remoting. */ public static SVNClientManager createSvnClientManager(AbstractProject context) { return createSvnClientManager( Hudson.getInstance().getDescriptorByType(DescriptorImpl.class).createAuthenticationProvider(context)); }
/** * Creates {@link SVNClientManager} for code running on the master. * <p/> * CAUTION: this code only works when invoked on master. On slaves, use * {@link #createSvnClientManager(ISVNAuthenticationProvider)} and get {@link ISVNAuthenticationProvider} * from the master via remoting. */ public static SVNClientManager createSvnClientManager(AbstractProject context) { return createSvnClientManager( Hudson.getInstance().getDescriptorByType(DescriptorImpl.class).createAuthenticationProvider(context)); }
public List<External> invoke(File ws, VirtualChannel channel) throws IOException, InterruptedException { manager = createSvnClientManager(authProvider); this.ws = ws; try { List<External> externals = perform(); checkClockOutOfSync(); return externals; } finally { manager.dispose(); } }
/** * Gets the SVN metadata for the remote repository. * * @param remoteUrl The target to run "svn info". */ private static SVNInfo parseSvnInfo(SVNURL remoteUrl, ISVNAuthenticationProvider authProvider) throws SVNException { final SVNClientManager manager = createSvnClientManager(authProvider); try { final SVNWCClient svnWc = manager.getWCClient(); return svnWc.doInfo(remoteUrl, SVNRevision.HEAD, SVNRevision.HEAD); } finally { manager.dispose(); } }
public Void invoke(File ws, VirtualChannel channel) throws IOException, InterruptedException { File workingCopy = new File(ws, location.getLocalDir()).getCanonicalFile(); try { SVNURL svnUrl = SVNURL.parseURIEncoded(tagUrl); SVNCopyClient copyClient; try { copyClient = SubversionSCM.createClientManager(authProvider).getCopyClient(); } catch (NoSuchMethodError e) { //todo remove when backward compatibility not needed //fallback for older versions of org.jenkins-ci.plugins:subversion buildListener.getLogger().println( "[RELEASE] You are using an old subversion jenkins plugin, please consider upgrading."); copyClient = SubversionSCM.createSvnClientManager(authProvider).getCopyClient(); } buildListener.getLogger().println("[RELEASE] Creating subversion tag: " + tagUrl); SVNCopySource source = new SVNCopySource(SVNRevision.WORKING, SVNRevision.WORKING, workingCopy); SVNCommitInfo commitInfo = copyClient.doCopy(new SVNCopySource[]{source}, svnUrl, false, true, true, commitMessage, new SVNProperties()); SVNErrorMessage errorMessage = commitInfo.getErrorMessage(); if (errorMessage != null) { throw new IOException("Failed to create tag: " + errorMessage.getFullMessage()); } return null; } catch (SVNException e) { debuggingLogger.log(Level.FINE, "Failed to create tag", e); throw new IOException("Subversion tag creation failed: " + e.getMessage()); } } }
public Map<String, SvnInfo> invoke(File ws, VirtualChannel channel) throws IOException { Map<String/*module name*/, SvnInfo> revisions = new HashMap<String, SvnInfo>(); final SVNClientManager manager = createSvnClientManager(authProvider); try { final SVNWCClient svnWc = manager.getWCClient(); // invoke the "svn info" for (ModuleLocation module : locations) { try { SvnInfo info = new SvnInfo( svnWc.doInfo(new File(ws, module.getLocalDir()), SVNRevision.WORKING)); revisions.put(info.url, info); } catch (SVNException e) { e.printStackTrace(listener.error("Failed to parse svn info for " + module.remote)); } } for (External ext : externals) { try { SvnInfo info = new SvnInfo(svnWc.doInfo(new File(ext.path), SVNRevision.WORKING)); revisions.put(info.url, info); } catch (SVNException e) { e.printStackTrace( listener.error("Failed to parse svn info for external " + ext.url + " at " + ext.path)); } } return revisions; } finally { manager.dispose(); } }
final SVNClientManager cm = upc!=null ? SVNClientManager.newInstance(SVNWCUtil.createDefaultOptions(true),upc.new AuthenticationManagerImpl(listener)) : SubversionSCM.createSvnClientManager(getBuild().getProject()); try { for (Entry<SvnInfo, String> e : tagSet.entrySet()) {
public Map<String, SvnInfo> invoke(File ws, VirtualChannel channel) throws IOException { Map<String/*module name*/, SvnInfo> revisions = new HashMap<String, SvnInfo>(); final SVNClientManager manager = createSvnClientManager(authProvider); try { final SVNWCClient svnWc = manager.getWCClient(); // invoke the "svn info" for (ModuleLocation module : locations) { try { SvnInfo info = new SvnInfo( svnWc.doInfo(new File(ws, module.getLocalDir()), SVNRevision.WORKING)); revisions.put(info.url, info); } catch (SVNException e) { e.printStackTrace(listener.error("Failed to parse svn info for " + module.remote)); } } for (External ext : externals) { try { SvnInfo info = new SvnInfo(svnWc.doInfo(new File(ws, ext.path), SVNRevision.WORKING)); revisions.put(info.url, info); } catch (SVNException e) { e.printStackTrace( listener.error("Failed to parse svn info for external " + ext.url + " at " + ext.path)); } } return revisions; } finally { manager.dispose(); } }
.newInstance(SVNWCUtil.createDefaultOptions(true), upc.new AuthenticationManagerImpl(listener)) : SubversionSCM.createSvnClientManager(getBuild() .getProject()); try {
public String invoke(File p, VirtualChannel channel) throws IOException { final SVNClientManager manager = SubversionSCM.createSvnClientManager(authProvider); try { final SVNWCClient svnwc = manager.getWCClient(); SVNInfo info; try { info = svnwc.doInfo(p, SVNRevision.WORKING); return info.getURL().toDecodedString(); } catch (SVNException e) { e.printStackTrace(); return null; } } finally { manager.dispose(); } }
public String invoke(File p, VirtualChannel channel) throws IOException { final SVNClientManager manager = SubversionSCM.createSvnClientManager(authProvider); try { final SVNWCClient svnwc = manager.getWCClient(); SVNInfo info; try { info = svnwc.doInfo(p, SVNRevision.WORKING); return info.getURL().toDecodedString(); } catch (SVNException e) { e.printStackTrace(); return null; } } finally { manager.dispose(); } }
/** * Checks it the revision range [from,to] has any changes that are not excluded via exclusions. */ public boolean findNonExcludedChanges(SVNURL url, long from, long to, ISVNAuthenticationProvider authProvider) throws SVNException { if (from > to) { return false; // empty revision range, meaning no change } // if no exclusion rules are defined, don't waste time going through "svn log". if (!hasExclusionRule()) { return true; } final SVNClientManager manager = createSvnClientManager(authProvider); try { manager.getLogClient().doLog(url, null, SVNRevision.UNDEFINED, SVNRevision.create(from), // get log entries from the local revision + 1 SVNRevision.create(to), // to the remote revision false, // Don't stop on copy. true, // Report paths. false, // Don't included merged revisions 0, // Retrieve log entries for unlimited number of revisions. null, // Retrieve all revprops this); } finally { manager.dispose(); } return isChangesFound(); }
/** * Checks it the revision range [from,to] has any changes that are not excluded via exclusions. */ public boolean findNonExcludedChanges(SVNURL url, long from, long to, ISVNAuthenticationProvider authProvider) throws SVNException { if (from > to) { return false; // empty revision range, meaning no change } // if no exclusion rules are defined, don't waste time going through "svn log". if (!hasExclusionRule()) { return true; } final SVNClientManager manager = createSvnClientManager(authProvider); try { manager.getLogClient().doLog(url, null, SVNRevision.UNDEFINED, SVNRevision.create(from), // get log entries from the local revision + 1 SVNRevision.create(to), // to the remote revision false, // Don't stop on copy. true, // Report paths. false, // Don't included merged revisions 0, // Retrieve log entries for unlimited number of revisions. null, // Retrieve all revprops this); } finally { manager.dispose(); } return isChangesFound(); }
public boolean run(Collection<SubversionSCM.External> externals, Result changeLog) throws IOException, InterruptedException { boolean changelogFileCreated = false; final SVNClientManager manager = SubversionSCM.createSvnClientManager(build.getProject()); try { SVNLogClient svnlc = manager.getLogClient(); TransformerHandler th = createTransformerHandler(); th.setResult(changeLog); SVNXMLLogHandler logHandler = new SVNXMLLogHandler(th); // work around for http://svnkit.com/tracker/view.php?id=175 th.setDocumentLocator(DUMMY_LOCATOR); logHandler.startDocument(); for (ModuleLocation l : scm.getLocations(build)) { changelogFileCreated |= buildModule(l.getURL(), svnlc, logHandler); } for(SubversionSCM.External ext : externals) { changelogFileCreated |= buildModule( getUrlForPath(build.getWorkspace().child(ext.path)), svnlc, logHandler); } if(changelogFileCreated) { logHandler.endDocument(); } return changelogFileCreated; } finally { manager.dispose(); } }
public boolean run(Collection<SubversionSCM.External> externals, Result changeLog) throws IOException, InterruptedException { boolean changelogFileCreated = false; final SVNClientManager manager = SubversionSCM.createSvnClientManager(build.getProject()); try { SVNLogClient svnlc = manager.getLogClient(); TransformerHandler th = createTransformerHandler(); th.setResult(changeLog); SVNXMLLogHandler logHandler = new SVNXMLLogHandler(th); // work around for http://svnkit.com/tracker/view.php?id=175 th.setDocumentLocator(DUMMY_LOCATOR); logHandler.startDocument(); for (ModuleLocation l : scm.getLocations(build)) { changelogFileCreated |= buildModule(l.getURL(), svnlc, logHandler); } for(SubversionSCM.External ext : externals) { changelogFileCreated |= buildModule( getUrlForPath(build.getWorkspace().child(ext.path)), svnlc, logHandler); } if(changelogFileCreated) { logHandler.endDocument(); } return changelogFileCreated; } finally { manager.dispose(); } }