MPCHANGELOG-45. Perforce Repository URL should include project.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@116128 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
evenisse committed 2004-10-14 15:01:44 +00:00
1 parent f23def04ad
commit 3095d82405
4 files changed
+28 -15

No files matched your search

@@ -28,24 +28,28 @@ import org.apache.maven.changelog.ChangeLogParser;
* It expects the repository connection element in the POM to be of
* this form: <b><code>scm:perforce[:P4PORT]:FILESPEC</code></b>. If
* the P4PORT is omitted, the corresponding environment variable will
* be used. The FILESPEC should use the appropriate Perforce
* wildcards to represent all of the project's files. For example,
* be used. The FILESPEC should use "depot syntax" with the
* appropriate Perforce wildcards to represent all of the project's
* files, i.e. '...'
*
* The repository URL element should refer to a <a
* href="http://www.perforce.com/perforce/products/p4web.html">p4web</a>
* instance. The portion of the URL following the host:port should
* match the FILESPEC in the repository connection element, sans the
* '...'. It must end with a '/'.
*
* For example,
* <pre>
* &lt;repository&gt;
* &lt;connection&gt;
* scm:perforce:some.host.com:1666://depot/projects/maven/...
* &lt;/connection&gt;
* &lt;url&gt;
* http://public.perforce.com:8080
* http://public.perforce.com:8080//depot/projects/maven/
* &lt;/url&gt;
* &lt;/repository&gt;
* </pre>
*
* The repository url element should reference the root context of a <a
* href="http://www.perforce.com/perforce/products/p4web.html">p4web</a>
* instance.
*
* @author <a href="mailto:jim@crossleys.org">Jim Crossley</a>
* @version $Id:
*/
@@ -91,6 +91,9 @@ class PerforceChangeLogParser implements ChangeLogParser
/** the before date */
private Date beforeDate;
/** The depot filespec will be stripped from each filename */
private int prefixLength;
private static final String pattern =
"^\\.\\.\\. #(\\d+) " + // revision number
"change (\\d+) .* " + // changelist number
@@ -119,6 +122,9 @@ class PerforceChangeLogParser implements ChangeLogParser
{
this.changeLog = changeLog;
setDateRange();
String conn = changeLog.getRepositoryConnection();
String filespec = conn.substring(conn.lastIndexOf(':')+1);
this.prefixLength = 1 + filespec.lastIndexOf ('/');
}
/**
@@ -171,8 +177,6 @@ class PerforceChangeLogParser implements ChangeLogParser
*/
private void addEntry(ChangeLogEntry entry, ChangeLogFile file)
{
System.out.println();
System.out.println(entry.toXML());
if (beforeDate != null) {
if (entry.getDate().before(beforeDate)) {
return;
@@ -197,7 +201,7 @@ class PerforceChangeLogParser implements ChangeLogParser
private void processGetRevision(String line)
{
if (line.startsWith(FILE_BEGIN_TOKEN)) {
currentFile = line;
currentFile = line.substring (this.prefixLength);
return;
}
@@ -23,6 +23,7 @@ import java.util.List;
import junit.framework.TestCase;
import org.apache.maven.changelog.ChangeLogEntry;
import org.apache.maven.changelog.ChangeLog;
/**
* Test cases for {@link PerforceChangeLogParser}
@@ -58,6 +59,9 @@ public class PerforceChangeLogParserTest extends TestCase
assertNotNull("The system property basedir was not defined.", baseDir);
testFile = baseDir + "/src/test-resources/perforcelib/perforcelog.txt";
parser = new PerforceChangeLogParser();
ChangeLog changeLog = new ChangeLog();
changeLog.setRepositoryConnection ("scm:perforce://depot/test/...");
parser.init (changeLog);
}
/**
@@ -79,7 +83,7 @@ public class PerforceChangeLogParserTest extends TestCase
"\t\t<time>13:38:40</time>\n" +
"\t\t<author><![CDATA[jim]]></author>\n" +
"\t\t<file>\n" +
"\t\t\t<name>//depot/test/junk/linefeed.txt</name>\n" +
"\t\t\t<name>junk/linefeed.txt</name>\n" +
"\t\t\t<revision>3</revision>\n" +
"\t\t</file>\n" +
"\t\t<msg><![CDATA[ Where's my change #\n" +
@@ -94,7 +98,7 @@ public class PerforceChangeLogParserTest extends TestCase
"\t\t<time>16:24:20</time>\n" +
"\t\t<author><![CDATA[jim]]></author>\n" +
"\t\t<file>\n" +
"\t\t\t<name>//depot/test/demo/demo.c</name>\n" +
"\t\t\t<name>demo/demo.c</name>\n" +
"\t\t\t<revision>4</revision>\n" +
"\t\t</file>\n" +
"\t\t<msg><![CDATA[ Backing out my test changes\n" +
@@ -111,15 +115,15 @@ public class PerforceChangeLogParserTest extends TestCase
"\t\t<time>17:21:57</time>\n" +
"\t\t<author><![CDATA[mcronin]]></author>\n" +
"\t\t<file>\n" +
"\t\t\t<name>//depot/test/demo/demo.c</name>\n" +
"\t\t\t<name>demo/demo.c</name>\n" +
"\t\t\t<revision>1</revision>\n" +
"\t\t</file>\n" +
"\t\t<file>\n" +
"\t\t\t<name>//depot/test/demo/dictcalls.txt</name>\n" +
"\t\t\t<name>demo/dictcalls.txt</name>\n" +
"\t\t\t<revision>1</revision>\n" +
"\t\t</file>\n" +
"\t\t<file>\n" +
"\t\t\t<name>//depot/test/demo/dictwords.txt</name>\n" +
"\t\t\t<name>demo/dictwords.txt</name>\n" +
"\t\t\t<revision>1</revision>\n" +
"\t\t</file>\n" +
"\t\t<msg><![CDATA[ demonstration of Perforce on Windows, Unix and VMS.\n" +
+1
View File
@@ -26,6 +26,7 @@
</properties>
<body>
<release version="1.8-SNAPSHOT" date="in CVS">
<action dev="evenisse" type="fix" issue="MPCHANGELOG-45" due-to="Jim Crossley">Perforce Repository URL should include project.</action>
<action dev="dion" type="fix" issue="MPCHANGELOG-46" due-to="Juha Komulainen">Handle ViewCVS URLs with ? in them.</action>
<action dev="brett" type="update">Upgrade to Maven 1.1 libraries.</action>
</release>