use of org.apache.maven.scm.provider.ScmProviderRepository in project maven-plugins by apache.
the class ChangeLogReport method getScmRepository.
public ScmRepository getScmRepository() throws ScmException {
ScmRepository repository;
try {
repository = manager.makeScmRepository(getConnection());
ScmProviderRepository providerRepo = repository.getProviderRepository();
if (!StringUtils.isEmpty(username)) {
providerRepo.setUser(username);
}
if (!StringUtils.isEmpty(password)) {
providerRepo.setPassword(password);
}
if (repository.getProviderRepository() instanceof ScmProviderRepositoryWithHost) {
ScmProviderRepositoryWithHost repo = (ScmProviderRepositoryWithHost) repository.getProviderRepository();
loadInfosFromSettings(repo);
if (!StringUtils.isEmpty(username)) {
repo.setUser(username);
}
if (!StringUtils.isEmpty(password)) {
repo.setPassword(password);
}
if (!StringUtils.isEmpty(privateKey)) {
repo.setPrivateKey(privateKey);
}
if (!StringUtils.isEmpty(passphrase)) {
repo.setPassphrase(passphrase);
}
}
if (!StringUtils.isEmpty(tagBase) && repository.getProvider().equals("svn")) {
SvnScmProviderRepository svnRepo = (SvnScmProviderRepository) repository.getProviderRepository();
svnRepo.setTagBase(tagBase);
}
} catch (Exception e) {
throw new ScmException("Can't load the scm provider.", e);
}
return repository;
}
use of org.apache.maven.scm.provider.ScmProviderRepository in project maven-scm by apache.
the class AbstractScmMojo method getScmRepository.
public ScmRepository getScmRepository() throws ScmException {
ScmRepository repository;
try {
repository = getScmManager().makeScmRepository(getConnectionUrl());
ScmProviderRepository providerRepo = repository.getProviderRepository();
providerRepo.setPushChanges(pushChanges);
if (!StringUtils.isEmpty(workItem)) {
providerRepo.setWorkItem(workItem);
}
if (!StringUtils.isEmpty(username)) {
providerRepo.setUser(username);
}
if (!StringUtils.isEmpty(password)) {
providerRepo.setPassword(password);
}
if (repository.getProviderRepository() instanceof ScmProviderRepositoryWithHost) {
ScmProviderRepositoryWithHost repo = (ScmProviderRepositoryWithHost) repository.getProviderRepository();
loadInfosFromSettings(repo);
if (!StringUtils.isEmpty(username)) {
repo.setUser(username);
}
if (!StringUtils.isEmpty(password)) {
repo.setPassword(password);
}
if (!StringUtils.isEmpty(privateKey)) {
repo.setPrivateKey(privateKey);
}
if (!StringUtils.isEmpty(passphrase)) {
repo.setPassphrase(passphrase);
}
}
if (!StringUtils.isEmpty(tagBase) && repository.getProvider().equals("svn")) {
SvnScmProviderRepository svnRepo = (SvnScmProviderRepository) repository.getProviderRepository();
svnRepo.setTagBase(tagBase);
}
} catch (ScmRepositoryException e) {
if (!e.getValidationMessages().isEmpty()) {
for (String message : e.getValidationMessages()) {
getLog().error(message);
}
}
throw new ScmException("Can't load the scm provider.", e);
} catch (Exception e) {
throw new ScmException("Can't load the scm provider.", e);
}
return repository;
}
use of org.apache.maven.scm.provider.ScmProviderRepository in project maven-scm by apache.
the class AbstractScmManager method makeProviderScmRepository.
/**
* {@inheritDoc}
*/
public ScmRepository makeProviderScmRepository(String providerType, File path) throws ScmRepositoryException, UnknownRepositoryStructure, NoSuchScmProviderException {
if (providerType == null) {
throw new NullPointerException("The provider type cannot be null.");
}
ScmProvider provider = getProviderByType(providerType);
ScmProviderRepository providerRepository = provider.makeProviderScmRepository(path);
return new ScmRepository(providerType, providerRepository);
}
use of org.apache.maven.scm.provider.ScmProviderRepository in project maven-scm by apache.
the class AbstractScmManager method makeScmRepository.
// ----------------------------------------------------------------------
// Repository
// ----------------------------------------------------------------------
/**
* {@inheritDoc}
*/
public ScmRepository makeScmRepository(String scmUrl) throws ScmRepositoryException, NoSuchScmProviderException {
if (scmUrl == null) {
throw new NullPointerException("The scm url cannot be null.");
}
char delimiter = ScmUrlUtils.getDelimiter(scmUrl).charAt(0);
String providerType = ScmUrlUtils.getProvider(scmUrl);
ScmProvider provider = getProviderByType(providerType);
String scmSpecificUrl = cleanScmUrl(scmUrl.substring(providerType.length() + 5));
ScmProviderRepository providerRepository = provider.makeProviderScmRepository(scmSpecificUrl, delimiter);
return new ScmRepository(providerType, providerRepository);
}
use of org.apache.maven.scm.provider.ScmProviderRepository in project maven-scm by apache.
the class BazaarChangeLogCommand method executeChangeLogCommand.
/**
* {@inheritDoc}
*/
@Override
protected ChangeLogScmResult executeChangeLogCommand(ChangeLogScmRequest request) throws ScmException {
final ScmVersion startVersion = request.getStartRevision();
final ScmVersion endVersion = request.getEndRevision();
final ScmFileSet fileSet = request.getScmFileSet();
final String datePattern = request.getDatePattern();
if (startVersion != null || endVersion != null) {
final ScmProviderRepository scmProviderRepository = request.getScmRepository().getProviderRepository();
return executeChangeLogCommand(scmProviderRepository, fileSet, startVersion, endVersion, datePattern);
}
return executeChangeLogCommand(fileSet, request.getStartDate(), request.getEndDate(), datePattern, request.getLimit());
}
Aggregations