org.tmatesoft.svn.core.wc.SVNWCUtil Java Examples

The following examples show how to use org.tmatesoft.svn.core.wc.SVNWCUtil. 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: SvnKitProcessor.java    From StatSVN with GNU Lesser General Public License v3.0 6 votes vote down vote up
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 #2
Source File: SvnUtil.java    From scava with Eclipse Public License 2.0 6 votes vote down vote up
public static SVNRepository connectToSVNInstance(String url, String usr, String pass){
	SvnUtil.setupLibrary();
    SVNRepository repository = null;
    try {
    	repository = SvnUtil.createRepository(url);
    } 
    catch (SVNException svne) {
        System.err.println("error while creating an SVNRepository for location '"+ url + "': " + svne.getMessage());
        return null;
    }
    
    ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(usr, pass);
    repository.setAuthenticationManager(authManager);
    
    try {
    	SvnUtil.verifySVNLocation(repository, url);
	} catch (SVNException e) {
		e.printStackTrace();
	}
    
    return repository;
}
 
Example #3
Source File: TestCheckOut.java    From klask-io with GNU General Public License v3.0 5 votes vote down vote up
public void checkoutTest() throws SVNException {
    String checkoutPath = "svn://localhost";
    String username = "integration";
    String password = "integration";
    String checkoutRootPath = new File("/home/jeremie/Developpement/checkoutsvn").getAbsolutePath();

    DAVRepositoryFactory.setup();

    final SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(checkoutPath));
    repository.setAuthenticationManager(SVNWCUtil.createDefaultAuthenticationManager(username, password));

    final SVNClientManager clientManager = SVNClientManager.newInstance(null, repository.getAuthenticationManager());
    final SVNUpdateClient updateClient = clientManager.getUpdateClient();

    updateClient.setIgnoreExternals(false);

    final SVNNodeKind nodeKind = repository.checkPath("", -1);

    if (nodeKind == SVNNodeKind.NONE) {
        System.err.println("There is no entry at '" + checkoutPath + "'.");
        System.exit(1);
    } else if (nodeKind == SVNNodeKind.FILE) {
        System.err.println("The entry at '" + checkoutPath + "' is a file while a directory was expected.");
        System.exit(1);
    }
    System.out.println("*** CHECKOUT SVN Trunk/Branches ***");
    System.out.println("Checkout source: " + checkoutPath);
    System.out.println("Checkout destination: " + checkoutRootPath);
    System.out.println("...");
    try {
        traverse(updateClient, repository, checkoutPath, checkoutRootPath, "", true);
    } catch (final Exception e) {
        System.err.println("ERROR : " + e.getMessage());
        e.printStackTrace(System.err);
        System.exit(-1);
    }
    System.out.println("");
    System.out.println("Repository latest revision: " + repository.getLatestRevision());
}
 
Example #4
Source File: SvnUtil.java    From scava with Eclipse Public License 2.0 4 votes vote down vote up
public static void authenticate(String usr, String pass, SVNRepository repo){
	ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(usr, pass);
    repo.setAuthenticationManager(authManager);
}