Search in sources :

Example 6 with SvnOperationFactory

use of org.tmatesoft.svn.core.wc2.SvnOperationFactory in project omegat by omegat-org.

the class ConvertProject26to37team method getSVNUrl.

/**
 * Get repository URL for SVN.
 */
private static String getSVNUrl(File wc) throws Exception {
    final SvnOperationFactory of = new SvnOperationFactory();
    final SvnGetInfo infoOp = of.createGetInfo();
    infoOp.setSingleTarget(SvnTarget.fromFile(wc));
    infoOp.setDepth(SVNDepth.EMPTY);
    infoOp.setRevision(SVNRevision.WORKING);
    final SvnInfo info = infoOp.run();
    SVNURL svn = info.getUrl();
    return svn.toString();
}
Also used : SVNURL(org.tmatesoft.svn.core.SVNURL) SvnOperationFactory(org.tmatesoft.svn.core.wc2.SvnOperationFactory) SvnInfo(org.tmatesoft.svn.core.wc2.SvnInfo) SvnGetInfo(org.tmatesoft.svn.core.wc2.SvnGetInfo)

Example 7 with SvnOperationFactory

use of org.tmatesoft.svn.core.wc2.SvnOperationFactory in project scheduling by ow2-proactive.

the class PackageDownloader method downloadPackageFromGithub.

/**
 * This method downloads an entire github repository or only a sub-directory within a repository.<br>
 * It can also download and extract an archive version of a github repository.
 * It relies on svn export command.<br>
 *
 * @param githubURL
 * @return
 */
private String downloadPackageFromGithub(String githubURL) throws SVNException {
    // Convert the githubRL to an svn format
    String svnURL = transformGithubURLToSvnURL(githubURL);
    // Save files in a system temporary directory
    String tDir = System.getProperty("java.io.tmpdir");
    String packagePath = tDir + "pkg_tmp" + System.nanoTime();
    File outputDir = new File(packagePath);
    // Perform an "svn export" command to download an entire repository or a subdirectory
    final SvnOperationFactory svnOperationFactory = new SvnOperationFactory();
    try {
        final SvnExport export = svnOperationFactory.createExport();
        export.setSource(SvnTarget.fromURL(SVNURL.parseURIEncoded(svnURL)));
        export.setSingleTarget(SvnTarget.fromFile(outputDir));
        // overwrite an existing file
        export.setForce(true);
        export.run();
    } finally {
        // close connection pool associted with this object
        svnOperationFactory.dispose();
    }
    return packagePath;
}
Also used : SvnExport(org.tmatesoft.svn.core.wc2.SvnExport) SvnOperationFactory(org.tmatesoft.svn.core.wc2.SvnOperationFactory) File(java.io.File)

Example 8 with SvnOperationFactory

use of org.tmatesoft.svn.core.wc2.SvnOperationFactory in project GMM by Katharsas.

the class SVNTest method init.

// TODO when access to repository is not possible, any file uploads cannot be made and must be disabled.
// TODO when access to repository is not possible, file downloads must be disabled because the files could be outdated and the GMM woudn't know that.
public void init() throws SVNException {
    final ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager("(login name)", "(login password)".toCharArray());
    final SvnOperationFactory svnOperationFactory = new SvnOperationFactory();
    svnOperationFactory.setAuthenticationManager(authManager);
}
Also used : ISVNAuthenticationManager(org.tmatesoft.svn.core.auth.ISVNAuthenticationManager) SvnOperationFactory(org.tmatesoft.svn.core.wc2.SvnOperationFactory)

Aggregations

SvnOperationFactory (org.tmatesoft.svn.core.wc2.SvnOperationFactory)6 File (java.io.File)3 SvnCheckout (org.tmatesoft.svn.core.wc2.SvnCheckout)2 SvnGetInfo (org.tmatesoft.svn.core.wc2.SvnGetInfo)2 SvnInfo (org.tmatesoft.svn.core.wc2.SvnInfo)2 FileOutputStream (java.io.FileOutputStream)1 NotNull (org.jetbrains.annotations.NotNull)1 SVNException (org.tmatesoft.svn.core.SVNException)1 SVNURL (org.tmatesoft.svn.core.SVNURL)1 ISVNAuthenticationManager (org.tmatesoft.svn.core.auth.ISVNAuthenticationManager)1 SVNStatus (org.tmatesoft.svn.core.wc.SVNStatus)1 SvnCommit (org.tmatesoft.svn.core.wc2.SvnCommit)1 SvnExport (org.tmatesoft.svn.core.wc2.SvnExport)1 SvnUpdate (org.tmatesoft.svn.core.wc2.SvnUpdate)1