Refactored the ScmReport class to handle the SCMs with the maven-scm component. Generates reports for all SCMs supported by the maven-scm-provider component: ClearCase, CVS, Perforce, Starteam and SVN.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@227197 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vincent Siveton 2005-08-03 11:25:33 +00:00
parent d031f4309a
commit 9508fdde65
4 changed files with 470 additions and 305 deletions

View File

@ -46,6 +46,41 @@
<artifactId>commons-validator</artifactId>
<version>1.1.4</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-api</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-clearcase</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-cvs</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-perforce</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-starteam</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-svn</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-manager-plexus</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
</dependency>
</dependencies>
<developers>
<developer>

View File

@ -22,11 +22,19 @@ import org.apache.maven.project.MavenProject;
import org.apache.maven.reporting.AbstractMavenReport;
import org.apache.maven.reporting.AbstractMavenReportRenderer;
import org.apache.maven.reporting.MavenReportException;
import org.apache.maven.scm.manager.NoSuchScmProviderException;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.provider.clearcase.repository.ClearCaseScmProviderRepository;
import org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository;
import org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository;
import org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository;
import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
import org.apache.maven.scm.repository.ScmRepository;
import org.apache.maven.scm.repository.ScmRepositoryException;
import org.codehaus.doxia.sink.Sink;
import org.codehaus.doxia.site.renderer.SiteRenderer;
import org.codehaus.plexus.util.StringUtils;
import java.io.IOException;
import java.util.Locale;
import java.util.ResourceBundle;
@ -61,6 +69,13 @@ public class ScmReport
*/
private MavenProject project;
/**
* @parameter expression="${component.org.apache.maven.scm.manager.ScmManager}"
* @required
* @readonly
*/
protected ScmManager scmManager;
/**
* @see org.apache.maven.reporting.MavenReport#getName(java.util.Locale)
*/
@ -115,7 +130,7 @@ public class ScmReport
public void executeReport( Locale locale )
throws MavenReportException
{
ScmRenderer r = new ScmRenderer( getSink(), getProject().getModel(), locale );
ScmRenderer r = new ScmRenderer( scmManager, getSink(), getProject().getModel(), locale );
r.render();
}
@ -135,10 +150,19 @@ public class ScmReport
private Locale locale;
public ScmRenderer( Sink sink, Model model, Locale locale )
private ScmManager scmManager;
/** To support more SCM */
private String anonymousConnection;
private String devConnection;
public ScmRenderer( ScmManager scmManager, Sink sink, Model model, Locale locale )
{
super( sink );
this.scmManager = scmManager;
this.model = model;
this.locale = locale;
@ -169,32 +193,59 @@ public class ScmReport
return;
}
String connection = scm.getConnection();
String devConnection = scm.getDeveloperConnection();
anonymousConnection = scm.getConnection();
devConnection = scm.getDeveloperConnection();
boolean isSvnConnection = isScmSystem( connection, "svn" );
boolean isCvsConnection = isScmSystem( connection, "cvs" );
boolean isVssConnection = isScmSystem( connection, "vss" );
ScmRepository anonymousRepository = getScmRepository( anonymousConnection );
ScmRepository devRepository = getScmRepository( devConnection );
boolean isSvnDevConnection = isScmSystem( devConnection, "svn" );
boolean isCvsDevConnection = isScmSystem( devConnection, "cvs" );
boolean isVssDevConnection = isScmSystem( devConnection, "vss" );
// Overview section
renderOverViewSection( anonymousRepository );
// Overview
// Web access section
renderWebAccesSection( scm.getUrl() );
// Anonymous access section if needed
renderAnonymousAccessSection( anonymousRepository );
// Developer access section
renderDeveloperAccessSection( devRepository );
// Access from behind a firewall section if needed
renderAccessBehindFirewallSection( devRepository );
// Access through a proxy section if needed
renderAccessThroughProxySection( anonymousRepository, devRepository );
}
/**
* Render the overview section
*
* @param anonymousRepository the anonymous repository
*/
private void renderOverViewSection( ScmRepository anonymousRepository )
{
startSection( getBundle( locale ).getString( "report.scm.overview.title" ) );
if ( isSvnConnection )
if ( isScmSystem( anonymousRepository, "clearcase" ) )
{
linkPatternedText( getBundle( locale ).getString( "report.scm.svn.intro" ) );
linkPatternedText( getBundle( locale ).getString( "report.scm.clearcase.intro" ) );
}
else if ( isCvsConnection )
else if ( isScmSystem( anonymousRepository, "cvs" ) )
{
linkPatternedText( getBundle( locale ).getString( "report.scm.cvs.intro" ) );
}
else if ( isVssConnection )
else if ( isScmSystem( anonymousRepository, "perforce" ) )
{
linkPatternedText( getBundle( locale ).getString( "report.scm.vss.intro" ) );
linkPatternedText( getBundle( locale ).getString( "report.scm.perforce.intro" ) );
}
else if ( isScmSystem( anonymousRepository, "starteam" ) )
{
linkPatternedText( getBundle( locale ).getString( "report.scm.starteam.intro" ) );
}
else if ( isScmSystem( anonymousRepository, "svn" ) )
{
linkPatternedText( getBundle( locale ).getString( "report.scm.svn.intro" ) );
}
else
{
@ -202,11 +253,18 @@ public class ScmReport
}
endSection();
}
// Web access
/**
* Render the web access section
*
* @param scmUrl The URL to the project's browsable repository.
*/
private void renderWebAccesSection( String scmUrl )
{
startSection( getBundle( locale ).getString( "report.scm.webaccess.title" ) );
if ( scm.getUrl() == null )
if ( scmUrl == null )
{
paragraph( getBundle( locale ).getString( "report.scm.webaccess.nourl" ) );
}
@ -214,146 +272,127 @@ public class ScmReport
{
paragraph( getBundle( locale ).getString( "report.scm.webaccess.url" ) );
verbatimLink( scm.getUrl(), scm.getUrl() );
verbatimLink( scmUrl, scmUrl );
}
endSection();
}
// Anonymous access
if ( !StringUtils.isEmpty( connection ) )
/**
* Render the anonymous access section depending the repository.
* <p>Note: ClearCase, Starteam et Perforce seems to have no anonymous access.</>
*
* @param anonymousRepository the anonymous repository
*/
private void renderAnonymousAccessSection( ScmRepository anonymousRepository )
{
if ( ( isScmSystem( anonymousRepository, "clearcase" ) )
|| ( isScmSystem( anonymousRepository, "perforce" ) )
|| ( isScmSystem( anonymousRepository, "starteam" ) ) )
{
// Validation
validConnection( connection );
startSection( getBundle( locale ).getString( "report.scm.anonymousaccess.title" ) );
if ( isSvnConnection )
{
paragraph( getBundle( locale ).getString( "report.scm.anonymousaccess.svn.intro" ) );
// Example:
// $> svn checkout
// http://svn.apache.org/repos/asf/maven/components/trunk
// maven
StringBuffer sb = new StringBuffer();
sb.append( "$>svn checkout " ).append( getSvnRoot( connection ) ).append( " " )
.append( model.getArtifactId() );
verbatimText( sb.toString() );
}
else if ( isCvsConnection )
{
paragraph( getBundle( locale ).getString( "report.scm.anonymousaccess.cvs.intro" ) );
// Example:
// cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic
// login
// cvs -z3 -d
// :pserver:anoncvs@cvs.apache.org:/home/cvspublic co
// maven-plugins/dist
String[] connectionDef = StringUtils.split( connection, ":" );
StringBuffer command = new StringBuffer();
command.append( "$>cvs -d " ).append( getCvsRoot( connection, "" ) ).append( " login" );
command.append( "\n" );
command.append( "$>cvs -z3 -d " ).append( getCvsRoot( connection, "" ) ).append( " co " )
.append( getCvsModule( connection ) );
verbatimText( command.toString() );
}
else if ( isVssConnection )
{
paragraph( getBundle( locale ).getString( "report.scm.anonymousaccess.vss.intro" ) );
verbatimText( getVssRoot( connection, "" ) );
}
else
{
paragraph( getBundle( locale ).getString( "report.scm.anonymousaccess.general.intro" ) );
verbatimText( connection.substring( 4 ) );
}
endSection();
return;
}
// Developer access
if ( !StringUtils.isEmpty( devConnection ) )
startSection( getBundle( locale ).getString( "report.scm.anonymousaccess.title" ) );
if ( ( anonymousRepository != null ) && ( isScmSystem( anonymousRepository, "cvs" ) ) )
{
// Validation
validConnection( devConnection );
CvsScmProviderRepository cvsRepo = (CvsScmProviderRepository) anonymousRepository
.getProviderRepository();
startSection( getBundle( locale ).getString( "report.scm.devaccess.title" ) );
anonymousAccessCVS( cvsRepo );
}
else if ( ( anonymousRepository != null ) && ( isScmSystem( anonymousRepository, "svn" ) ) )
{
SvnScmProviderRepository svnRepo = (SvnScmProviderRepository) anonymousRepository
.getProviderRepository();
if ( isSvnDevConnection )
{
paragraph( getBundle( locale ).getString( "report.scm.devaccess.svn.intro1" ) );
anonymousAccessSVN( svnRepo );
}
else
{
paragraph( getBundle( locale ).getString( "report.scm.anonymousaccess.general.intro" ) );
// Example:
// $> svn checkout
// https://svn.apache.org/repos/asf/maven/components/trunk
// maven
StringBuffer sb = new StringBuffer();
sb.append( "$>svn checkout " ).append( getSvnRoot( devConnection ) ).append( " " )
.append( model.getArtifactId() );
verbatimText( sb.toString() );
paragraph( getBundle( locale ).getString( "report.scm.devaccess.svn.intro2" ) );
sb = new StringBuffer();
sb.append( "$>svn commit --username your-username -m \"A message\"" );
verbatimText( sb.toString() );
}
else if ( isCvsDevConnection )
{
paragraph( getBundle( locale ).getString( "report.scm.devaccess.cvs.intro" ) );
// Example:
// cvs -d :pserver:username@cvs.apache.org:/home/cvs login
// cvs -z3 -d :ext:username@cvs.apache.org:/home/cvs co
// maven-plugins/dist
String[] connectionDef = StringUtils.split( devConnection, ":" );
StringBuffer command = new StringBuffer();
command.append( "$>cvs -d " ).append( getCvsRoot( devConnection, "username" ) ).append( " login" );
command.append( "\n" );
command.append( "$>cvs -z3 -d " ).append( getCvsRoot( devConnection, "username" ) ).append( " co " )
.append( getCvsModule( devConnection ) );
verbatimText( command.toString() );
}
else if ( isVssDevConnection )
{
paragraph( getBundle( locale ).getString( "report.scm.devaccess.vss.intro" ) );
verbatimText( getVssRoot( connection, "username" ) );
}
else
{
paragraph( getBundle( locale ).getString( "report.scm.devaccess.general.intro" ) );
verbatimText( connection.substring( 4 ) );
}
endSection();
verbatimText( anonymousConnection.substring( 4 ) );
}
// Access from behind a firewall
endSection();
}
/**
* Render the developer access section
*
* @param devRepository the dev repository
*/
private void renderDeveloperAccessSection( ScmRepository devRepository )
{
startSection( getBundle( locale ).getString( "report.scm.devaccess.title" ) );
if ( ( devRepository != null ) && ( isScmSystem( devRepository, "clearcase" ) ) )
{
ClearCaseScmProviderRepository clearCaseRepo = (ClearCaseScmProviderRepository) devRepository
.getProviderRepository();
developerAccessClearCase( clearCaseRepo );
}
else if ( ( devRepository != null ) && ( isScmSystem( devRepository, "cvs" ) ) )
{
CvsScmProviderRepository cvsRepo = (CvsScmProviderRepository) devRepository.getProviderRepository();
developerAccessCVS( cvsRepo );
}
else if ( ( devRepository != null ) && ( isScmSystem( devRepository, "perforce" ) ) )
{
PerforceScmProviderRepository perforceRepo = (PerforceScmProviderRepository) devRepository
.getProviderRepository();
developerAccessPerforce( perforceRepo );
}
else if ( ( devRepository != null ) && ( isScmSystem( devRepository, "starteam" ) ) )
{
StarteamScmProviderRepository starteamRepo = (StarteamScmProviderRepository) devRepository
.getProviderRepository();
developerAccessStarteam( starteamRepo );
}
else if ( ( devRepository != null ) && ( isScmSystem( devRepository, "svn" ) ) )
{
SvnScmProviderRepository svnRepo = (SvnScmProviderRepository) devRepository.getProviderRepository();
developerAccessSVN( svnRepo );
}
else
{
paragraph( getBundle( locale ).getString( "report.scm.devaccess.general.intro" ) );
verbatimText( devConnection.substring( 4 ) );
}
endSection();
}
/**
* Render the access from behind a firewall section
*
* @param devRepository the dev repository
*/
private void renderAccessBehindFirewallSection( ScmRepository devRepository )
{
startSection( getBundle( locale ).getString( "report.scm.accessbehindfirewall.title" ) );
if ( isSvnDevConnection )
if ( ( devRepository != null ) && ( isScmSystem( devRepository, "svn" ) ) )
{
SvnScmProviderRepository svnRepo = (SvnScmProviderRepository) devRepository.getProviderRepository();
paragraph( getBundle( locale ).getString( "report.scm.accessbehindfirewall.svn.intro" ) );
StringBuffer sb = new StringBuffer();
sb.append( "$>svn checkout " ).append( getSvnRoot( devConnection ) ).append( " " )
.append( model.getArtifactId() );
sb.append( "$>svn checkout " ).append( svnRepo.getUrl() ).append( " " ).append( model.getArtifactId() );
verbatimText( sb.toString() );
}
else if ( isCvsDevConnection )
else if ( ( devRepository != null ) && ( isScmSystem( devRepository, "cvs" ) ) )
{
paragraph( getBundle( locale ).getString( "report.scm.accessbehindfirewall.cvs.intro" ) );
linkPatternedText( getBundle( locale ).getString( "report.scm.accessbehindfirewall.cvs.intro" ) );
}
else
{
@ -361,9 +400,17 @@ public class ScmReport
}
endSection();
}
// Access through a proxy
if ( isSvnConnection || isSvnDevConnection )
/**
* Render the access from behind a firewall section
*
* @param anonymousRepository the anonymous repository
* @param devRepository the dev repository
*/
private void renderAccessThroughProxySection( ScmRepository anonymousRepository, ScmRepository devRepository )
{
if ( ( isScmSystem( anonymousRepository, "svn" ) ) || ( isScmSystem( devRepository, "svn" ) ) )
{
startSection( getBundle( locale ).getString( "report.scm.accessthroughtproxy.title" ) );
@ -372,7 +419,8 @@ public class ScmReport
paragraph( getBundle( locale ).getString( "report.scm.accessthroughtproxy.svn.intro3" ) );
StringBuffer sb = new StringBuffer();
sb.append( "[global]" ).append( "\n" );
sb.append( "[global]" );
sb.append( "\n" );
sb.append( "http-proxy-host = your.proxy.name" ).append( "\n" );
sb.append( "http-proxy-port = 3128" ).append( "\n" );
verbatimText( sb.toString() );
@ -381,166 +429,242 @@ public class ScmReport
}
}
// Clearcase
/**
* Checks if a SCM connection is a SVN, CVS...
* Create the documentation to provide an developer access with a <code>Clearcase</code> SCM.
* For example, generate the following command line:
* <p>cleartool checkout module</p>
*
* @return true if the SCM is a SVN, CVS server, false otherwise.
* @param clearCaseRepo
*/
private static boolean isScmSystem( String connection, String scm )
private void developerAccessClearCase( ClearCaseScmProviderRepository clearCaseRepo )
{
if ( StringUtils.isEmpty( connection ) )
paragraph( getBundle( locale ).getString( "report.scm.devaccess.clearcase.intro" ) );
StringBuffer command = new StringBuffer();
command.append( "$>cleartool checkout " ).append( clearCaseRepo.getModule() );
verbatimText( command.toString() );
}
// CVS
/**
* Create the documentation to provide an anonymous access with a <code>CVS</code> SCM.
* For example, generate the following command line:
* <p>cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic login</p>
* <p>cvs -z3 -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic co maven-plugins/dist</p>
*
* @see <a href="https://www.cvshome.org/docs/manual/cvs-1.12.12/cvs_16.html#SEC115">https://www.cvshome.org/docs/manual/cvs-1.12.12/cvs_16.html#SEC115</a>
*
* @param cvsRepo
*/
private void anonymousAccessCVS( CvsScmProviderRepository cvsRepo )
{
paragraph( getBundle( locale ).getString( "report.scm.anonymousaccess.cvs.intro" ) );
StringBuffer command = new StringBuffer();
command.append( "$>cvs -d " ).append( cvsRepo.getCvsRoot() ).append( " login" );
command.append( "\n" );
command.append( "$>cvs -z3 -d " ).append( cvsRepo.getCvsRoot() );
command.append( " co " ).append( cvsRepo.getModule() );
verbatimText( command.toString() );
}
/**
* Create the documentation to provide an developer access with a <code>CVS</code> SCM.
* For example, generate the following command line:
* <p>cvs -d :pserver:username@cvs.apache.org:/home/cvs login</p>
* <p>cvs -z3 -d :ext:username@cvs.apache.org:/home/cvs co maven-plugins/dist</p>
*
* @see <a href="https://www.cvshome.org/docs/manual/cvs-1.12.12/cvs_16.html#SEC115">https://www.cvshome.org/docs/manual/cvs-1.12.12/cvs_16.html#SEC115</a>
*
* @param cvsRepo
*/
private void developerAccessCVS( CvsScmProviderRepository cvsRepo )
{
paragraph( getBundle( locale ).getString( "report.scm.devaccess.cvs.intro" ) );
// Safety: remove the username if present
String cvsRoot = StringUtils.replace( cvsRepo.getCvsRoot(), cvsRepo.getUser(), "username" );
StringBuffer command = new StringBuffer();
command.append( "$>cvs -d " ).append( cvsRoot ).append( " login" );
command.append( "\n" );
command.append( "$>cvs -z3 -d " ).append( cvsRoot ).append( " co " ).append( cvsRepo.getModule() );
verbatimText( command.toString() );
}
// Perforce
/**
* Create the documentation to provide an developer access with a <code>Perforce</code> SCM.
* For example, generate the following command line:
* <p>p4 -H hostname -p port -u username -P password path</p>
* <p>p4 -H hostname -p port -u username -P password path submit -c changement</p>
*
* @see <a href="http://www.perforce.com/perforce/doc.051/manuals/cmdref/index.html">http://www.perforce.com/perforce/doc.051/manuals/cmdref/index.html</>
*
* @param perforceRepo
*/
private void developerAccessPerforce( PerforceScmProviderRepository perforceRepo )
{
paragraph( getBundle( locale ).getString( "report.scm.devaccess.perforce.intro" ) );
StringBuffer command = new StringBuffer();
command.append( "$>p4" );
if ( !StringUtils.isEmpty( perforceRepo.getHost() ) )
{
command.append( " -H " ).append( perforceRepo.getHost() );
}
if ( perforceRepo.getPort() > 0 )
{
command.append( " -p " + perforceRepo.getPort() );
}
command.append( " -u username" );
command.append( " -P password" );
command.append( " " );
command.append( perforceRepo.getPath() );
command.append( "\n" );
command.append( "$>p4 submit -c \"A comment\"" );
verbatimText( command.toString() );
}
// Starteam
/**
* Create the documentation to provide an developer access with a <code>Starteam</code> SCM.
* For example, generate the following command line:
* <p>stcmd co -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl -is</p>
* <p>stcmd ci -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl -f NCI -is</p>
*
* @param starteamRepo
*/
private void developerAccessStarteam( StarteamScmProviderRepository starteamRepo )
{
paragraph( getBundle( locale ).getString( "report.scm.devaccess.starteam.intro" ) );
StringBuffer command = new StringBuffer();
// Safety: remove the username/password if present
String fullUrl = StringUtils.replace( starteamRepo.getFullUrl(), starteamRepo.getUser(), "username" );
fullUrl = StringUtils.replace( fullUrl, starteamRepo.getPassword(), "password" );
command.append( "$>stcmd co -x -nologo -stop -p " );
command.append( fullUrl );
command.append( " -is" );
command.append( "\n" );
command.append( "$>stcmd ci -x -nologo -stop -p " );
command.append( fullUrl );
command.append( " -f NCI -is" );
verbatimText( command.toString() );
}
// SVN
/**
* Create the documentation to provide an anonymous access with a <code>SVN</code> SCM.
* For example, generate the following command line:
* <p>svn checkout http://svn.apache.org/repos/asf/maven/components/trunk maven</p>
*
* @see <a href="http://svnbook.red-bean.com/">http://svnbook.red-bean.com/</a>
*
* @param svnRepo
*/
private void anonymousAccessSVN( SvnScmProviderRepository svnRepo )
{
paragraph( getBundle( locale ).getString( "report.scm.anonymousaccess.svn.intro" ) );
StringBuffer sb = new StringBuffer();
sb.append( "$>svn checkout " ).append( svnRepo.getUrl() ).append( " " ).append( model.getArtifactId() );
verbatimText( sb.toString() );
}
/**
* Create the documentation to provide an developer access with a <code>SVN</code> SCM.
* For example, generate the following command line:
* <p>svn checkout https://svn.apache.org/repos/asf/maven/components/trunk maven</p>
* <p>svn commit --username your-username -m "A message"</p>
*
* @see <a href="http://svnbook.red-bean.com/">http://svnbook.red-bean.com/</a>
*
* @param svnRepo
*/
private void developerAccessSVN( SvnScmProviderRepository svnRepo )
{
paragraph( getBundle( locale ).getString( "report.scm.devaccess.svn.intro1" ) );
StringBuffer sb = new StringBuffer();
sb.append( "$>svn checkout " ).append( svnRepo.getUrl() ).append( " " ).append( model.getArtifactId() );
verbatimText( sb.toString() );
paragraph( getBundle( locale ).getString( "report.scm.devaccess.svn.intro2" ) );
sb = new StringBuffer();
sb.append( "$>svn commit --username your-username -m \"A message\"" );
verbatimText( sb.toString() );
}
/**
* Return a <code>SCM repository</code> defined by a given url
*
* @param scmUrl an SCM URL
* @return a valid SCM repository or null
*/
public ScmRepository getScmRepository( String scmUrl )
{
if ( scmUrl == null )
{
return null;
}
try
{
return scmManager.makeScmRepository( scmUrl );
}
catch ( NoSuchScmProviderException e )
{
return null;
}
catch ( ScmRepositoryException e )
{
return null;
}
}
/**
* Convenience method that return true is the defined <code>SCM repository</code> is a known provider.
* <p>Actually, we fully support Clearcase, CVS, Perforce, Starteam, SVN by the maven-scm-providers component.</p>
*
* @see <a href="http://svn.apache.org/repos/asf/maven/scm/trunk/maven-scm-providers/">maven-scm-providers</a>
*
* @param scmRepository a SCM repository
* @param scmProvider a SCM provider name
* @return true if the provider of the given SCM repository is equal to the given scm provider.
*/
private static boolean isScmSystem( ScmRepository scmRepository, String scmProvider )
{
if ( StringUtils.isEmpty( scmProvider ) )
{
return false;
}
if ( StringUtils.isEmpty( scm ) )
{
return false;
}
if ( connection.toLowerCase().substring( 4 ).startsWith( scm ) )
if ( ( scmRepository != null ) && ( scmProvider.equalsIgnoreCase( scmRepository.getProvider() ) ) )
{
return true;
}
return false;
}
/**
* Get the SVN root from a connection
*
* @param connection
* a valid SVN connection
* @return the svn connection
*/
private static String getSvnRoot( String connection )
{
if ( !isScmSystem( connection, "svn" ) )
{
throw new IllegalArgumentException( "Cannot get the SVN root from a none SVN SCM." );
}
String[] connectionDef = StringUtils.split( connection, ":" );
if ( connectionDef.length != 4 )
{
throw new IllegalArgumentException( "The SVN repository connection is not valid." );
}
return connectionDef[2] + ":" + connectionDef[3];
}
/**
* Get the CVS root from the connection
*
* @param connection
* a valid CVS connection
* @param username
* @return the CVS root
*/
private static String getCvsRoot( String connection, String username )
{
if ( !isScmSystem( connection, "cvs" ) )
{
throw new IllegalArgumentException( "Cannot get the CVS root from a none CVS SCM." );
}
String[] connectionDef = StringUtils.split( connection, ":" );
if ( connectionDef.length != 6 )
{
throw new IllegalArgumentException( "The CVS repository connection is not valid." );
}
if ( connectionDef[3].indexOf( '@' ) >= 0 )
{
if ( StringUtils.isEmpty( username ) )
{
username = connectionDef[3].substring( 0, connectionDef[3].indexOf( '@' ) );
}
connectionDef[3] = username + "@" + connectionDef[3].substring( connectionDef[3].indexOf( '@' ) + 1 );
}
return ":" + connectionDef[2] + ":" + connectionDef[3] + ":" + connectionDef[4];
}
/**
* Get the CVS module from a connection
*
* @param connection
* a valid CVS connection
* @return the CVS module
*/
private static String getCvsModule( String connection )
{
if ( !isScmSystem( connection, "cvs" ) )
{
throw new IllegalArgumentException( "Cannot get the CVS root from a none CVS SCM." );
}
String[] connectionDef = StringUtils.split( connection, ":" );
if ( connectionDef.length != 6 )
{
throw new IllegalArgumentException( "The CVS repository connection is not valid." );
}
return connectionDef[5];
}
/**
* Get a VSS root.
*
* @param connection
* a valid VSS connection
* @param username
* @return the VSS root
*/
private static String getVssRoot( String connection, String username )
{
if ( !isScmSystem( connection, "vss" ) )
{
throw new IllegalArgumentException( "Cannot get the VSS root from a none VSS SCM." );
}
String[] connectionDef = StringUtils.split( connection, ":" );
if ( connectionDef.length != 5 )
{
throw new IllegalArgumentException( "The VSS repository connection is not valid." );
}
if ( StringUtils.isEmpty( username ) )
{
username = connectionDef[3];
}
return connectionDef[1] + ":" + connectionDef[2] + ":" + username + ":" + connectionDef[4];
}
/**
* Convenience method that valid a given connection.
* <p>
* Throw an <code>IllegalArgumentException</code> if the connection is
* not a valid one.
* </p>
*
* @param connection
*/
private static void validConnection( String connection )
{
if ( StringUtils.isEmpty( connection ) )
{
throw new IllegalArgumentException( "The source repository connection could not be null." );
}
if ( connection.length() < 4 )
{
throw new IllegalArgumentException( "The source repository connection is too short." );
}
if ( !connection.startsWith( "scm" ) )
{
throw new IllegalArgumentException( "The source repository connection must start with scm." );
}
}
}
private static ResourceBundle getBundle( Locale locale )

View File

@ -83,27 +83,30 @@ report.scm.description=This is a link to the online source repository that can b
report.scm.noscm=No source configuration management system is defined. Please check back at a later date.
report.scm.title=Source Repository
report.scm.overview.title=Overview
report.scm.svn.intro=This project uses {Subversion, http://subversion.tigris.org/} to manage its source code. Instructions on Subversion use can be found at {http://svnbook.red-bean.com/, http://svnbook.red-bean.com/}.
report.scm.cvs.intro=This project uses {Concurrent Versions System, http://www.cvshome.org/} to manage its source code. Instructions on CVS use can be found at {http://cvsbook.red-bean.com/, http://cvsbook.red-bean.com/}.
report.scm.vss.intro=This project uses {Visual SourceSafe, http://msdn.microsoft.com/ssafe/} to manage its source code.
report.scm.clearcase.intro=This project uses {ClearCase, http://www-306.ibm.com/software/awdtools/clearcase/} to manage its source code. Informations on ClearCase use can be found at {http://www.redbooks.ibm.com/redbooks/pdfs/sg246399.pdf, http://www.redbooks.ibm.com/redbooks/pdfs/sg246399.pdf}.
report.scm.cvs.intro=This project uses {Concurrent Versions System, http://www.cvshome.org/} to manage its source code. Instructions on CVS use can be found at {http://cvsbook.red-bean.com/, http://cvsbook.red-bean.com/}.
report.scm.perforce.intro=This project uses {Perforce, http://www.perforce.com/} to manage its source code. Instructions on Perforce use can be found at {http://www.perforce.com/perforce/doc.051/manuals/cmdref/index.html, http://www.perforce.com/perforce/doc.051/manuals/cmdref/index.html}.
report.scm.starteam.intro=This project uses {Starteam, http://www.borland.com/us/products/starteam/} to manage its source code.
report.scm.svn.intro=This project uses {Subversion, http://subversion.tigris.org/} to manage its source code. Instructions on Subversion use can be found at {http://svnbook.red-bean.com/, http://svnbook.red-bean.com/}.
report.scm.general.intro=This project uses a Source Content Management System to manage its source code.
report.scm.webaccess.title=Web Access
report.scm.webaccess.url=The following is a link to the online source repository.
report.scm.webaccess.nourl=There are no online source repository listed for this project. Please check back again later.
report.scm.anonymousaccess.title=Anonymous access
report.scm.anonymousaccess.cvs.intro=This project's CVS repository can be checked out through anonymous CVS with the following instruction set. When prompted for a password for anonymous, simply press the Enter key.
report.scm.anonymousaccess.svn.intro=The source can be checked out anonymously from SVN with this command:
report.scm.anonymousaccess.cvs.intro=This project's CVS repository can be checked out through anonymous CVS with the following instruction set. When prompted for a password for anonymous, simply press the Enter key.
report.scm.anonymousaccess.vss.intro=This project's VSS repository can be checked out through anonymous with the following URL. Refer to VSS documentation for more information about anonymously check out.
report.scm.anonymousaccess.general.intro=Refer to the documentation of the SCM used for more information about anonymously check out. The connection url is:
report.scm.devaccess.title=Developer access
report.scm.devaccess.title=Developer access
report.scm.devaccess.clearcase.intro=Only project developers can access the ClearCase tree via this method. Substitute username with the proper value.
report.scm.devaccess.cvs.intro=Only project developers can access the CVS tree via this method. Substitute username with the proper value.
report.scm.devaccess.perforce.intro=Only project developers can access the Perforce tree via this method. Substitute username and password with the proper value.
report.scm.devaccess.starteam.intro=Only project developers can access the Starteam tree via this method. Substitute username with the proper value.
report.scm.devaccess.svn.intro1=Everyone can access the Subversion repository via HTTPS, but Committers must checkout the Subversion repository via HTTPS.
report.scm.devaccess.svn.intro2=To commit changes to the repository, execute the following command to commit your changes (svn will prompt you for your password)
report.scm.devaccess.cvs.intro=Only project developers can access the CVS tree via this method. Substitute username with the proper value.
report.scm.devaccess.vss.intro=Only project developers can access the VSS tree. Substitute username with the proper value.
report.scm.devaccess.general.intro=Refer to the documentation of the SCM used for more information about developer checked out. The connection url is:
report.scm.accessbehindfirewall.title=Access from behind a firewall
report.scm.accessbehindfirewall.svn.intro=For those users who are stuck behind a corporate firewall which is blocking http access to the Subversion repository, you can try to access it via the developer connection:
report.scm.accessbehindfirewall.cvs.intro=For those developers who are stuck behind a corporate firewall, {CVSGrab, http://cvsgrab.sourceforge.net/) can use the viewcvs web interface to checkout the source code}.
report.scm.accessbehindfirewall.cvs.intro=For those developers who are stuck behind a corporate firewall, {CVSGrab, http://cvsgrab.sourceforge.net/} can use the viewcvs web interface to checkout the source code.
report.scm.accessbehindfirewall.general.intro=Refer to the documentation of the SCM used for more information about an access behind a firewall.
report.scm.accessthroughtproxy.title=Access through a proxy
report.scm.accessthroughtproxy.svn.intro1=The Subversion client can go through a proxy, if you configure it to do so. First, edit your "servers" configuration file to indicate which proxy to use. The files location depends on your operating system. On Linux or Unix it is located in the directory "~/.subversion". On Windows it is in "%APPDATA%\Subversion". (Try "echo %APPDATA%", note this is a hidden directory.)

View File

@ -82,28 +82,31 @@ report.scm.name=D
report.scm.description=C'est un lien au dépôt de sources en ligne qui peut être regardé par l'intermédiaire d'un browser Web.
report.scm.noscm=Aucun système de dépôt SCM n'est défini. Vérifiez plus tard si un SCM a été ajouté.
report.scm.title=Dépôt de sources
report.scm.overview.title=Vue d'ensemble
report.scm.svn.intro=Ce projet utilise {Subversion, http://subversion.tigris.org/} pour gérer son code source. Des instructions sur l'utilisation de Subversion peuvent être trouvées à {http://svnbook.red-bean.com/, http://svnbook.red-bean.com/}.
report.scm.cvs.intro=Ce projet utilise {Concurrent Versions System, http://www.cvshome.org/} pour gérer son code source. Des instructions sur l'utilisation de CVS peuvent être trouvées à {http://cvsbook.red-bean.com/, http://cvsbook.red-bean.com/}.
report.scm.vss.intro=Ce projet utilise {Visual SourceSafe, http://msdn.microsoft.com/ssafe/} pour gérer son code source.
report.scm.overview.title=Vue d'ensemble
report.scm.clearcase.intro=Ce projet utilise {ClearCase, http://www-306.ibm.com/software/awdtools/clearcase/} comme dépôt de sources pour gérer son code source.
report.scm.cvs.intro=Ce projet utilise {Concurrent Versions System, http://www.cvshome.org/} pour gérer son code source. Des instructions sur l'utilisation de Perforce peuvent être trouvées à {http://cvsbook.red-bean.com/, http://cvsbook.red-bean.com/}.
report.scm.perforce.intro=Ce projet utilise {Perforce, http://www.perforce.com/} comme dépôt de sources pour gérer son code source. Des instructions sur l'utilisation de CVS peuvent être trouvées à {http://www.perforce.com/perforce/doc.051/manuals/cmdref/index.html, http://www.perforce.com/perforce/doc.051/manuals/cmdref/index.html}.
report.scm.starteam.intro=Ce projet utilise {Starteam, http://www.borland.com/us/products/starteam/} comme dépôt de sources pour gérer son code source.
report.scm.svn.intro=Ce projet utilise {Subversion, http://subversion.tigris.org/} pour gérer son code source. Des instructions sur l'utilisation de Subversion peuvent être trouvées à {http://svnbook.red-bean.com/, http://svnbook.red-bean.com/}.
report.scm.general.intro=Ce projet utilise un dépôt de sources pour gérer son code source.
report.scm.webaccess.title=Accès Web
report.scm.webaccess.url=Ce qui suit est le lien online du dépôt de sources.
report.scm.webaccess.nourl=Aucun lien au système de dépôt SCM n'est défini. Vérifiez plus tard si ce lien a été ajouté.
report.scm.anonymousaccess.title=Accès de façon anonyme
report.scm.anonymousaccess.svn.intro=Le dépôt d'archive SVN de ce projet peut être vérifié de façon anonyme avec les instructions suivantes.:
report.scm.anonymousaccess.cvs.intro=Le dépôt d'archive CVS de ce projet peut être vérifié de façon anonyme avec les instructions suivantes. Lorsqu'un mot de passe pour anonyme est demandé, appuyez simplement sur la touche Enter.
report.scm.anonymousaccess.vss.intro=Le dépôt d'archive VSS de ce projet peut être vérifié de façon anonyme avec l'URL suivante. Référez-vous à la documentation de VSS pour plus d'informations sur cette instruction.
report.scm.anonymousaccess.svn.intro=Le dépôt d'archive SVN de ce projet peut être vérifié de façon anonyme avec les instructions suivantes:
report.scm.anonymousaccess.general.intro=Référez-vous à la documentation du dépôt d'archive utilisé pour plus d'informations sur l'accès anonyme. L'URL de connection est:
report.scm.devaccess.title=Accès pour les dévelopeurs
report.scm.devaccess.clearcase.intro=Seulement les dévelopeurs du projet peuvent accéder à l'arbre de ClearCase par l'intermédiaire de cette méthode. Remplacez username avec la valeur appropriée.
report.scm.devaccess.cvs.intro=Seulement les dévelopeurs du projet peuvent accéder à l'arbre de CVS par l'intermédiaire de cette méthode. Remplacez username avec la valeur appropriée.
report.scm.devaccess.perforce.intro=Seulement les dévelopeurs du projet peuvent accéder à l'arbre de Perforce par l'intermédiaire de cette méthode. Remplacez username et password avec la valeur appropriée.
report.scm.devaccess.starteam.intro=Seulement les dévelopeurs du projet peuvent accéder à l'arbre de Starteam par l'intermédiaire de cette méthode. Remplacez username avec la valeur appropriée.
report.scm.devaccess.svn.intro1=Chacun peut accéder au dépôt d'archive de Subversion via HTTPS, mais seuls les committers doivent accéder au dépôt d'archive via HTTPS.
report.scm.devaccess.svn.intro2=Pour commiter les changements dans le dépôt, éxecuter la ligne de commande suivante (SVN pourra vous demander votre mot de passe)
report.scm.devaccess.cvs.intro=Seulement les dévelopeurs du projet peuvent accéder à l'arbre de CVS par l'intermédiaire de cette méthode. Remplacez username avec la valeur appropriée.
report.scm.devaccess.vss.intro=Seulement les dévelopeurs du projet peuvent accéder à l'arbre de VSS. Remplacez username avec la valeur appropriée.
report.scm.devaccess.general.intro=Référez-vous à la documentation du dépôt d'archive utilisé pour plus d'informations sur l'accès en tant que développeur. L'URL de connection est:
report.scm.accessbehindfirewall.title=Accès derrière un firewall
report.scm.accessbehindfirewall.svn.intro=Pour ces utilisateurs qui sont coincés derrière un firewall qui bloque l'accès de HTTP au dépôt de Subversion, vous pouvez essayer d'y accéder avec la connection développeur:
report.scm.accessbehindfirewall.cvs.intro=Pour les dévelopeurs qui sont coincés derrière un firewall, {CVSGrab, http://cvsgrab.sourceforge.net/) peut utiliser l'interface Web pour effectuer un checkout du code source.
report.scm.accessbehindfirewall.cvs.intro=Pour les dévelopeurs qui sont coincés derrière un firewall, {CVSGrab, http://cvsgrab.sourceforge.net/} peut utiliser l'interface Web pour effectuer un checkout du code source.
report.scm.accessbehindfirewall.general.intro=Référez-vous à la documentation du dépôt d'archive utilisé pour plus d'informations sur l'accès derrière un firewall.
report.scm.accessthroughtproxy.title=Accès avec un proxy
report.scm.accessthroughtproxy.svn.intro1=Le client de subversion peut accéder par proxy, si vous le configurez comme suit. D'abord, éditez votre dossier de configuration de "servers" pour indiquer quel proxy utilisé. Ce fichier est situé différemment dépendamment de votre système d'exploitation. Sur Linux ou Unix, il est situé dans le répertoire "~/.subversion". Sur Windows, il se situe dans "%APPDATA%\Subversion". (essayer de taper "echo %APPDATA%", notons que ce répertoire est caché.)