Author: hboutemy Date: Wed Mar 6 01:46:34 2013 New Revision: 1453123 URL: http://svn.apache.org/r1453123 Log: [MPIR-271] added GIT support in project-info-reports:scm Submitted by: Mirko Friedenhagen
Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ScmReport.java maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report.properties Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ScmReport.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ScmReport.java?rev=1453123&r1=1453122&r2=1453123&view=diff ============================================================================== --- maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ScmReport.java (original) +++ maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ScmReport.java Wed Mar 6 01:46:34 2013 @@ -30,6 +30,7 @@ import org.apache.maven.plugins.annotati import org.apache.maven.scm.manager.NoSuchScmProviderException; import org.apache.maven.scm.manager.ScmManager; import org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository; +import org.apache.maven.scm.provider.git.repository.GitScmProviderRepository; import org.apache.maven.scm.provider.hg.repository.HgScmProviderRepository; import org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository; import org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository; @@ -246,6 +247,12 @@ public class ScmReport linkPatternedText( getI18nString( "cvs.intro" ) ); sink.paragraph_(); } + else if ( isScmSystem( anonymousRepository, "git" ) ) + { + sink.paragraph(); + linkPatternedText( getI18nString( "git.intro" ) ); + sink.paragraph_(); + } else if ( isScmSystem( anonymousRepository, "hg" ) ) { sink.paragraph(); @@ -324,7 +331,14 @@ public class ScmReport anonymousAccessCVS( cvsRepo ); } - if ( anonymousRepository != null && isScmSystem( anonymousRepository, "hg" ) ) + else if ( anonymousRepository != null && isScmSystem( anonymousRepository, "git" ) ) + { + GitScmProviderRepository gitRepo = (GitScmProviderRepository) anonymousRepository + .getProviderRepository(); + + anonymousAccessGit( gitRepo ); + } + else if ( anonymousRepository != null && isScmSystem( anonymousRepository, "hg" ) ) { HgScmProviderRepository hgRepo = (HgScmProviderRepository) anonymousRepository .getProviderRepository(); @@ -372,6 +386,12 @@ public class ScmReport developerAccessCVS( cvsRepo ); } + else if ( devRepository != null && isScmSystem( devRepository, "git" ) ) + { + GitScmProviderRepository gitRepo = (GitScmProviderRepository) devRepository.getProviderRepository(); + + developerAccessGit( gitRepo ); + } else if ( devRepository != null && isScmSystem( devRepository, "hg" ) ) { HgScmProviderRepository hgRepo = (HgScmProviderRepository) devRepository.getProviderRepository(); @@ -508,6 +528,27 @@ public class ScmReport verbatimText( command.toString() ); } + // Git + + /** + * Create the documentation to provide an anonymous access with a <code>Git</code> SCM. + * For example, generate the following command line: + * <p>git clone uri</p> + * + * @param gitRepo + */ + private void anonymousAccessGit( GitScmProviderRepository gitRepo ) + { + sink.paragraph(); + linkPatternedText( getI18nString( "anonymousaccess.git.intro" ) ); + sink.paragraph_(); + + StringBuilder command = new StringBuilder(); + command.append( "$ git clone " ).append( gitRepo.getFetchUrl() ); + + verbatimText( command.toString() ); + } + // Mercurial /** @@ -553,6 +594,28 @@ public class ScmReport verbatimText( command.toString() ); } + // Git + + /** + * Create the documentation to provide an developer access with a <code>Git</code> SCM. + * For example, generate the following command line: + * <p>git clone repo </p> + * + * @param gitRepo + */ + private void developerAccessGit( GitScmProviderRepository gitRepo ) + { + sink.paragraph(); + linkPatternedText( getI18nString( "devaccess.git.intro" ) ); + sink.paragraph_(); + + StringBuilder command = new StringBuilder(); + command.append( "$ git clone " ); + command.append( gitRepo.getPushUrl() ); + + verbatimText( command.toString() ); + } + // Mercurial /** Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report.properties?rev=1453123&r1=1453122&r2=1453123&view=diff ============================================================================== --- maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report.properties (original) +++ maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report.properties Wed Mar 6 01:46:34 2013 @@ -155,6 +155,7 @@ report.scm.accessthroughtproxy.svn.intro report.scm.accessthroughtproxy.title = Access through a proxy 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.general.intro = Refer to the documentation of the SCM used for more information about anonymously check out. The connection url is: +report.scm.anonymousaccess.git.intro = The source can be checked out anonymously from GIT with this command (See {http://git-scm.com/docs/git-clone,http://git-scm.com/docs/git-clone}): report.scm.anonymousaccess.hg.intro = The source can be checked out anonymously from Mercurial with this command (See {http://www.selenic.com/mercurial/hg.1.html#clone,http://www.selenic.com/mercurial/hg.1.html#clone}): report.scm.anonymousaccess.svn.intro = The source can be checked out anonymously from SVN with this command: report.scm.anonymousaccess.title = Anonymous access @@ -164,6 +165,7 @@ report.scm.description 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.general.intro = Refer to the documentation of the SCM used for more information about developer check out. The connection url is: +report.scm.devaccess.git.intro = Only project developers can access the GIT tree via this method (See {http://git-scm.com/docs/git-clone,http://git-scm.com/docs/git-clone}). report.scm.devaccess.hg.intro = Only project developers can access the Mercurial tree via this method (See {http://www.selenic.com/mercurial/hg.1.html#clone,http://www.selenic.com/mercurial/hg.1.html#clone}). report.scm.devaccess.perforce.intro = Only project developers can access the Perforce tree via this method. Substitute username and password with the proper values. report.scm.devaccess.starteam.intro = Only project developers can access the Starteam tree via this method. Substitute username with the proper value. @@ -177,6 +179,7 @@ report.scm.general.intro report.scm.name = Source Repository report.scm.noscm = No source configuration management system is defined. Please check back at a later date. report.scm.overview.title = Overview +report.scm.git.intro = This project uses {GIT, http://git-scm.com/} to manage its source code. Instructions on GIT use can be found at {http://git-scm.com/documentation,http://git-scm.com/documentation}. report.scm.hg.intro = This project uses {Mercurial, http://mercurial.selenic.com/wiki/} to manage its source code. Instructions on Mercurial use can be found at {http://hgbook.red-bean.com/read/, http://hgbook.red-bean.com/read/}. 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. @@ -284,4 +287,4 @@ report.distributionManagement.value report.distributionManagement.relocation.groupid = GroupId report.distributionManagement.relocation.artifactid = ArtifactId report.distributionManagement.relocation.version = Version -report.distributionManagement.relocation.message = Message \ No newline at end of file +report.distributionManagement.relocation.message = Message