org.tmatesoft.svn.core.internal.io.fs.FSRepositoryFactory Java Examples

The following examples show how to use org.tmatesoft.svn.core.internal.io.fs.FSRepositoryFactory. 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: SubversionRepositoryInitializer.java    From Getaviz with Apache License 2.0 5 votes vote down vote up
public SVNRepository initRepository(boolean cached) throws SVNException, MalformedURLException {
	SVNRepository repo = null;
	SVNURL svnUrl = SVNURL.parseURIEncoded(url);
	if (url.startsWith(HTTP_SCHEME + SCHEME_SEPARATOR) || url.startsWith(HTTPS_SCHEME + SCHEME_SEPARATOR)) {
		DAVRepositoryFactory.setup();
		repo = DAVRepositoryFactory.create(svnUrl);
		repo.testConnection();
		if(cached) {
			TmpDirCreator tmpDirCreator = new TmpDirCreator(url);
			File tempDir = tmpDirCreator.getLocalTempDir();
			SVNURL cachedRepoPath = SVNURL.parseURIEncoded(FILE_SCHEME + SCHEME_SEPARATOR + tempDir);
			if(!tempDir.exists()){
				messageOutputStream.println("Caching subversion repository " + svnUrl + " This can take a while...");
				tempDir.mkdirs();
				cachedRepoPath = SVNRepositoryFactory.createLocalRepository(tempDir, true, true);
				tmpDirCreator.writeIdFileToTempDir();
				SVNRepository targetRepo = SVNRepositoryFactory.create(cachedRepoPath);
				SVNRepositoryReplicator replicator = SVNRepositoryReplicator.newInstance();
				replicator.setReplicationHandler(new ProgressBarReplicationHandler(repo.getLatestRevision()));
				replicator.replicateRepository(repo, targetRepo, -1, -1);
				messageOutputStream.println("\nCaching finished succesfully...");
			}
			svnUrl = cachedRepoPath;
			FSRepositoryFactory.setup();
			repo = FSRepositoryFactory.create(svnUrl);
		}
	} else if (url.startsWith(SVN_SCHEME + SCHEME_SEPARATOR)) {
		SVNRepositoryFactoryImpl.setup();
		repo = SVNRepositoryFactoryImpl.create(svnUrl);
	} else if (url.startsWith(FILE_SCHEME + SCHEME_SEPARATOR)) {
		FSRepositoryFactory.setup();
		repo = FSRepositoryFactory.create(svnUrl);
	} else
		throw new MalformedURLException(String.format("URL %s is not an supported SVN url!", url));
	repo.testConnection();
	return repo;
}
 
Example #3
Source File: SVNStatusCrawler.java    From celerio with Apache License 2.0 5 votes vote down vote up
public static SCMStatus doStatus(File baseDir) throws RuntimeException {
    // initialize SVNKit to work through file:/// protocol
    FSRepositoryFactory.setup();

    SVNClientManager clientManager = SVNClientManager.newInstance();
    SVNStatusClient statusClient = clientManager.getStatusClient();
    Map<String, Boolean> map = new HashMap<String, Boolean>();
    ISVNStatusHandler handler = new StatusHandler(baseDir, map);

    try {
        statusClient.doStatus(baseDir,
            SVNRevision.WORKING,
            SVNDepth.INFINITY,
            false /* remote */,
            true /* reportAll */,
            false /* includeIgnored */,
            false /* collectParentExternals */,
            handler, null);
    } catch (SVNException svne) {
        throw new RuntimeException(svne);
    }

    int counter = 0;
    for (Boolean b : map.values()) {
        if (b == Boolean.TRUE) {
            counter++;
        }
    }

    log.info("-----------------------------------------------------------------------------------------------");
    log.info("PROJECT IS UNDER SVN: Files tracked by svn ({}) won't be overwritten/deleted by Celerio", counter);
    log.info("-----------------------------------------------------------------------------------------------");

    return new SCMStatus(map);
}
 
Example #4
Source File: SvnUtil.java    From scava with Eclipse Public License 2.0 4 votes vote down vote up
public static void setupLibrary() {
    DAVRepositoryFactory.setup();
    SVNRepositoryFactoryImpl.setup();
    FSRepositoryFactory.setup();
}