public void setGlobalCharset(String charset) { setPropertyValue(GLOBAL_CHARSET, charset); }
public void setGlobalCharset(String charset) { setPropertyValue(GLOBAL_CHARSET, charset); }
public SvnConnection(String address, String pathToLocalRepos) throws SVNException { if(log.isDebugEnabled()) { log.debug("SVN repository"); } if (address.lastIndexOf('/') != -1){ svnPath = address.substring(0, address.lastIndexOf('/')); fileName = address.substring(address.lastIndexOf('/') + 1); } addressSvn = address; remoteUrl = SVNURL.parseURIEncoded(svnPath); authManager = SVNWCUtil.createDefaultAuthenticationManager(); svnOption = SVNWCUtil.createDefaultOptions(false); svnOption.setPropertyValue(SVNProperty.EOL_STYLE, SVNProperty.EOL_STYLE_LF); manager = SVNClientManager.newInstance(svnOption, authManager); this.pathToLocalRepos = pathToLocalRepos; }
@Override public String getHeadRevisionNumber(String path, String username, String password) throws AuthenticationException { if (log.isDebugEnabled()) { log.debug("headRevisionNumber expected " + addressSvn + " ; got " + path); } ISVNAuthenticationManager svnAuthManager = SVNWCUtil.createDefaultAuthenticationManager(username, password); DefaultSVNOptions svnOptions = new DefaultSVNOptions(); svnOptions.setPropertyValue(SVNProperty.EOL_STYLE, SVNProperty.EOL_STYLE_LF); SVNWCClient wcClient = new SVNWCClient(svnAuthManager, svnOptions); SVNInfo info = null; try { info = wcClient.doInfo(SVNURL.parseURIEncoded(path), SVNRevision.HEAD, SVNRevision.HEAD); } catch (SVNAuthenticationException e) { throw new AuthenticationException("Auth fail"); } catch (SVNException e) { if (log.isErrorEnabled()) { log.error("Can not get info from SVN repository", e); } } String headRevision = ""; if (info != null) { headRevision = info.getRevision().toString(); } return headRevision; }
/** * Gives the name of the person who made the last commit * @param address the repository's address * @param login the username to use to connect to the repository * @param password the password to use to connect to the repository * @return the name of the person who made the last commit * @throws SVNException if there is a problem while accessing the repository */ public String getHeadcommiter(String address, String login, String password) throws SVNException { ISVNAuthenticationManager svnAuthManager = SVNWCUtil.createDefaultAuthenticationManager(login, password); DefaultSVNOptions svnOptions = new DefaultSVNOptions(); svnOptions.setPropertyValue(SVNProperty.EOL_STYLE, SVNProperty.EOL_STYLE_LF); SVNWCClient wcClient = new SVNWCClient(svnAuthManager, svnOptions); SVNInfo info = wcClient.doInfo(SVNURL.parseURIEncoded(address), SVNRevision.HEAD, SVNRevision.HEAD); String headAuthor = info.getAuthor(); return headAuthor; }