server = settings.getServer( releaseDescriptor.getScmId() );
}
if ( server == null && repository.getProviderRepository() instanceof ScmProviderRepositoryWithHost )
{
ScmProviderRepositoryWithHost repositoryWithHost =
(ScmProviderRepositoryWithHost) repository.getProviderRepository();
String host = repositoryWithHost.getHost();
int port = repositoryWithHost.getPort();
if ( port > 0 )
{
host += ":" + port;
}
// TODO: this is a bit dodgy - id is not host, but since we don't have a <host> field we make an assumption
server = settings.getServer( host );
}
if ( server != null )
{
if ( username == null )
{
username = server.getUsername();
}
if ( password == null )
{
password = decrypt( server.getPassword(), server.getId() );
}
if ( privateKey == null )
{
privateKey = server.getPrivateKey();
}
if ( passphrase == null )
{
passphrase = decrypt( server.getPassphrase(), server.getId() );
}
}
}
if ( !StringUtils.isEmpty( username ) )
{
scmRepo.setUser( username );
}
if ( !StringUtils.isEmpty( password ) )
{
scmRepo.setPassword( password );
}
if ( scmRepo instanceof ScmProviderRepositoryWithHost )
{
ScmProviderRepositoryWithHost repositoryWithHost = (ScmProviderRepositoryWithHost) scmRepo;
if ( !StringUtils.isEmpty( privateKey ) )
{
repositoryWithHost.setPrivateKey( privateKey );
}
if ( !StringUtils.isEmpty( passphrase ) )
{
repositoryWithHost.setPassphrase( passphrase );
}
}
if ( "svn".equals( repository.getProvider() ) )
{