当前位置: 首页>>代码示例>>Java>>正文


Java SVNClientManager类代码示例

本文整理汇总了Java中org.tmatesoft.svn.core.wc.SVNClientManager的典型用法代码示例。如果您正苦于以下问题:Java SVNClientManager类的具体用法?Java SVNClientManager怎么用?Java SVNClientManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SVNClientManager类属于org.tmatesoft.svn.core.wc包,在下文中一共展示了SVNClientManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doSvnDelete

import org.tmatesoft.svn.core.wc.SVNClientManager; //导入依赖的package包/类
public void doSvnDelete (
							String baseConfigUrl, List<File> filesToDelete,
							String scmUserid, String encodedPass,
							String svnBranch, String comment,
							BufferedWriter outputWriter )
		throws Exception {

	updateProgress( outputWriter, "Starting delete of files: " + filesToDelete );

	// if ( !fileToDelete.exists() ) {
	// updateProgress( outputWriter, "Skipping - file does not exist" );
	// logger.info( "File does not exist - do nothing" );
	// }
	SVNClientManager cm = buildSvnCredentials( scmUserid, encodedPass );
	SVNCommitClient svnCommitClient = cm.getCommitClient();

	// this will update output with files deleted
	svnCommitClient.setEventHandler( buildSvnEventHandler( "Removing: ", outputWriter ) );

	svnDelete( outputWriter, null, filesToDelete, baseConfigUrl, svnCommitClient, comment );
}
 
开发者ID:csap-platform,项目名称:csap-core,代码行数:22,代码来源:SourceControlManager.java

示例2: checkout

import org.tmatesoft.svn.core.wc.SVNClientManager; //导入依赖的package包/类
/**
 * @작성자 : KYJ
 * @작성일 : 2017. 12. 20.
 * @param absolutePath
 * @param pegrevision
 * @param revision
 * @param depth
 * @param outDir
 * @param exceptionHandler
 * @return
 * @throws Exception
 */
public Long checkout(SVNURL absolutePath, SVNRevision pegrevision, SVNRevision revision, SVNDepth depth, File outDir,
		ExceptionHandler exceptionHandler) throws Exception {
	long checkoutResult = -1;
	try {
		if (outDir == null || !outDir.exists())
			throw new FileNotFoundException("not support...");

		LOGGER.debug(absolutePath.toString());
		SVNClientManager svnManager = getSvnManager();

		checkoutResult = svnManager.getUpdateClient().doCheckout(absolutePath, outDir, pegrevision, revision, depth, false);
	} catch (Exception e) {
		if (exceptionHandler != null)
			exceptionHandler.handle(e);
		else
			throw e;
	}

	return checkoutResult;
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:33,代码来源:SVNCheckout.java

示例3: getSVNClientManager

import org.tmatesoft.svn.core.wc.SVNClientManager; //导入依赖的package包/类
public static SVNClientManager getSVNClientManager(String userName, String password) throws SVNException {
	/*
	 * Creates a default run-time configuration options driver. Default
	 * options created in this way use the Subversion run-time configuration
	 * area (for instance, on a Windows platform it can be found in the
	 * '%APPDATA%\Subversion' directory).
	 * 
	 * readonly = true - not to save any configuration changes that can be
	 * done during the program run to a config file (config settings will
	 * only be read to initialize; to enable changes the readonly flag
	 * should be set to false).
	 * 
	 * SVNWCUtil is a utility class that creates a default options driver.
	 */
	DefaultSVNOptions options = SVNWCUtil.createDefaultOptions(true);

	/*
	 * Creates an instance of SVNClientManager providing authentication
	 * information (name, password) and an options driver
	 */
	return SVNClientManager.newInstance(options, userName, password);
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:23,代码来源:SvnHelper.java

示例4: checkout

import org.tmatesoft.svn.core.wc.SVNClientManager; //导入依赖的package包/类
private File checkout(String scmUrl) throws Exception {
  ISVNOptions options = SVNWCUtil.createDefaultOptions(true);
  ISVNAuthenticationManager isvnAuthenticationManager = SVNWCUtil.createDefaultAuthenticationManager(null, null, (char[]) null, false);
  SVNClientManager svnClientManager = SVNClientManager.newInstance(options, isvnAuthenticationManager);
  File out = temp.newFolder();
  SVNUpdateClient updateClient = svnClientManager.getUpdateClient();
  SvnCheckout co = updateClient.getOperationsFactory().createCheckout();
  co.setUpdateLocksOnDemand(updateClient.isUpdateLocksOnDemand());
  co.setSource(SvnTarget.fromURL(SVNURL.parseURIEncoded(scmUrl), SVNRevision.HEAD));
  co.setSingleTarget(SvnTarget.fromFile(out));
  co.setRevision(SVNRevision.HEAD);
  co.setDepth(SVNDepth.INFINITY);
  co.setAllowUnversionedObstructions(false);
  co.setIgnoreExternals(updateClient.isIgnoreExternals());
  co.setExternalsHandler(SvnCodec.externalsHandler(updateClient.getExternalsHandler()));
  co.setTargetWorkingCopyFormat(wcVersion);
  co.run();
  return out;
}
 
开发者ID:SonarSource,项目名称:sonar-scm-svn,代码行数:20,代码来源:SvnTest.java

示例5: blame

import org.tmatesoft.svn.core.wc.SVNClientManager; //导入依赖的package包/类
@Override
public void blame(final BlameInput input, final BlameOutput output) {
  FileSystem fs = input.fileSystem();
  LOG.debug("Working directory: " + fs.baseDir().getAbsolutePath());
  SVNClientManager clientManager = null;
  try {
    clientManager = newSvnClientManager(configuration);
    for (InputFile inputFile : input.filesToBlame()) {
      blame(clientManager, inputFile, output);
    }
  } finally {
    if (clientManager != null) {
      try {
        clientManager.dispose();
      } catch (Exception e) {
        LOG.warn("Unable to dispose SVN ClientManager", e);
      }
    }
  }
}
 
开发者ID:SonarSource,项目名称:sonar-scm-svn,代码行数:21,代码来源:SvnBlameCommand.java

示例6: checkStatus

import org.tmatesoft.svn.core.wc.SVNClientManager; //导入依赖的package包/类
private static boolean checkStatus(SVNClientManager clientManager, InputFile inputFile) throws SVNException {
  SVNStatusClient statusClient = clientManager.getStatusClient();
  try {
    SVNStatus status = statusClient.doStatus(inputFile.file(), false);
    if (status == null) {
      LOG.debug("File {} returns no svn state. Skipping it.", inputFile);
      return false;
    }
    if (status.getContentsStatus() != SVNStatusType.STATUS_NORMAL) {
      LOG.debug("File {} is not versionned or contains local modifications. Skipping it.", inputFile);
      return false;
    }
  } catch (SVNException e) {
    if (SVNErrorCode.WC_PATH_NOT_FOUND.equals(e.getErrorMessage().getErrorCode())
      || SVNErrorCode.WC_NOT_WORKING_COPY.equals(e.getErrorMessage().getErrorCode())) {
      LOG.debug("File {} is not versionned. Skipping it.", inputFile);
      return false;
    }
    throw e;
  }
  return true;
}
 
开发者ID:SonarSource,项目名称:sonar-scm-svn,代码行数:23,代码来源:SvnBlameCommand.java

示例7: getClientManager

import org.tmatesoft.svn.core.wc.SVNClientManager; //导入依赖的package包/类
private synchronized SVNClientManager getClientManager() {
    if (clientManager == null) {
        final DefaultSVNOptions options = new DefaultSVNOptions(null, true) {
            private String[] ignorePatterns;
            {
                ignorePatterns = new String[] {};
            }

            @Override
            public String[] getIgnorePatterns() {

                return ignorePatterns;
            }

        };
        options.setIgnorePatterns(null);
        clientManager = SVNClientManager.newInstance(options, authManager);
    }
    return clientManager;
}
 
开发者ID:friedlwo,项目名称:AppWoksUtils,代码行数:21,代码来源:Subversion.java

示例8: setupSVN

import org.tmatesoft.svn.core.wc.SVNClientManager; //导入依赖的package包/类
/**
 * Parse the URL and set up the class to connect to the SVN repo
 * 
 * @param url
 *            Repository's address (valid protocols: http://, svn:// and
 *            file://)
 */
@SuppressWarnings("deprecation")
private void setupSVN() {

	svn_client = SVNClientManager.newInstance();
	svn_client.setEventHandler(new SVNEventHandler());
	log_handler = new SVNLogHandler();
	try {
		this.SVN_url = SVNURL.parseURIDecoded(repository_url);
	} catch (SVNException e) {
		e.printStackTrace();
		System.exit(0);
	}
	SVNRevision start_revision = SVNRevision.create(time_interval
			.getStart().toDate());
	SVNRevision end_revision = SVNRevision.create(time_interval.getEnd()
			.toDate());
	revision_range = new SVNRevisionRange(start_revision, end_revision);
}
 
开发者ID:aserg-ufmg,项目名称:ModularityCheck,代码行数:26,代码来源:SVNManager.java

示例9: initializeClientManager

import org.tmatesoft.svn.core.wc.SVNClientManager; //导入依赖的package包/类
private void initializeClientManager()
{
    /*
    * Creates a default run-time configuration options driver. Default options
    * created in this way use the Subversion run-time configuration area (for
    * instance, on a Windows platform it can be found in the '%APPDATA%\Subversion'
    * directory).
    *
    * readonly = true - not to save  any configuration changes that can be done
    * during the program run to a config file (config settings will only
    * be read to initialize; to enable changes the readonly flag should be set
    * to false).
    *
    */
    ISVNOptions options = SVNWCUtil.createDefaultOptions( true );
    clientManager = SVNClientManager.newInstance( options, getAuthManager() );
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:18,代码来源:SvnJavaScmProviderRepository.java

示例10: delete

import org.tmatesoft.svn.core.wc.SVNClientManager; //导入依赖的package包/类
/**
 * Schedules directories and files for deletion from version control upon the next
 * commit (locally). Like 'svn delete PATH' command. It's done by invoking
 * <p/>
 * SVNWCClient.doDelete(File path, boolean force, boolean dryRun)
 * <p/>
 * which takes the following parameters:
 * <p/>
 * path - an entry to be scheduled for deletion;
 * <p/>
 * force - a boolean flag which is set to true to force a deletion even if an entry
 * has local modifications;
 * <p/>
 * dryRun - set to true not to delete an entry but to check if it can be deleted;
 * if false - then it's a deletion itself.
 */
public static void delete( SVNClientManager clientManager, ScmFileSet fileSet, boolean force )
    throws SVNException
{
    if ( fileSet.getFileList() == null || fileSet.getFileList().isEmpty() )
    {
        return;
    }
    for ( File file : fileSet.getFileList() )
    {
        if ( !file.isAbsolute() )
        {
            file = new File( fileSet.getBasedir().getAbsolutePath(), file.getPath() );
        }
        clientManager.getWCClient().doDelete( file, force, false );
    }
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:33,代码来源:SvnJavaUtil.java

示例11: copy

import org.tmatesoft.svn.core.wc.SVNClientManager; //导入依赖的package包/类
public static SVNCommitInfo copy( SVNClientManager clientManager, SVNURL srcURL, SVNURL dstURL, boolean isMove,
                                  String commitMessage, String revision )
    throws SVNException
{

    SVNRevision svnRevision = null;
    if ( StringUtils.isEmpty( revision ) )
    {
        svnRevision = SVNRevision.HEAD;
    }
    else
    {
        svnRevision = SVNRevision.create( Long.parseLong( revision ) );
    }
    /*
     * SVNRevision.HEAD means the latest revision.
     * Returns SVNCommitInfo containing information on the new revision committed
     * (revision number, etc.)
     */
    SVNCopySource[] svnCopySources = new SVNCopySource[1];
    svnCopySources[0] = new SVNCopySource( svnRevision, svnRevision, srcURL );

    return clientManager.getCopyClient().doCopy( svnCopySources, dstURL, false, true, true, commitMessage,
                                                 new SVNProperties() );
    //return clientManager.getCopyClient().doCopy( srcURL, svnRevision, dstURL, isMove, commitMessage, new SVNProperties() );
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:27,代码来源:SvnJavaUtil.java

示例12: initializeRepository

import org.tmatesoft.svn.core.wc.SVNClientManager; //导入依赖的package包/类
public static void initializeRepository( File repositoryRoot )
    throws Exception
{
    if ( repositoryRoot.exists() )
    {
        FileUtils.deleteDirectory( repositoryRoot );
    }

    Assert.assertTrue( "Could not make repository root directory: " + repositoryRoot.getAbsolutePath(),
                       repositoryRoot.mkdirs() );

    //ScmTestCase.execute( repositoryRoot.getParentFile(), SVNADMIN_COMMAND_LINE, "create " + repositoryRoot.getName() );

    if (repositoryRoot.exists())
    {
        FileUtils.cleanDirectory( repositoryRoot );
    }
    
    ISVNOptions options = SVNWCUtil.createDefaultOptions( true );

    SVNClientManager.newInstance().getAdminClient().doCreateRepository( repositoryRoot, null, true, true );
    
    loadSvnDump( repositoryRoot,
                 new SvnJavaScmTestUtils().getClass().getClassLoader().getResourceAsStream( "tck/tck.dump" ) );
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:26,代码来源:SvnJavaScmTestUtils.java

示例13: getSvn

import org.tmatesoft.svn.core.wc.SVNClientManager; //导入依赖的package包/类
private SVNClientManager getSvn(boolean missingLocalOk) throws IOException, IllegalArgumentException
{
	if (scm_ == null)
	{
		if (localFolder_ == null)
		{
			throw new IllegalArgumentException("localFolder has not yet been set - please call setRootLocation(...)");
		}
		if (!localFolder_.isDirectory())
		{
			log.error("The passed in local folder '{}' didn't exist", localFolder_);
			throw new IllegalArgumentException("The localFolder must be a folder, and must exist");
		}

		File svnFolder = new File(localFolder_, ".svn");

		if (!missingLocalOk && !svnFolder.isDirectory())
		{
			log.error("The passed in local folder '{}' does not appear to be a svn repository", localFolder_);
			throw new IllegalArgumentException("The localFolder does not appear to be a svn repository");
		}
		scm_ = SVNClientManager.newInstance();
	}
	return scm_;
}
 
开发者ID:Apelon-VA,项目名称:ISAAC,代码行数:26,代码来源:SyncServiceSVN.java

示例14: getLatestVersion

import org.tmatesoft.svn.core.wc.SVNClientManager; //导入依赖的package包/类
@Override
public String getLatestVersion() throws StoreException {
    return getSvnCore().doWithClientAndRepository(new SvnPersisterCore.SvnOperation<String>() {
        @Override
        public String execute(final SVNRepository repo, final SVNClientManager clientManager) throws Exception {
            final String[] targetPaths = {};
            final SVNRevision svnRevision = SVNRevision.HEAD;
            final SVNLogClient logClient = clientManager.getLogClient();
            final FilterableSVNLogEntryHandler handler = new FilterableSVNLogEntryHandler();

            // In order to get history is "descending" order, the startRevision should be the one closer to HEAD
            logClient.doLog(svnUrl, targetPaths, /* pegRevision */ SVNRevision.HEAD, svnRevision, SVNRevision.create(1),
                            /* stopOnCopy */ false, /* discoverChangedPaths */ false, /* includeMergedRevisions */ false,
                            /* limit */ 1,
                            new String[]{SVNRevisionProperty.LOG}, handler);
            final SVNLogEntry entry = handler.getLogEntries().size() > 0 ? handler.getLogEntries().get(0) : null;
            return entry == null ? "-1" : String.valueOf(entry.getRevision());
        }

        @Override
        public StoreException handleException(final Exception e) throws StoreException {
            throw new StoreException.ReadException("Unable to get latest revision", e);
        }
    });
}
 
开发者ID:indeedeng,项目名称:proctor,代码行数:26,代码来源:SvnProctor.java

示例15: getMatrixHistory

import org.tmatesoft.svn.core.wc.SVNClientManager; //导入依赖的package包/类
@Override
public List<Revision> getMatrixHistory(final int start, final int limit) throws StoreException {
    final String[] targetPaths = {};
    return getSvnCore().doWithClientAndRepository(new SvnPersisterCore.SvnOperation<List<Revision>>() {
        @Override
        public List<Revision> execute(final SVNRepository repo, final SVNClientManager clientManager) throws Exception {
            return getSVNLogs(clientManager, targetPaths, SVNRevision.HEAD, start, limit);
        }

        @Override
        public StoreException handleException(final Exception e) throws StoreException {
            throw new StoreException.ReadException("Unable to get matrix history", e);
        }
    });

}
 
开发者ID:indeedeng,项目名称:proctor,代码行数:17,代码来源:SvnProctor.java


注:本文中的org.tmatesoft.svn.core.wc.SVNClientManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。