diff --git a/changelog/src/main/org/apache/maven/cvslib/CvsChangeLogGenerator.java b/changelog/src/main/org/apache/maven/cvslib/CvsChangeLogGenerator.java
index 79ce5533..4108c05b 100644
--- a/changelog/src/main/org/apache/maven/cvslib/CvsChangeLogGenerator.java
+++ b/changelog/src/main/org/apache/maven/cvslib/CvsChangeLogGenerator.java
@@ -83,43 +83,40 @@ import org.apache.tools.ant.types.Commandline;
* @author Peter Donald
* @author Pete Kazmier
* @version
- * $Id: CvsChangeLogGenerator.java,v 1.2 2003/02/17 20:53:42 bwalding Exp $
+ * $Id: CvsChangeLogGenerator.java,v 1.3 2003/02/21 22:00:50 bwalding Exp $
*/
class CvsChangeLogGenerator extends AbstractChangeLogGenerator
{
/** Log */
- private static final Log LOG = LogFactory.getLog(
- CvsChangeLogGenerator.class);
+ private static final Log LOG = LogFactory.getLog(CvsChangeLogGenerator.class);
/**
* @return the cvs command line to be executed.
*/
- protected Commandline getScmLogCommand()
+ protected Commandline getScmLogCommand()
{
if (getConnection() == null)
{
- throw new IllegalArgumentException("repository connection string"
- + " not specified");
+ throw new IllegalArgumentException("repository connection string" + " not specified");
}
-
+
String connection = getConnection();
- if (connection.length() < 4) {
+ if (connection.length() < 4)
+ {
throw new IllegalArgumentException("repository connection string doesn't start with scm");
}
-
+
String inputDelim = connection.substring(3, 4);
-
+
StringTokenizer tokenizer = new StringTokenizer(getConnection(), inputDelim);
- if (tokenizer.countTokens() < 6)
+ if (tokenizer.countTokens() < 6)
{
- throw new IllegalArgumentException("repository connection string"
- + " contains less than six tokens");
+ throw new IllegalArgumentException("repository connection string" + " contains less than six tokens");
}
tokenizer.nextToken(); // skip 'scm'
if (!tokenizer.nextToken().equals("cvs"))
{
- throw new IllegalArgumentException("repository connection string"
- + " does not specify 'cvs' as the scm");
+ throw new IllegalArgumentException("repository connection string" + " does not specify 'cvs' as the scm");
}
Commandline command = new Commandline();
@@ -131,12 +128,23 @@ class CvsChangeLogGenerator extends AbstractChangeLogGenerator
// :pserver:anoncvs@cvs.apache.org:/home/cvspublic
// use tokens 3+4+5
StringBuffer connectionBuffer = new StringBuffer(":");
- connectionBuffer
- .append(tokenizer.nextToken())
- .append(":")
- .append(tokenizer.nextToken())
- .append(":")
- .append(tokenizer.nextToken());
+ String connectionType = tokenizer.nextToken();
+
+ if (connectionType.equalsIgnoreCase("local"))
+ {
+ // throw away the next token 'user@host'
+ tokenizer.nextToken();
+ // use the local repository directory eg. '/home/cvspublic'
+ connectionBuffer = new StringBuffer(tokenizer.nextToken());
+ }
+ else
+ {
+ //create the cvsroot as the remote cvsroot
+ connectionBuffer = new StringBuffer(":");
+ connectionBuffer.append(connectionType).append(":").append(tokenizer.nextToken()).append(":").append(
+ tokenizer.nextToken());
+ }
+
command.createArgument().setValue(connectionBuffer.toString());
command.createArgument().setValue("log");
@@ -144,7 +152,7 @@ class CvsChangeLogGenerator extends AbstractChangeLogGenerator
{
command.createArgument().setValue(dateRange);
}
-
+
return command;
}
@@ -170,17 +178,14 @@ class CvsChangeLogGenerator extends AbstractChangeLogGenerator
* @throws IOException If the handler doesn't wish to handle the
* exception.
*/
- protected void handleParserException(IOException ioe)
- throws IOException
+ protected void handleParserException(IOException ioe) throws IOException
{
- if (ioe.getMessage().indexOf("CreateProcess") != -1
- || ioe.getMessage().indexOf("cvs: not found") != -1)
+ if (ioe.getMessage().indexOf("CreateProcess") != -1 || ioe.getMessage().indexOf("cvs: not found") != -1)
{
// can't find CVS on Win32 or Linux...
- if (LOG.isWarnEnabled())
+ if (LOG.isWarnEnabled())
{
- LOG.warn("Unable to find cvs executable. "
- + "Changelog will be empty");
+ LOG.warn("Unable to find cvs executable. " + "Changelog will be empty");
}
}
else
diff --git a/changelog/src/test/org/apache/maven/cvslib/CvsChangeLogGeneratorTest.java b/changelog/src/test/org/apache/maven/cvslib/CvsChangeLogGeneratorTest.java
index 013ab961..ca5cab9d 100644
--- a/changelog/src/test/org/apache/maven/cvslib/CvsChangeLogGeneratorTest.java
+++ b/changelog/src/test/org/apache/maven/cvslib/CvsChangeLogGeneratorTest.java
@@ -66,7 +66,7 @@ import junit.framework.TestCase;
/**
* @author Ben Walding
- * @version $Id: CvsChangeLogGeneratorTest.java,v 1.1 2003/02/17 20:53:05 bwalding Exp $
+ * @version $Id: CvsChangeLogGeneratorTest.java,v 1.2 2003/02/21 22:00:51 bwalding Exp $
*/
class ExposeGenerator extends CvsChangeLogGenerator
{
@@ -79,7 +79,7 @@ class ExposeGenerator extends CvsChangeLogGenerator
/**
* @author Ben Walding
- * @version $Id: CvsChangeLogGeneratorTest.java,v 1.1 2003/02/17 20:53:05 bwalding Exp $
+ * @version $Id: CvsChangeLogGeneratorTest.java,v 1.2 2003/02/21 22:00:51 bwalding Exp $
*/
public class CvsChangeLogGeneratorTest extends TestCase
{
@@ -116,6 +116,10 @@ public class CvsChangeLogGeneratorTest extends TestCase
new Test(
"scm|cvs|pserver|anoncvs@cvs.apache.org|D:/home/cvspublic|jakarta-turbine-maven|anoncvs",
"cvs|-d|:pserver:anoncvs@cvs.apache.org:D:/home/cvspublic|log",
+ null),
+ new Test(
+ "scm|cvs|local|local|D:/home/cvspublic|jakarta-turbine-maven|anoncvs",
+ "cvs|-d|D:/home/cvspublic|log",
null)};
public void testParse() throws Throwable
@@ -133,7 +137,6 @@ public class CvsChangeLogGeneratorTest extends TestCase
String[] expected = tokenizerToArray(new EnhancedStringTokenizer(test.args, "|"));
ExposeGenerator eg = new ExposeGenerator();
- System.out.println("Processing conn = " + test.conn);
try
{