use of org.apache.maven.scm.log.DefaultLog in project maven-plugins by apache.
the class ChangeLogReport method getRevisionForTag.
/**
* Resolves the given tag to the revision number.
*
* @param tag
* @param repository
* @param provider
* @return
* @throws ScmException
*/
private String getRevisionForTag(final String tag, final ScmRepository repository, final ScmProvider provider) throws ScmException {
if (repository.getProvider().equals("svn")) {
if (tag == null) {
return "HEAD";
}
SvnInfoCommandExpanded infoCommand = new SvnInfoCommandExpanded();
infoCommand.setLogger(new DefaultLog());
InfoScmResult infoScmResult = infoCommand.executeInfoTagCommand((SvnScmProviderRepository) repository.getProviderRepository(), new ScmFileSet(basedir), tag, null, false, null);
if (infoScmResult.getInfoItems().size() == 0) {
throw new ScmException("There is no tag named '" + tag + "' in the Subversion repository.");
}
InfoItem infoItem = infoScmResult.getInfoItems().get(0);
String revision = infoItem.getLastChangedRevision();
getLog().info(String.format("Resolved tag '%s' to revision '%s'", tag, revision));
return revision;
}
return tag;
}
Aggregations