handle local CVS repository better
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@126372 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -111,7 +111,7 @@ class CvsChangeLogGenerator extends AbstractChangeLogGenerator
|
||||
entries = super.getEntries(parser);
|
||||
}
|
||||
catch (Exception e){
|
||||
LOG.error(e);
|
||||
LOG.error("Error processing command", e);
|
||||
}
|
||||
|
||||
|
||||
@@ -153,25 +153,22 @@ class CvsChangeLogGenerator extends AbstractChangeLogGenerator
|
||||
// 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());
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.List;
|
||||
*
|
||||
* @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 @@ public final class RepositoryUtils
|
||||
// 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");
|
||||
|
||||
@@ -22,13 +22,80 @@ import junit.framework.TestCase;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user