本文整理汇总了Java中org.tmatesoft.svn.core.wc.SVNWCUtil类的典型用法代码示例。如果您正苦于以下问题:Java SVNWCUtil类的具体用法?Java SVNWCUtil怎么用?Java SVNWCUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SVNWCUtil类属于org.tmatesoft.svn.core.wc包,在下文中一共展示了SVNWCUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: connectToSVNInstance
import org.tmatesoft.svn.core.wc.SVNWCUtil; //导入依赖的package包/类
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());
}
ISVNAuthenticationManager authManager = SVNWCUtil
.createDefaultAuthenticationManager(usr, pass);
repository.setAuthenticationManager(authManager);
try {
SvnUtil.verifySVNLocation(repository, url);
} catch (SVNException e) {
e.printStackTrace();
}
return repository;
}
示例2: init
import org.tmatesoft.svn.core.wc.SVNWCUtil; //导入依赖的package包/类
private void init() {
logger.info("Creating MySVNClient for svn " + svn_url + ", username " + username + ", password " + password.replaceAll(".", "\\*"));
DAVRepositoryFactory.setup( );
SVNURL url;
try {
url = SVNURL.parseURIDecoded(svn_url);
repository = SVNRepositoryFactory.create( url );
ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager( username , password );
repository.setAuthenticationManager( authManager );
} catch (SVNException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例3: getWorkingCopyRoot
import org.tmatesoft.svn.core.wc.SVNWCUtil; //导入依赖的package包/类
@Nullable
public static File getWorkingCopyRoot(final File inFile) {
File file = inFile;
while ((file != null) && (file.isFile() || (! file.exists()))) {
file = file.getParentFile();
}
if (file == null) {
return null;
}
File workingCopyRoot = null;
try {
workingCopyRoot = SVNWCUtil.getWorkingCopyRoot(file, true);
} catch (SVNException e) {
//
}
if (workingCopyRoot == null) {
workingCopyRoot = getWcCopyRootIf17(file, null);
}
return workingCopyRoot;
}
示例4: getSVNClientManager
import org.tmatesoft.svn.core.wc.SVNWCUtil; //导入依赖的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);
}
示例5: performSVNupdate
import org.tmatesoft.svn.core.wc.SVNWCUtil; //导入依赖的package包/类
/**
* @param svnPathString
* String which contains the local SVN folder path.
* @return Error code. If true --> SVN Operation failed.
*/
public final boolean performSVNupdate(final String svnPathString) {
SfdcCommander commander = SfdcCommander.getInstance();
boolean error = false;
File svnPath = new File(svnPathString);
// checkout
try {
ISVNAuthenticationManager authManager = getAuthManager(config);
SVNUpdateClient updateClient = new SVNUpdateClient(authManager,
SVNWCUtil.createDefaultOptions(true));
updateClient.doUpdate(svnPath, SVNRevision.HEAD, SVNDepth.INFINITY,
true, true);
commander.info("SVN Update successfully processed.");
} catch (SVNException e) {
commander.info(e.getMessage());
error = true;
}
return error;
}
示例6: performSVNcommit
import org.tmatesoft.svn.core.wc.SVNWCUtil; //导入依赖的package包/类
/**
* @param svnPathString
* String which contains the local SVN folder path.
* @param aComment
* The SVN Comment which has been entered.
* @param aConfig
* CommanderConfig for SVN Connect.
* @return Error code. If true --> SVN Operation failed.
*/
public final boolean performSVNcommit(final String svnPathString,
final String aComment, final CommanderConfig aConfig) {
SfdcCommander commander = SfdcCommander.getInstance();
boolean error = false;
File[] paths = new File[1];
// paths[0] = projectFile;
// boolean svnNew = false;
// svn add
SVNProperties props = new SVNProperties();
try {
ISVNAuthenticationManager authManager = getAuthManager(config);
// if (svnNew) {
// SVNWCClient addClient = new SVNWCClient(authManager,
// SVNWCUtil.createDefaultOptions(true));
// addClient.doAdd(projectFile, true, false, true,
// SVNDepth.INFINITY, true, true);
// commander.notify("Projectfile successfully added.");
// }
// commit
SVNCommitClient commitClient = new SVNCommitClient(authManager,
SVNWCUtil.createDefaultOptions(true));
commitClient.doCommit(paths, false, aComment, props, null, false,
true, SVNDepth.INFINITY);
commander.info("Projectfile successfully commited.");
} catch (SVNException e) {
commander.info(e.getMessage());
error = true;
}
return error;
}
示例7: checkout
import org.tmatesoft.svn.core.wc.SVNWCUtil; //导入依赖的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;
}
示例8: getCommits
import org.tmatesoft.svn.core.wc.SVNWCUtil; //导入依赖的package包/类
@Override
public List<Commit> getCommits() {
System.out.println("Getting commit log...");
ISVNAuthenticationManager authManager = SVNWCUtil
.createDefaultAuthenticationManager("guest", "");
svn_client.setAuthenticationManager(authManager);
SVNLogClient log_client = svn_client.getLogClient();
try {
log_client.doLog(SVN_url, new String[] { "" },
SVNRevision.UNDEFINED, revision_range.getStartRevision(),
revision_range.getEndRevision(), false, true, 0,
log_handler);
} catch (SVNException e) {
e.printStackTrace();
}
return log_handler.getCommits();
}
示例9: initializeClientManager
import org.tmatesoft.svn.core.wc.SVNWCUtil; //导入依赖的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() );
}
示例10: getAuthManager
import org.tmatesoft.svn.core.wc.SVNWCUtil; //导入依赖的package包/类
private ISVNAuthenticationManager getAuthManager()
{
if ( getPrivateKey() != null )
{
SVNSSHAuthentication[] auth = new SVNSSHAuthentication[1];
auth[0] = new SVNSSHAuthentication( getUser(), getPrivateKey().toCharArray(), getPassphrase(), -1, false );
return new BasicAuthenticationManager( auth );
}
else if ( getUser() != null )
{
return new BasicAuthenticationManager( getUser(), getPassword() );
}
else
{
String configDirectory = SvnUtil.getSettings().getConfigDirectory();
return SVNWCUtil.createDefaultAuthenticationManager(
configDirectory == null ? null : new File( configDirectory ), getUser(), getPassword(),
SvnUtil.getSettings().isUseAuthCache() );
}
}
示例11: initializeRepository
import org.tmatesoft.svn.core.wc.SVNWCUtil; //导入依赖的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" ) );
}
示例12: openRepository
import org.tmatesoft.svn.core.wc.SVNWCUtil; //导入依赖的package包/类
private void openRepository() throws Exception {
repository = null;
try {
repository = SVNRepositoryFactory.create(SVNURL
.parseURIEncoded(this.url));
} catch (SVNException svne) {
logger.log(Level.WARNING,
"error while creating an SVNRepository for the location '"
+ this.url + "': " + svne.getMessage(), true);
// StateBar.setState(Icons.ERROR, stateOpenRepositoryFailed);
throw new Exception("Can't access svn!!!");
}
ISVNAuthenticationManager authManager = SVNWCUtil
.createDefaultAuthenticationManager(name, password);
repository.setAuthenticationManager(authManager);
}
示例13: createRepository
import org.tmatesoft.svn.core.wc.SVNWCUtil; //导入依赖的package包/类
/**
* Set up repository. This method also determines the head revision of the
* repository.
*
* @throws ConQATException
* if setup fails.
*/
protected SVNRepository createRepository() throws ConQATException {
DAVRepositoryFactory.setup();
FSRepositoryFactory.setup();
try {
SVNRepository repository = SVNRepositoryFactory.create(SVNURL
.parseURIEncoded(url));
ISVNAuthenticationManager authManager;
if (userName != null) {
authManager = SVNWCUtil.createDefaultAuthenticationManager(
userName, password);
} else {
authManager = SVNWCUtil.createDefaultAuthenticationManager();
}
repository.setAuthenticationManager(authManager);
return repository;
} catch (SVNException e) {
throw new ConQATException(e);
}
}
示例14: logModificacoesSVN
import org.tmatesoft.svn.core.wc.SVNWCUtil; //导入依赖的package包/类
public void logModificacoesSVN() throws SVNException {
ISVNAuthenticationManager aManager = SVNWCUtil.createDefaultAuthenticationManager("kann", senha_ic);
SVNURL url = SVNURL.parseURIEncoded(SVN_PEIXE_ESPADA);
SVNRepository repos = SVNRepositoryFactory.create(url);
repos.setAuthenticationManager(aManager);
long headRevision = repos.getLatestRevision();
Collection<SVNDirEntry> entriesList = repos.getDir("", headRevision, null, (Collection) null);
for (SVNDirEntry entry : entriesList) {
System.out.println("Entrada: " + entry.getName());
System.out.println("Última modificação da revisão: " + entry.getDate() +
" por " + entry.getAuthor());
System.out.println(" --> MSG: "+entry.getCommitMessage());
}
}
示例15: buildSvnCredentials
import org.tmatesoft.svn.core.wc.SVNWCUtil; //导入依赖的package包/类
private SVNClientManager buildSvnCredentials ( String scmUserid, String encodedPass ) {
SVNClientManager cm = SVNClientManager.newInstance();
cm.setAuthenticationManager( SVNWCUtil
.createDefaultAuthenticationManager( scmUserid, encryptor.decrypt( encodedPass ) ) );
return cm;
}