@Override public String[] getResourceListing(String path) { ArrayList<String> res = new ArrayList<String>(); try { return listEntries(res, path).toArray(new String[res.size()]); } catch (SVNException e) { e.printStackTrace(); } return null; }
@Override public InputStream getFileStream(String filePath) { String stringRepr; try { stringRepr = readFile(filePath); InputStream in = new ByteArrayInputStream(stringRepr.getBytes()); return in; } catch (SVNException e) { e.printStackTrace(); } return null; } }
public boolean testSVNConnection(String svnURL,String svnUser,String svnPass){ DAVRepositoryFactory.setup(); String url="https://your_svn_host/path/"; String name="username"; String password="password"; SVNRepository repository = null; try { repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(url)); ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(name, password); repository.setAuthenticationManager(authManager); repository.testConnection(); System.out.println("Connection done.."); return true; } catch (SVNException e){ System.out.println("Not connected"); e.printStackTrace(); return false; } }
} else { listener.getLogger().println("Checking out a fresh workspace because Hudson failed to detect the current workspace "+module); e.printStackTrace(listener.error(e.getMessage()));
} else { listener.getLogger().println("Checking out a fresh workspace because Hudson failed to detect the current workspace "+module); e.printStackTrace(listener.error(e.getMessage()));
} else { listener.getLogger().println("Checking out a fresh workspace because Hudson failed to detect the current workspace "+module); e.printStackTrace(listener.error(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(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(); } }
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(); } }
private SVNRepository setupRepo(String _path) throws RepoMismatchException { // Set repository for given URL (+ trunk or tag suffix) String tmp = null; // Build repository URL (incl. path) if(_path==null) tmp = this.url.toString(); else tmp = this.url.toString() + (this.url.toString().endsWith("/") ? "" : "/") + _path; SVNRepository repo = null; try { SVNURL url = SVNURL.parseURIEncoded(tmp); //SVN2Client.log.debug("Environment proxy (host:port): " + System.getProperty("http.proxyHost") + ":" + System.getProperty("http.proxyPort")); SvnClient.log.info("SVNKIT proxy configuration (host:port): " + authManager.getProxyManager(url).getProxyHost() + ":" + authManager.getProxyManager(url).getProxyPort()); repo = SVNRepositoryFactory.create(url); repo.setAuthenticationManager(authManager); repo.testConnection(); } catch(SVNException e) { e.printStackTrace(); throw new RepoMismatchException(this, tmp, e); // "Cannot create SVN repository from URL '" + tmp + "': " + e.getMessage()); } return repo; }
dst, false, true, false, comment, null); } catch (SVNException x) { x.printStackTrace(listener.error("Failed to tag")); return;
public SVNConnector build(String login, String pass) { if (repository == null) { DAVRepositoryFactory.setup(); SVNURL url; try { url = SVNURL.parseURIDecoded(SVNURI + SVNTestRepo); repository = SVNRepositoryFactory.create(url, null); } catch (SVNException e1) { e1.printStackTrace(); } } ISVNAuthenticationManager authManager = new BasicAuthenticationManager(login, pass); repository.setAuthenticationManager(authManager); return instance; }
public static void main(String[] args) { ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager("admin", "john"); SVNClientManager manager = SVNClientManager.newInstance(); manager.setAuthenticationManager(authManager); SVNCommitClient commitClient = SVNClientManager.newInstance().getCommitClient(); try { SVNCommitInfo info = commitClient.doMkDir(new SVNURL[] { SVNURL.parseURIEncoded("http://192.168.3.127/repository/koux/branches") }, "commitMessage", null, true); long newRevision = info.getNewRevision(); System.out.println(newRevision); } catch (SVNException e) { e.printStackTrace(); } }
public static void main(String[] args) { ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager("admin", "john"); SVNClientManager manager = SVNClientManager.newInstance(); manager.setAuthenticationManager(authManager); SVNCommitClient commitClient = SVNClientManager.newInstance().getCommitClient(); try { SVNCommitInfo info = commitClient.doMkDir(new SVNURL[] { SVNURL.parseURIEncoded("http://192.168.3.127/repository/koux/trunk") }, "commitMessage", null, true); long newRevision = info.getNewRevision(); System.out.println(newRevision); } catch (SVNException e) { e.printStackTrace(); } }
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(); } }
private SVNURL getOwnerURL(File root) { if (root != null && SVNFileType.getType(root) == SVNFileType.DIRECTORY) { SVNWCAccess access = createWCAccess(); try { access.open(root, false, 0); SVNEntry entry = access.getVersionedEntry(root, false); if (entry != null) { return entry.getSVNURL(); } } catch (SVNException e) { e.printStackTrace(); } finally { if (access != null) { try { access.close(); } catch (SVNException e) { } } } } return null; }
private SVNURL getOwnerURL(File root) { if (root != null && SVNFileType.getType(root) == SVNFileType.DIRECTORY) { SVNWCAccess access = createWCAccess(); try { access.open(root, false, 0); SVNEntry entry = access.getVersionedEntry(root, false); if (entry != null) { return entry.getSVNURL(); } } catch (SVNException e) { e.printStackTrace(); } finally { if (access != null) { try { access.close(); } catch (SVNException e) { } } } } return null; }
private SVNURL getOwnerURL(File root) { if (root != null && SVNFileType.getType(root) == SVNFileType.DIRECTORY) { SVNWCAccess access = createWCAccess(); try { access.open(root, false, 0); SVNEntry entry = access.getVersionedEntry(root, false); if (entry != null) { return entry.getSVNURL(); } } catch (SVNException e) { e.printStackTrace(); } finally { if (access != null) { try { access.close(); } catch (SVNException e) { } } } } return null; }
static List<Change> getChangesFromSubversion(@SuppressWarnings("rawtypes") AbstractBuild build, final Runner runner, SubversionSCM scm, final String remoteDebian, String latestRevision, String currentRevision, final String ourMessage) throws DebianizingException { final List<Change> result = new ArrayList<Change>(); ModuleLocation location = findOurLocation(build, scm, runner, remoteDebian); ISVNAuthenticationProvider authenticationProvider = ((SubversionSCM)build.getProject().getScm()).createAuthenticationProvider(build.getProject(), location); SvnClientManager manager = SubversionSCM.createClientManager(authenticationProvider); try { SVNURL svnurl = location.getSVNURL(); manager.getLogClient().doLog(svnurl, null, SVNRevision.UNDEFINED, SVNRevision.create(Long.parseLong(latestRevision) + 1), SVNRevision.parse(currentRevision), false, true, 0, new ISVNLogEntryHandler() { @Override public void handleLogEntry(SVNLogEntry logEntry) throws SVNException { if (!logEntry.getMessage().equals(ourMessage)) { result.add(new Change(logEntry.getAuthor(), logEntry.getMessage())); } } }); } catch (SVNException e) { e.printStackTrace(); throw new DebianizingException("SVNException: " + e.getMessage(), e); } finally { manager.dispose(); } return result; }
public PathContext invoke(File p, VirtualChannel channel) throws IOException { final SvnClientManager manager = SubversionSCM.createClientManager(authProvider); try { final SVNWCClient svnwc = manager.getWCClient(); SVNInfo info; try { info = svnwc.doInfo(p, SVNRevision.WORKING); String url = info.getURL().toDecodedString(); String repoRoot = info.getRepositoryRootURL().toDecodedString(); return new PathContext(url, repoRoot, null); } catch (SVNException e) { e.printStackTrace(); return null; } } finally { manager.dispose(); } }