in src/main/java/org/apache/maven/plugin/changelog/ChangeLogReport.java [1628:1751]
protected void generateLinks( String connection, String name, String revision, Sink sink )
{
String linkFile;
String linkRev = null;
if ( revision != null )
{
linkFile = displayFileRevDetailUrl;
}
else
{
linkFile = displayFileDetailUrl;
}
if ( linkFile != null )
{
if ( !linkFile.equals( scmUrl ) )
{
String linkName = name;
if ( encodeFileUri )
{
try
{
linkName = URLEncoder.encode( linkName, "UTF-8" );
}
catch ( UnsupportedEncodingException e )
{
// UTF-8 is always supported
}
}
// Use the given URL to create links to the files
if ( linkFile.indexOf( FILE_TOKEN ) > 0 )
{
linkFile = linkFile.replaceAll( FILE_TOKEN, linkName );
}
else
{
// This is here so that we are backwards compatible with the
// format used before the special token was introduced
linkFile += linkName;
}
// Use the given URL to create links to the files
if ( revision != null && linkFile.indexOf( REV_TOKEN ) > 0 )
{
linkFile = linkFile.replaceAll( REV_TOKEN, revision );
}
}
else if ( connection.startsWith( "scm:perforce" ) )
{
String path = getAbsolutePath( displayFileDetailUrl, name );
linkFile = path + "?ac=22";
if ( revision != null )
{
linkRev = path + "?ac=64&rev=" + revision;
}
}
else if ( connection.startsWith( "scm:clearcase" ) )
{
String path = getAbsolutePath( displayFileDetailUrl, name );
linkFile = path + rptOneRepoParam;
}
else if ( connection.indexOf( "cvsmonitor.pl" ) > 0 )
{
Pattern cvsMonitorRegex = Pattern.compile( "^.*(&module=.*?(?:&|$)).*$" );
String module = cvsMonitorRegex.matcher( rptOneRepoParam ).replaceAll( "$1" );
linkFile = displayFileDetailUrl + "?cmd=viewBrowseFile" + module + "&file=" + name;
if ( revision != null )
{
linkRev =
rptRepository + "?cmd=viewBrowseVersion" + module + "&file=" + name + "&version=" + revision;
}
}
else
{
String path = getAbsolutePath( displayFileDetailUrl, name );
linkFile = path + rptOneRepoParam;
if ( revision != null )
{
linkRev = path + "?rev=" + revision + "&content-type=text/vnd.viewcvs-markup" + rptMultiRepoParam;
}
}
}
if ( linkFile != null )
{
sink.link( linkFile );
sinkFileName( name, sink );
sink.link_();
}
else
{
sinkFileName( name, sink );
}
sink.text( " " );
if ( linkRev == null && revision != null && displayChangeSetDetailUrl != null )
{
if ( displayChangeSetDetailUrl.indexOf( REV_TOKEN ) > 0 )
{
linkRev = displayChangeSetDetailUrl.replaceAll( REV_TOKEN, revision );
}
else
{
linkRev = displayChangeSetDetailUrl + revision;
}
}
if ( linkRev != null )
{
sink.link( linkRev );
sink.text( "v " + revision );
sink.link_();
}
else if ( revision != null )
{
sink.text( "v " + revision );
}
}