You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by lt...@apache.org on 2006/04/05 22:22:39 UTC

svn commit: r391782 - in /maven/maven-1/plugins/trunk/xdoc: project.xml src/main/org/apache/maven/xdoc/util/ScmUtil.java src/plugin-resources/templates/cvs-usage.xml src/plugin-resources/templates/scm/cvs.xml src/plugin-resources/templates/scm/svn.xml

Author: ltheussl
Date: Wed Apr  5 13:22:38 2006
New Revision: 391782

URL: http://svn.apache.org/viewcvs?rev=391782&view=rev
Log:
Use maven-scm-provider-cvs maven-scm-provider-svn in scm-usage page.

Removed:
    maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/cvs-usage.xml
Modified:
    maven/maven-1/plugins/trunk/xdoc/project.xml
    maven/maven-1/plugins/trunk/xdoc/src/main/org/apache/maven/xdoc/util/ScmUtil.java
    maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/scm/cvs.xml
    maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/scm/svn.xml

Modified: maven/maven-1/plugins/trunk/xdoc/project.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/project.xml?rev=391782&r1=391781&r2=391782&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/project.xml (original)
+++ maven/maven-1/plugins/trunk/xdoc/project.xml Wed Apr  5 13:22:38 2006
@@ -275,6 +275,16 @@
     </dependency>
     <dependency>
       <groupId>org.apache.maven.scm</groupId>
+      <artifactId>maven-scm-provider-cvs</artifactId>
+      <version>1.0-beta-2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.scm</groupId>
+      <artifactId>maven-scm-provider-svn</artifactId>
+      <version>1.0-beta-2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.scm</groupId>
       <artifactId>maven-scm-provider-perforce</artifactId>
       <version>1.0-beta-2</version>
     </dependency>

Modified: maven/maven-1/plugins/trunk/xdoc/src/main/org/apache/maven/xdoc/util/ScmUtil.java
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/src/main/org/apache/maven/xdoc/util/ScmUtil.java?rev=391782&r1=391781&r2=391782&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/src/main/org/apache/maven/xdoc/util/ScmUtil.java (original)
+++ maven/maven-1/plugins/trunk/xdoc/src/main/org/apache/maven/xdoc/util/ScmUtil.java Wed Apr  5 13:22:38 2006
@@ -21,6 +21,10 @@
 import java.util.List;
 
 import org.apache.commons.lang.StringUtils;
+import org.apache.maven.scm.provider.cvslib.CvsScmProvider;
+import org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository;
+import org.apache.maven.scm.provider.svn.SvnScmProvider;
+import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
 import org.apache.maven.scm.provider.clearcase.ClearCaseScmProvider;
 import org.apache.maven.scm.provider.clearcase.repository.ClearCaseScmProviderRepository;
 import org.apache.maven.scm.provider.perforce.PerforceScmProvider;
@@ -135,6 +139,156 @@
 			return "";
 		}
 	}
+
+    /**
+     * 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>
+     *
+     * @param cvsRepo
+     * @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>
+     */
+    public String anonymousAccessCVS( String connection )
+    {
+
+        char delim = getSCMConnectionSeparator(connection).charAt(0);
+
+        CvsScmProvider cvsProvider = new CvsScmProvider();
+        CvsScmProviderRepository cvsRepo;
+
+        String scmSpecificUrl = connection.substring(8);
+
+        try {
+            cvsRepo = (CvsScmProviderRepository) cvsProvider
+                .makeProviderScmRepository(scmSpecificUrl, delim);
+        } catch (ScmRepositoryException e) {
+            System.err
+            .println("Your developerConnection does not seem to be valid: "
+                    + e.getMessage());
+            return "";
+        }
+
+        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() );
+
+        return command.toString();
+    }
+
+    /**
+     * Create the documentation to provide an developer access with a <code>CVS</code> SCM.
+     * For example, generate the following command line:
+     * <p>export CVS_RSH=ssh</p>
+     * <p>cvs -z3 -d :ext:username@cvs.apache.org:/home/cvs co maven-plugins/dist</p>
+     *
+     * @param cvsRepo
+     * @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>
+     */
+    public String developerAccessCVS( String devConnection )
+    {
+
+        char delim = getSCMConnectionSeparator(devConnection).charAt(0);
+
+        CvsScmProvider cvsProvider = new CvsScmProvider();
+        CvsScmProviderRepository cvsRepo;
+
+        String scmSpecificUrl = devConnection.substring(8);
+
+        try {
+            cvsRepo = (CvsScmProviderRepository) cvsProvider
+                .makeProviderScmRepository(scmSpecificUrl, delim);
+        } catch (ScmRepositoryException e) {
+            System.err
+            .println("Your developerConnection does not seem to be valid: "
+                    + e.getMessage());
+            return "";
+        }
+
+
+        // Safety: remove the username if present
+        String cvsRoot = StringUtils.replace( cvsRepo.getCvsRoot(), cvsRepo.getUser(), "username" );
+
+        StringBuffer command = new StringBuffer();
+        command.append( "export CVS_RSH=ssh" );
+        command.append( "\n" );
+        command.append( "cvs -z3 -d " ).append( cvsRoot ).append( " co " ).append( cvsRepo.getModule() );
+
+        return command.toString();
+    }
+
+    /**
+     * 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>
+     *
+     * @param svnRepo
+     * @see <a href="http://svnbook.red-bean.com/">http://svnbook.red-bean.com/</a>
+     */
+    public String anonymousAccessSVN( String connection, String checkoutDirectoryName )
+    {
+
+        char delim = getSCMConnectionSeparator(connection).charAt(0);
+
+        SvnScmProvider svnProvider = new SvnScmProvider();
+        SvnScmProviderRepository svnRepo;
+
+        String scmSpecificUrl = connection.substring(8);
+
+        try {
+            svnRepo = (SvnScmProviderRepository) svnProvider
+                .makeProviderScmRepository(scmSpecificUrl, delim);
+        } catch (ScmRepositoryException e) {
+            System.err
+            .println("Your developerConnection does not seem to be valid: "
+                    + e.getMessage());
+            return "";
+        }
+
+        StringBuffer command = new StringBuffer();
+        command.append( "svn checkout " ).append( svnRepo.getUrl() ).append( " " ).append( checkoutDirectoryName );
+
+        return command.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>
+     *
+     * @param svnRepo
+     * @see <a href="http://svnbook.red-bean.com/">http://svnbook.red-bean.com/</a>
+     */
+    public String developerAccessSVN( String devConnection, String checkoutDirectoryName )
+    {
+
+        char delim = getSCMConnectionSeparator(devConnection).charAt(0);
+
+        SvnScmProvider svnProvider = new SvnScmProvider();
+        SvnScmProviderRepository svnRepo;
+
+        String scmSpecificUrl = devConnection.substring(8);
+
+        try {
+            svnRepo = (SvnScmProviderRepository) svnProvider
+                .makeProviderScmRepository(scmSpecificUrl, delim);
+        } catch (ScmRepositoryException e) {
+            System.err
+            .println("Your developerConnection does not seem to be valid: "
+                    + e.getMessage());
+            return "";
+        }
+
+        StringBuffer command = new StringBuffer();
+
+        command.append( "svn checkout " ).append( svnRepo.getUrl() ).append( " " ).append( checkoutDirectoryName );
+
+        return command.toString();
+    }
+
 
 	/**
 	 * Create the documentation to provide an developer access with a

Modified: maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/scm/cvs.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/scm/cvs.xml?rev=391782&r1=391781&r2=391782&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/scm/cvs.xml (original)
+++ maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/scm/cvs.xml Wed Apr  5 13:22:38 2006
@@ -11,7 +11,6 @@
     </p>
 
   #if ($repository.connection && $repository.connection != '')
-      #set ($connscm = $scmUtil.getScmType($repository.connection)) 
 
           #set ($conn = $scmUtil.getCvsConnection($repository.connection, ''))
           #set ($module = $scmUtil.getCvsModule($repository.connection))
@@ -27,12 +26,14 @@
         <source>
             <![CDATA[
       maven scm:checkout
-        -Dmaven.scm.method=$connscm
+        -Dmaven.scm.method=cvs
         -Dmaven.scm.url=$conn
         -Dmaven.scm.checkout.dir=$module
     ]]></source>
     </subsection>
 
+    #set ($command = $scmUtil.anonymousAccessCVS($repository.connection))
+
     <subsection key="template.cvs.section4.title"
         bundle="plugin-resources.templates.templates"
         name="Anonymous CVS Access">
@@ -41,8 +42,7 @@
                 bundle="plugin-resources.templates.templates" />
         </p>
 
-        <source>cvs -d $conn login
-cvs -z3 -d $conn co $module</source>
+        <source>$command</source>
 
         <p>
             <message key="template.cvs.section4.updates"
@@ -52,7 +52,6 @@
   #end
 
   #if ($repository.developerConnection && $repository.developerConnection != '') 
-      #set ($connscm = $scmUtil.getScmType($repository.developerConnection)) 
 
           #set ($conn = $scmUtil.getCvsConnection($repository.developerConnection, 'username'))
           #set ($module = $scmUtil.getCvsModule($repository.developerConnection)) 
@@ -68,7 +67,7 @@
         <source>
             <![CDATA[
       maven scm:checkout
-        -Dmaven.scm.method=$connscm
+        -Dmaven.scm.method=cvs
         -Dmaven.scm.url=$conn
         -Dmaven.scm.checkout.dir=$module
     ]]></source>
@@ -79,6 +78,8 @@
         </p>
     </subsection>
 
+    #set ($command = $scmUtil.developerAccessCVS($repository.developerConnection))
+
     <subsection key="template.cvs.section6.title"
         bundle="plugin-resources.templates.templates"
         name="Developer CVS Access via SSH">
@@ -88,9 +89,7 @@
                 bundle="plugin-resources.templates.templates" />
         </p>
 
-        <source>export CVS_RSH=ssh
-cvs -z3 -d $conn co $module
-        </source>
+        <source>$command</source>
 
         <p>
             <message key="template.cvs.section6.remember"

Modified: maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/scm/svn.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/scm/svn.xml?rev=391782&r1=391781&r2=391782&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/scm/svn.xml (original)
+++ maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/scm/svn.xml Wed Apr  5 13:22:38 2006
@@ -11,7 +11,6 @@
     </p>
 
   #if ($repository.connection && $repository.connection != '')
-      #set ($connscm = $scmUtil.getScmType($repository.connection)) 
       #set ($svnconn = $scmUtil.getSvnConnection($repository.connection))
 
           #set ($conn = $repository.connection)
@@ -27,12 +26,14 @@
         <source>
             <![CDATA[
       maven scm:checkout
-        -Dmaven.scm.method=$connscm
+        -Dmaven.scm.method=svn
         -Dmaven.scm.url=$conn
         -Dmaven.scm.checkout.dir=$project.artifactId
     ]]></source>
     </subsection>
 
+    #set ($command = $scmUtil.anonymousAccessSVN($repository.connection, $project.artifactId))
+
     <subsection key="template.svn.section4.title"
         bundle="plugin-resources.templates.templates"
         name="Anonymous Access">
@@ -41,13 +42,12 @@
                 bundle="plugin-resources.templates.templates" />
         </p>
 
-        <source>svn checkout $svnconn $project.artifactId</source>
+        <source>$command</source>
 
     </subsection>
   #end
 
   #if ($repository.developerConnection && $repository.developerConnection != '') 
-      #set ($connscm = $scmUtil.getScmType($repository.developerConnection))
       #set ($svnconn = $scmUtil.getSvnConnection($repository.developerConnection))
 
           #set ($conn = $repository.developerConnection)
@@ -63,13 +63,15 @@
         <source>
             <![CDATA[
       maven scm:checkout
-        -Dmaven.scm.method=$connscm
+        -Dmaven.scm.method=svn
         -Dmaven.scm.url=$conn
         -Dmaven.scm.checkout.dir=$project.artifactId
     ]]></source>
 
     </subsection>
 
+    #set ($command = $scmUtil.developerAccessSVN($repository.developerConnection, $project.artifactId))
+
     <subsection key="template.svn.section6.title"
         bundle="plugin-resources.templates.templates"
         name="Developer Access">
@@ -79,7 +81,7 @@
                 bundle="plugin-resources.templates.templates" />
         </p>
 
-        <source>svn checkout $svnconn $project.artifactId</source>
+        <source>$command</source>
 
     </subsection>
 
@@ -91,7 +93,7 @@
             <message key="template.svn.section7.description"
                 bundle="plugin-resources.templates.templates" />
         </p>
-        <source>svn checkout $conn $project.artifactId</source>
+        <source>$command</source>
 
     </subsection>