org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions Java Examples
The following examples show how to use
org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SvnKitUtil.java From Jpom with MIT License | 6 votes |
/** * SVN检出 * * @param userName 用户名 * @param userPwd 密码 * @param svnPath 仓库路径 * @param targetPath 目录 * @return Boolean * @throws SVNException svn */ public static String checkOut(String svnPath, String userName, String userPwd, File targetPath) throws SVNException { DefaultSVNOptions options = SVNWCUtil.createDefaultOptions(true); // 实例化客户端管理类 SVNClientManager ourClientManager = SVNClientManager.newInstance(options, userName, userPwd); try { if (targetPath.exists()) { if (!FileUtil.file(targetPath, SVNFileUtil.getAdminDirectoryName()).exists()) { FileUtil.del(targetPath); } else { // 判断url是否变更 if (!checkUrl(targetPath, svnPath, userName, userPwd)) { FileUtil.del(targetPath); } else { ourClientManager.getWCClient().doCleanup(targetPath); } } } return checkOut(ourClientManager, svnPath, targetPath); } finally { ourClientManager.dispose(); } }
Example #2
Source File: SvnKitProcessor.java From StatSVN with GNU Lesser General Public License v3.0 | 6 votes |
public SVNClientManager getManager() { if (manager==null) { // initialize DAVRepositoryFactory.setup(); SVNRepositoryFactoryImpl.setup(); FSRepositoryFactory.setup(); //readonly - configuration options are available only for reading DefaultSVNOptions options = SVNWCUtil.createDefaultOptions(true); options.setAuthStorageEnabled(false); // Creates an instance of SVNClientManager providing an options driver & username & password if (SvnConfigurationOptions.getSvnUsername()!=null && SvnConfigurationOptions.getSvnPassword()!=null) manager = SVNClientManager.newInstance(options, SvnConfigurationOptions.getSvnUsername(), SvnConfigurationOptions.getSvnPassword()); else manager = SVNClientManager.newInstance(options); } return manager; }
Example #3
Source File: SvnKitUtil.java From Jpom with MIT License | 5 votes |
/** * 判断当前仓库url是否匹配 * * @param wcDir 仓库路径 * @param url url * @param userName 用户名 * @param userPwd 密码 * @return true 匹配 * @throws SVNException 异常 */ private static Boolean checkUrl(File wcDir, String url, String userName, String userPwd) throws SVNException { ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(userName, userPwd.toCharArray()); DefaultSVNOptions options = SVNWCUtil.createDefaultOptions(true); // 实例化客户端管理类 SVNClientManager clientManager = SVNClientManager.newInstance(options, authManager); try { // 通过客户端管理类获得updateClient类的实例。 SVNWCClient wcClient = clientManager.getWCClient(); SVNInfo svnInfo = null; do { try { svnInfo = wcClient.doInfo(wcDir, SVNRevision.HEAD); } catch (SVNException svn) { if (svn.getErrorMessage().getErrorCode() == SVNErrorCode.FS_NOT_FOUND) { checkOut(clientManager, url, wcDir); } else { throw svn; } } } while (svnInfo == null); String reUrl = svnInfo.getURL().toString(); return reUrl.equals(url); } finally { clientManager.dispose(); } }
Example #4
Source File: SvnTestServer.java From git-as-svn with GNU General Public License v2.0 | 5 votes |
@NotNull private SvnOperationFactory createOperationFactory(@NotNull String username, @NotNull String password) { final SVNWCContext wcContext = new SVNWCContext(new DefaultSVNOptions(getTempDirectory().toFile(), true), null); wcContext.setSqliteTemporaryDbInMemory(true); wcContext.setSqliteJournalMode(SqlJetPagerJournalMode.MEMORY); final SvnOperationFactory factory = new SvnOperationFactory(wcContext); factory.setAuthenticationManager(BasicAuthenticationManager.newInstance(username, password.toCharArray())); svnFactories.add(factory); return factory; }