use of org.tmatesoft.svn.core.wc.ISVNOptions in project sonarqube by SonarSource.
the class SvnScmSupport method newSvnClientManager.
static SVNClientManager newSvnClientManager(SvnConfiguration configuration) {
ISVNOptions options = SVNWCUtil.createDefaultOptions(true);
final char[] passwordValue = getCharsOrNull(configuration.password());
final char[] passPhraseValue = getCharsOrNull(configuration.passPhrase());
ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(null, configuration.username(), passwordValue, configuration.privateKey(), passPhraseValue, false);
return SVNClientManager.newInstance(options, authManager);
}
use of org.tmatesoft.svn.core.wc.ISVNOptions in project sonarqube by SonarSource.
the class SvnBlameCommandTest method checkout.
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;
}
use of org.tmatesoft.svn.core.wc.ISVNOptions in project omegat by omegat-org.
the class SVNRemoteRepository2 method isSVNRepository.
/**
* Determines whether or not the supplied URL represents a valid Subversion repository.
*
* <p>
* Does the equivalent of <code>svn info <i>url</i></code>.
*
* @param url
* URL of supposed remote repository
* @return true if repository appears to be valid, false otherwise
*/
public static boolean isSVNRepository(String url) {
// Heuristics to save some waiting time
try {
ISVNOptions options = SVNWCUtil.createDefaultOptions(true);
SVNClientManager ourClientManager = SVNClientManager.newInstance(options, (ISVNAuthenticationManager) null);
ourClientManager.getWCClient().doInfo(SVNURL.parseURIEncoded(SVNEncodingUtil.autoURIEncode(url)), SVNRevision.HEAD, SVNRevision.HEAD);
} catch (SVNAuthenticationException ex) {
// https://twitter.com/amadlonkay/status/699716236372889600
return true;
} catch (SVNException ex) {
return false;
}
return true;
}
use of org.tmatesoft.svn.core.wc.ISVNOptions in project omegat by omegat-org.
the class SVNRemoteRepository2 method init.
@Override
public void init(RepositoryDefinition repo, File dir, ProjectTeamSettings teamSettings) throws Exception {
config = repo;
baseDirectory = dir;
projectTeamSettings = teamSettings;
String predefinedUser = repo.getOtherAttributes().get(new QName("svnUsername"));
String predefinedPass = repo.getOtherAttributes().get(new QName("svnPassword"));
if (predefinedUser == null) {
predefinedUser = SVNURL.parseURIEncoded(repo.getUrl()).getUserInfo();
}
ISVNOptions options = SVNWCUtil.createDefaultOptions(true);
ISVNAuthenticationManager authManager = new SVNAuthenticationManager(repo.getUrl(), predefinedUser, predefinedPass, teamSettings);
ourClientManager = SVNClientManager.newInstance(options, authManager);
if (baseDirectory.exists()) {
ourClientManager.getWCClient().doCleanup(baseDirectory);
ourClientManager.getWCClient().doRevert(new File[] { baseDirectory }, SVNDepth.fromRecurse(true), null);
}
}
Aggregations