You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by br...@apache.org on 2005/01/25 12:19:52 UTC

svn commit: r126372 - in maven/maven-1/plugins/trunk/changelog: . src/main/org/apache/maven/cvslib src/main/org/apache/maven/util src/test/org/apache/maven/util xdocs

Author: brett
Date: Tue Jan 25 03:19:47 2005
New Revision: 126372

URL: http://svn.apache.org/viewcvs?view=rev&rev=126372
Log:
handle local CVS repository better
Modified:
   maven/maven-1/plugins/trunk/changelog/project.xml
   maven/maven-1/plugins/trunk/changelog/src/main/org/apache/maven/cvslib/CvsChangeLogGenerator.java
   maven/maven-1/plugins/trunk/changelog/src/main/org/apache/maven/util/RepositoryUtils.java
   maven/maven-1/plugins/trunk/changelog/src/test/org/apache/maven/util/RepositoryTest.java
   maven/maven-1/plugins/trunk/changelog/xdocs/changes.xml

Modified: maven/maven-1/plugins/trunk/changelog/project.xml
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/changelog/project.xml?view=diff&rev=126372&p1=maven/maven-1/plugins/trunk/changelog/project.xml&r1=126371&p2=maven/maven-1/plugins/trunk/changelog/project.xml&r2=126372
==============================================================================
--- maven/maven-1/plugins/trunk/changelog/project.xml	(original)
+++ maven/maven-1/plugins/trunk/changelog/project.xml	Tue Jan 25 03:19:47 2005
@@ -172,10 +172,10 @@
     <dependency>
       <groupId>maven</groupId>
       <artifactId>maven-model</artifactId>
-      <version>1.1-SNAPSHOT</version>
+      <version>3.0.0-SNAPSHOT</version>
     </dependency>
-    <!-- Required to build under for JDK 1.3 because we fork junit -->
 
+    <!-- Required to build under for JDK 1.3 because we fork junit -->
     <dependency>
       <groupId>xerces</groupId>
       <artifactId>xerces</artifactId>

Modified: maven/maven-1/plugins/trunk/changelog/src/main/org/apache/maven/cvslib/CvsChangeLogGenerator.java
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/changelog/src/main/org/apache/maven/cvslib/CvsChangeLogGenerator.java?view=diff&rev=126372&p1=maven/maven-1/plugins/trunk/changelog/src/main/org/apache/maven/cvslib/CvsChangeLogGenerator.java&r1=126371&p2=maven/maven-1/plugins/trunk/changelog/src/main/org/apache/maven/cvslib/CvsChangeLogGenerator.java&r2=126372
==============================================================================
--- maven/maven-1/plugins/trunk/changelog/src/main/org/apache/maven/cvslib/CvsChangeLogGenerator.java	(original)
+++ maven/maven-1/plugins/trunk/changelog/src/main/org/apache/maven/cvslib/CvsChangeLogGenerator.java	Tue Jan 25 03:19:47 2005
@@ -111,7 +111,7 @@
             entries = super.getEntries(parser);
         }
         catch (Exception e){
-            LOG.error(e);
+            LOG.error("Error processing command", e);
         }
         
 
@@ -153,25 +153,22 @@
             // use the local repository directory eg. '/home/cvspublic'
             connectionBuffer = tokens[POS_SCM_PATH];
         }
+        else if (tokens[POS_SCM_SUBTYPE].equalsIgnoreCase("lserver"))
+        {
+            //create the cvsroot as the local socket cvsroot
+            connectionBuffer =
+                tokens[POS_SCM_USERHOST] + ":" + tokens[POS_SCM_PATH];
+        }
         else
         {
-            if (tokens[POS_SCM_SUBTYPE].equalsIgnoreCase("lserver"))
-            {
-                //create the cvsroot as the local socket cvsroot
-                connectionBuffer =
-                    tokens[POS_SCM_USERHOST] + ":" + tokens[POS_SCM_PATH];
-            }
-            else
-            {
-                //create the cvsroot as the remote cvsroot
-                connectionBuffer =
-                    ":"
-                        + tokens[POS_SCM_SUBTYPE]
-                        + ":"
-                        + tokens[POS_SCM_USERHOST]
-                        + ":"
-                        + tokens[POS_SCM_PATH];
-            }
+            //create the cvsroot as the remote cvsroot
+            connectionBuffer =
+                ":"
+                    + tokens[POS_SCM_SUBTYPE]
+                    + ":"
+                    + tokens[POS_SCM_USERHOST]
+                    + ":"
+                    + tokens[POS_SCM_PATH];
         }
 
         command.createArgument().setValue(connectionBuffer.toString());

Modified: maven/maven-1/plugins/trunk/changelog/src/main/org/apache/maven/util/RepositoryUtils.java
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/changelog/src/main/org/apache/maven/util/RepositoryUtils.java?view=diff&rev=126372&p1=maven/maven-1/plugins/trunk/changelog/src/main/org/apache/maven/util/RepositoryUtils.java&r1=126371&p2=maven/maven-1/plugins/trunk/changelog/src/main/org/apache/maven/util/RepositoryUtils.java&r2=126372
==============================================================================
--- maven/maven-1/plugins/trunk/changelog/src/main/org/apache/maven/util/RepositoryUtils.java	(original)
+++ maven/maven-1/plugins/trunk/changelog/src/main/org/apache/maven/util/RepositoryUtils.java	Tue Jan 25 03:19:47 2005
@@ -26,7 +26,7 @@
  *
  * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
  *
- * @version $Id: RepositoryUtils.java,v 1.1 2004/09/24 10:47:03 brett Exp $
+ * @version $Id$
  */
 public final class RepositoryUtils
 {
@@ -61,6 +61,31 @@
         // for a valid repository, it should be scm:<provider> at least
         if (tokens.length >= 1 && tokens[1].equals("cvs"))
         {
+            if (tokens.length >= 2 && tokens[2].equals("local"))
+            {
+                if (tokens.length == 6)
+                {
+                    if (tokens[3].length() > 0 && !tokens[3].equals("local"))
+                    {
+                        throw new IllegalArgumentException("cvs local repository connection string must specify 5 tokens, or an empty 3rd token if 6");
+                    }
+                }
+                else if (tokens.length == 5)
+                {
+                    String[] newTokens = new String[6];
+                    newTokens[0] = tokens[0];
+                    newTokens[1] = tokens[1];
+                    newTokens[2] = tokens[2];
+                    newTokens[3] = "";
+                    newTokens[4] = tokens[3];
+                    newTokens[5] = tokens[4];
+                    tokens = newTokens;
+                }
+                else
+                {
+                    throw new IllegalArgumentException("cvs local repository connection string doesn't contain five tokens");
+                }
+            }
             if (tokens.length != 6)
             {
                 throw new IllegalArgumentException("cvs repository connection string doesn't contain six tokens");

Modified: maven/maven-1/plugins/trunk/changelog/src/test/org/apache/maven/util/RepositoryTest.java
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/changelog/src/test/org/apache/maven/util/RepositoryTest.java?view=diff&rev=126372&p1=maven/maven-1/plugins/trunk/changelog/src/test/org/apache/maven/util/RepositoryTest.java&r1=126371&p2=maven/maven-1/plugins/trunk/changelog/src/test/org/apache/maven/util/RepositoryTest.java&r2=126372
==============================================================================
--- maven/maven-1/plugins/trunk/changelog/src/test/org/apache/maven/util/RepositoryTest.java	(original)
+++ maven/maven-1/plugins/trunk/changelog/src/test/org/apache/maven/util/RepositoryTest.java	Tue Jan 25 03:19:47 2005
@@ -22,13 +22,80 @@
 public class RepositoryTest
     extends TestCase
 {
-    public void testSplitScmConnection()
+    public void testSplitScmConnectionCvsPserver()
     {
         String con = "scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:module";
         String[] tokens = RepositoryUtils.splitSCMConnection(con);
         assertEquals("Wrong number of tokens split", 6, tokens.length);
-        con = "scm|svn|http://svn.apache.org/repos";
-        tokens = RepositoryUtils.splitSCMConnection(con);
+    }
+
+    public void testSplitScmConnectionCvsLocal5Tokens()
+    {
+        String con = "scm:cvs:local:/cvs/root:module";
+        String[] tokens = RepositoryUtils.splitSCMConnection(con);
+        assertEquals("Wrong number of tokens split", 6, tokens.length);
+    }
+
+    public void testSplitScmConnectionCvsLocal6Tokens3rdEmpty()
+    {
+        String con = "scm:cvs:local::/cvs/root:module";
+        String[] tokens = RepositoryUtils.splitSCMConnection(con);
+        assertEquals("Wrong number of tokens split", 6, tokens.length);
+    }
+
+    public void testSplitScmConnectionCvsLocal6Tokens3rdLocal()
+    {
+        String con = "scm:cvs:local:local:/cvs/root:module";
+        String[] tokens = RepositoryUtils.splitSCMConnection(con);
+        assertEquals("Wrong number of tokens split", 6, tokens.length);
+    }
+
+    public void testSplitScmConnectionCvsLocal4Tokens()
+    {
+        String con = "scm:cvs:local:/cvs/root";
+        try
+        {
+            String[] tokens = RepositoryUtils.splitSCMConnection(con);
+            fail("Should throw an exception splitting " + con);
+        }
+        catch ( IllegalArgumentException expected )
+        {
+            assertTrue( true );
+        }
+    }
+
+    public void testSplitScmConnectionCvsPserver5Tokens()
+    {
+        String con = "scm:cvs:pserver:user@host:/cvs/root";
+        try
+        {
+            String[] tokens = RepositoryUtils.splitSCMConnection(con);
+            fail("Should throw an exception splitting " + con);
+        }
+        catch ( IllegalArgumentException expected )
+        {
+            assertTrue( true );
+        }
+    }
+
+    public void testSplitScmConnectionCvsLocal6TokensNonEmpty3rd()
+    {
+        String con = "scm:cvs:local:foo:/cvs/root:module";
+        try
+        {
+            String[] tokens = RepositoryUtils.splitSCMConnection(con);
+            fail("Should throw an exception splitting " + con);
+        }
+        catch ( IllegalArgumentException expected )
+        {
+            assertTrue( true );
+        }
+    }
+
+    public void testSplitScmConnectionSvn()
+    {
+        String con = "scm|svn|http://svn.apache.org/repos";
+        String[] tokens = RepositoryUtils.splitSCMConnection(con);
         assertEquals("Wrong number of tokens split", 3, tokens.length);
     }
 }

Modified: maven/maven-1/plugins/trunk/changelog/xdocs/changes.xml
Url: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/changelog/xdocs/changes.xml?view=diff&rev=126372&p1=maven/maven-1/plugins/trunk/changelog/xdocs/changes.xml&r1=126371&p2=maven/maven-1/plugins/trunk/changelog/xdocs/changes.xml&r2=126372
==============================================================================
--- maven/maven-1/plugins/trunk/changelog/xdocs/changes.xml	(original)
+++ maven/maven-1/plugins/trunk/changelog/xdocs/changes.xml	Tue Jan 25 03:19:47 2005
@@ -26,6 +26,7 @@
   </properties>
   <body>
     <release version="1.8-SNAPSHOT" date="in SVN">
+      <action dev="brett" type="fix">Allow local CVSROOT to only have 5 tokens (no host name)</action>
     </release>
     <release version="1.7.2" date="2005-01-08">
       <action dev="brett" type="fix" issue="MPCHANGES-29" due-to="Matthew Daniel">Fix subversion revision passing on Windows</action>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org