maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r770320 - in /maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src: main/java/org/apache/maven/scm/provider/perforce/command/changelog/ main/java/org/apache/maven/scm/provider/perforce/command/checkout/ main/java/org/apache/m...
Date Thu, 30 Apr 2009 16:50:16 GMT
Author: olamy
Date: Thu Apr 30 16:50:15 2009
New Revision: 770320

URL: http://svn.apache.org/viewvc?rev=770320&view=rev
Log:
[SCM-418] Support for Perforce changelogs in Continuum and changelog plugin
Submitted by Peter Janes

Added:
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangesConsumer.java   (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceDescribeConsumer.java   (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/update/PerforceHaveConsumer.java   (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceDescribeConsumerTest.java   (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/resources/perforce/perforcedescribelog.txt   (with props)
Modified:
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/checkout/PerforceCheckOutCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/checkout/PerforceCheckOutConsumer.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/update/PerforceUpdateCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogCommandTest.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogConsumerTest.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/resources/perforce/perforcelog.txt

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogCommand.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogCommand.java?rev=770320&r1=770319&r2=770320&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogCommand.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogCommand.java Thu Apr 30 16:50:15 2009
@@ -22,6 +22,8 @@
 import org.apache.maven.scm.ScmBranch;
 import org.apache.maven.scm.ScmException;
 import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.ScmRevision;
+import org.apache.maven.scm.ScmVersion;
 import org.apache.maven.scm.command.changelog.AbstractChangeLogCommand;
 import org.apache.maven.scm.command.changelog.ChangeLogScmResult;
 import org.apache.maven.scm.command.changelog.ChangeLogSet;
@@ -35,7 +37,11 @@
 import org.codehaus.plexus.util.cli.Commandline;
 
 import java.io.File;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 
 /**
  * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
@@ -47,6 +53,15 @@
 {
     /** {@inheritDoc} */
     protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repo, ScmFileSet fileSet,
+                                                          ScmVersion startVersion, ScmVersion endVersion,
+                                                          String datePattern )
+        throws ScmException
+    {
+        return executeChangeLogCommand( repo, fileSet, null, null, null, datePattern, startVersion, endVersion );
+    }
+
+    /** {@inheritDoc} */
+    protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repo, ScmFileSet fileSet,
                                                           Date startDate, Date endDate, ScmBranch branch,
                                                           String datePattern )
         throws ScmException
@@ -56,13 +71,22 @@
             throw new ScmException( "This SCM doesn't support branches." );
         }
 
+        return executeChangeLogCommand( repo, fileSet, startDate, endDate, branch, datePattern, null, null );
+    }
+
+    protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repo, ScmFileSet fileSet,
+                                                          Date startDate, Date endDate, ScmBranch branch,
+                                                          String datePattern, ScmVersion startVersion,
+                                                          ScmVersion endVersion )
+        throws ScmException
+    {
         PerforceScmProviderRepository p4repo = (PerforceScmProviderRepository) repo;
         String clientspec = PerforceScmProvider.getClientspecName( getLogger(), p4repo, fileSet.getBasedir() );
-        Commandline cl = createCommandLine( p4repo, fileSet.getBasedir(), clientspec );
+        Commandline cl = createCommandLine( p4repo, fileSet.getBasedir(), clientspec, null, startDate, endDate, startVersion, endVersion );
 
         String location = PerforceScmProvider.getRepoPath( getLogger(), p4repo, fileSet.getBasedir() );
-        PerforceChangeLogConsumer consumer =
-            new PerforceChangeLogConsumer( location, startDate, endDate, datePattern, getLogger() );
+        PerforceChangesConsumer consumer =
+            new PerforceChangesConsumer( getLogger() );
 
         try
         {
@@ -93,13 +117,60 @@
             }
         }
 
-        return new ChangeLogScmResult( cl.toString(),
-                                       new ChangeLogSet( consumer.getModifications(), startDate, endDate ) );
+        List changes = consumer.getChanges();
+
+        cl = PerforceScmProvider.createP4Command( p4repo, fileSet.getBasedir() );
+        cl.createArg().setValue( "describe" );
+        cl.createArg().setValue( "-s" );
+
+        for( int i = 0; i < changes.size(); i++ ) {
+            cl.createArg().setValue( (String)changes.get(i) );
+        }
+
+        PerforceDescribeConsumer describeConsumer =
+            new PerforceDescribeConsumer( location, datePattern, getLogger() );
+
+        try
+        {
+            if ( getLogger().isDebugEnabled() )
+            {
+                getLogger().debug( PerforceScmProvider.clean( "Executing " + cl.toString() ) );
+            }
+
+            CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();
+            int exitCode = CommandLineUtils.executeCommandLine( cl, describeConsumer, err );
+
+            if ( exitCode != 0 )
+            {
+                String cmdLine = CommandLineUtils.toString( cl.getCommandline() );
+
+                StringBuffer msg = new StringBuffer( "Exit code: " + exitCode + " - " + err.getOutput() );
+                msg.append( '\n' );
+                msg.append( "Command line was:" + cmdLine );
+
+                throw new CommandLineException( msg.toString() );
+            }
+        }
+        catch ( CommandLineException e )
+        {
+            if ( getLogger().isErrorEnabled() )
+            {
+                getLogger().error( "CommandLineException " + e.getMessage(), e );
+            }
+        }
+
+        ChangeLogSet cls = new ChangeLogSet( describeConsumer.getModifications(), null, null );
+        cls.setStartVersion(startVersion);
+        cls.setEndVersion(endVersion);
+        return new ChangeLogScmResult( cl.toString(), cls );
     }
 
     public static Commandline createCommandLine( PerforceScmProviderRepository repo, File workingDirectory,
-                                                 String clientspec )
+                                                 String clientspec,
+                                                 ScmBranch branch, Date startDate, Date endDate,
+                                                 ScmVersion startVersion, ScmVersion endVersion )
     {
+        DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd:HH:mm:ss");
         Commandline command = PerforceScmProvider.createP4Command( repo, workingDirectory );
 
         if ( clientspec != null )
@@ -107,10 +178,41 @@
             command.createArg().setValue( "-c" );
             command.createArg().setValue( clientspec );
         }
-        command.createArg().setValue( "filelog" );
+        command.createArg().setValue( "changes" );
         command.createArg().setValue( "-t" );
-        command.createArg().setValue( "-l" );
-        command.createArg().setValue( "..." );
+
+        StringBuffer fileSpec = new StringBuffer("...");
+        if ( startDate != null )
+        {
+            fileSpec.append( "@" )
+                 .append( dateFormat.format(startDate) )
+                 .append( "," );
+
+            if ( endDate != null )
+            {
+                fileSpec.append( dateFormat.format(endDate) );
+            }
+            else
+            {
+                fileSpec.append( "now" );
+            }
+        }
+
+        if ( startVersion != null )
+        {
+            fileSpec.append("@").append(startVersion.getName()).append(",");
+
+            if ( endVersion != null )
+            {
+                fileSpec.append( endVersion.getName() );
+            }
+            else
+            {
+                fileSpec.append("now");
+            }
+        }
+
+        command.createArg().setValue( fileSpec.toString() );
 
         return command;
     }

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangesConsumer.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangesConsumer.java?rev=770320&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangesConsumer.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangesConsumer.java Thu Apr 30 16:50:15 2009
@@ -0,0 +1,83 @@
+package org.apache.maven.scm.provider.perforce.command.changelog;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.log.ScmLogger;
+import org.apache.maven.scm.util.AbstractConsumer;
+import org.apache.regexp.RE;
+import org.apache.regexp.RESyntaxException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public class PerforceChangesConsumer
+    extends AbstractConsumer
+{
+    private List entries = new ArrayList();
+
+    /**
+     * The regular expression used to match header lines
+     */
+    private RE revisionRegexp;
+
+    private static final String PATTERN = "^Change (\\d+) " + // changelist number
+        "on (.*) " + // date
+        "by (.*)@"; // author
+
+    public PerforceChangesConsumer( ScmLogger logger )
+    {
+        super( logger );
+
+        try
+        {
+            revisionRegexp = new RE( PATTERN );
+        }
+        catch ( RESyntaxException ignored )
+        {
+            if ( getLogger().isErrorEnabled() )
+            {
+                getLogger().error( "Could not create regexp to parse perforce log file", ignored );
+            }
+        }
+    }
+
+    public List getChanges() throws ScmException
+    {
+        return entries;
+    }
+
+    // ----------------------------------------------------------------------
+    // StreamConsumer Implementation
+    // ----------------------------------------------------------------------
+
+    /** {@inheritDoc} */
+    public void consumeLine( String line )
+    {
+        if( revisionRegexp.match( line ) )
+        {
+            entries.add( revisionRegexp.getParen( 1 ) );
+        }
+    }
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangesConsumer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangesConsumer.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Revision Id

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceDescribeConsumer.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceDescribeConsumer.java?rev=770320&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceDescribeConsumer.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceDescribeConsumer.java Thu Apr 30 16:50:15 2009
@@ -0,0 +1,293 @@
+package org.apache.maven.scm.provider.perforce.command.changelog;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.scm.ChangeFile;
+import org.apache.maven.scm.ChangeSet;
+import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.log.ScmLogger;
+import org.apache.maven.scm.util.AbstractConsumer;
+import org.apache.regexp.RE;
+import org.apache.regexp.RESyntaxException;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * Parse the tagged output from "p4 describe -s [change] [change] [...]".
+ *
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public class PerforceDescribeConsumer
+    extends AbstractConsumer
+{
+    /**
+     * Date formatter for perforce timestamp
+     */
+    private static final String PERFORCE_TIMESTAMP_PATTERN = "yyyy/MM/dd HH:mm:ss";
+
+    private List entries = new ArrayList();
+
+    /**
+     * State machine constant: expecting revision
+     */
+    private static final int GET_REVISION = 1;
+
+    /**
+     * State machine constant: eat the first blank line
+     */
+    private static final int GET_COMMENT_BEGIN = 2;
+
+    /**
+     * State machine constant: expecting comments
+     */
+    private static final int GET_COMMENT = 3;
+
+    /**
+     * State machine constant: expecting "Affected files"
+     */
+    private static final int GET_AFFECTED_FILES = 4;
+
+    /**
+     * State machine constant: expecting blank line
+     */
+    private static final int GET_FILES_BEGIN = 5;
+
+    /**
+     * State machine constant: expecting files
+     */
+    private static final int GET_FILE = 6;
+
+    /**
+     * Current status of the parser
+     */
+    private int status = GET_REVISION;
+
+    /**
+     * The current log entry being processed by the parser
+     */
+    private String currentRevision;
+
+    /**
+     * The current log entry being processed by the parser
+     */
+    private ChangeSet currentChange;
+
+    /**
+     * the current file being processed by the parser
+     */
+    private String currentFile;
+
+    /**
+     * The location of files within the Perforce depot that we are processing
+     * e.g. //depot/projects/foo/bar
+     */
+    private String repoPath;
+
+    private String userDatePattern;
+
+    private static final String REVISION_PATTERN = "^Change (\\d+) " + // changelist number
+        "by (.*)@[^ ]+ " + // author
+        "on (.*)"; // date
+    /**
+     * The comment section ends with a blank line
+     */
+    private static final String COMMENT_DELIMITER = "";
+    /**
+     * The changelist ends with a blank line
+     */
+    private static final String CHANGELIST_DELIMITER = "";
+
+    private static final String FILE_PATTERN = "^\\.\\.\\. (.*)#(\\d+) ";
+
+    /**
+     * The regular expression used to match header lines
+     */
+    private RE revisionRegexp;
+
+    /**
+     * The regular expression used to match file paths
+     */
+    private RE fileRegexp;
+
+    public PerforceDescribeConsumer( String repoPath, String userDatePattern, ScmLogger logger )
+    {
+        super( logger );
+
+        this.repoPath = repoPath;
+        this.userDatePattern = userDatePattern;
+
+        try
+        {
+            revisionRegexp = new RE( REVISION_PATTERN );
+            fileRegexp = new RE( FILE_PATTERN );
+        }
+        catch ( RESyntaxException ignored )
+        {
+            if ( getLogger().isErrorEnabled() )
+            {
+                getLogger().error( "Could not create regexps to parse Perforce descriptions", ignored );
+            }
+        }
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    public List getModifications() throws ScmException
+    {
+        return entries;
+    }
+
+    // ----------------------------------------------------------------------
+    // StreamConsumer Implementation
+    // ----------------------------------------------------------------------
+
+    /** {@inheritDoc} */
+    public void consumeLine( String line )
+    {
+        switch ( status )
+        {
+            case GET_REVISION:
+                processGetRevision( line );
+                break;
+            case GET_COMMENT_BEGIN:
+                status = GET_COMMENT;
+                break;
+            case GET_COMMENT:
+                processGetComment( line );
+                break;
+            case GET_AFFECTED_FILES:
+                processGetAffectedFiles( line );
+                break;
+            case GET_FILES_BEGIN:
+                status = GET_FILE;
+                break;
+            case GET_FILE:
+                processGetFile( line );
+                break;
+            default:
+                throw new IllegalStateException( "Unknown state: " + status );
+        }
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    /**
+     * Add a change log entry to the list (if it's not already there)
+     * with the given file.
+     *
+     * @param entry a {@link ChangeSet} to be added to the list if another
+     *              with the same key (p4 change number) doesn't exist already.
+     * @param file  a {@link ChangeFile} to be added to the entry
+     */
+    private void addEntry( ChangeSet entry, ChangeFile file )
+    {
+        entry.addFile( file );
+    }
+
+    /**
+     * Each file matches the fileRegexp.
+     *
+     * @param line A line of text from the Perforce log output
+     */
+    private void processGetFile( String line )
+    {
+        if ( line.equals( CHANGELIST_DELIMITER ) ) {
+            entries.add( 0, currentChange );
+            status = GET_REVISION;
+            return;
+        }
+        if ( !fileRegexp.match( line ) )
+        {
+            return;
+        }
+
+        currentFile = fileRegexp.getParen( 1 );
+
+	// Although Perforce allows files to be submitted anywhere in the
+	// repository in a single changelist, we're only concerned about the
+	// local files.
+        if( currentFile.startsWith( repoPath ) ) {
+            currentFile = currentFile.substring( repoPath.length() + 1 );
+            addEntry( currentChange, new ChangeFile( currentFile, fileRegexp.getParen( 2 ) ) );
+        }
+    }
+
+    /**
+     * Most of the relevant info is on the revision line matching the
+     * 'pattern' string.
+     *
+     * @param line A line of text from the perforce log output
+     */
+    private void processGetRevision( String line )
+    {
+        if ( !revisionRegexp.match( line ) )
+        {
+            return;
+        }
+        currentChange = new ChangeSet();
+        currentRevision = revisionRegexp.getParen( 1 );
+        currentChange.setAuthor( revisionRegexp.getParen( 2 ) );
+        currentChange.setDate( revisionRegexp.getParen( 3 ), userDatePattern );
+
+        status = GET_COMMENT_BEGIN;
+    }
+
+    /**
+     * Process the current input line in the GET_COMMENT state.  This
+     * state gathers all of the comments that are part of a log entry.
+     *
+     * @param line a line of text from the perforce log output
+     */
+    private void processGetComment( String line )
+    {
+        if ( line.equals( COMMENT_DELIMITER ) )
+        {
+            status = GET_AFFECTED_FILES;
+        }
+        else
+        {
+            // remove prepended tab
+            currentChange.setComment( currentChange.getComment() + line.substring(1) + "\n" );
+        }
+    }
+
+    /**
+     * Process the current input line in the GET_COMMENT state.  This
+     * state gathers all of the comments that are part of a log entry.
+     *
+     * @param line a line of text from the perforce log output
+     */
+    private void processGetAffectedFiles( String line )
+    {
+        if ( !line.equals( "Affected files ..." ) )
+        {
+            return;
+        }
+        status = GET_FILES_BEGIN;
+    }
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceDescribeConsumer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceDescribeConsumer.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Revision Id

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/checkout/PerforceCheckOutCommand.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/checkout/PerforceCheckOutCommand.java?rev=770320&r1=770319&r2=770320&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/checkout/PerforceCheckOutCommand.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/checkout/PerforceCheckOutCommand.java Thu Apr 30 16:50:15 2009
@@ -39,6 +39,14 @@
 import org.codehaus.plexus.util.cli.CommandLineUtils;
 import org.codehaus.plexus.util.cli.Commandline;
 
+import org.apache.regexp.RE;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.StringBufferInputStream;
+
 /**
  * @author Mike Perham
  * @version $Id$
@@ -121,6 +129,7 @@
         }
 
         boolean clientspecExists = consumer.isSuccess();
+
         // Perform the actual checkout using that clientspec
         try
         {
@@ -128,11 +137,23 @@
             {
                 try
                 {
+                    int lastChangelist = getLastChangelist( prepo, workingDirectory, specname );
                     cl = createCommandLine( prepo, workingDirectory, version, specname );
                     if ( getLogger().isDebugEnabled() )
                     {
                         getLogger().debug( "Executing: " + PerforceScmProvider.clean( cl.toString() ) );
                     }
+                    Process proc = cl.execute();
+                    BufferedReader br = new BufferedReader( new InputStreamReader( proc.getInputStream() ) );
+                    String line;
+                    while ( ( line = br.readLine() ) != null )
+                    {
+                        if ( getLogger().isDebugEnabled() )
+                        {
+                            getLogger().debug( "Consuming: " + line );
+                        }
+                        consumer.consumeLine( line );
+                    }
                     CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();
                     int exitCode = CommandLineUtils.executeCommandLine( cl, consumer, err );
 
@@ -158,6 +179,13 @@
                         getLogger().error( "CommandLineException " + e.getMessage(), e );
                     }
                 }
+                catch ( IOException e )
+                {
+                    if ( getLogger().isErrorEnabled() )
+                    {
+                        getLogger().error( "IOException " + e.getMessage(), e );
+                    }
+                }
             }
 
             if ( consumer.isSuccess() )
@@ -268,4 +296,54 @@
         return command;
     }
 
+    private int getLastChangelist( PerforceScmProviderRepository repo, File workingDirectory,
+                                   String specname )
+    {
+        int lastChangelist = 0;
+        try
+        {
+            Commandline command = PerforceScmProvider.createP4Command( repo, workingDirectory );
+
+            command.createArgument().setValue( "-c" + specname );
+            command.createArgument().setValue( "changes" );
+            command.createArgument().setValue( "-m1" );
+            command.createArgument().setValue( "-ssubmitted" );
+            command.createArgument().setValue( "//" + specname + "/..." );
+            getLogger().debug( "Executing: " + PerforceScmProvider.clean( command.toString() ) );
+            Process proc = command.execute();
+            BufferedReader br = new BufferedReader( new InputStreamReader( proc.getInputStream() ) );
+            String line;
+
+            String lastChangelistStr = "";
+            while ( ( line = br.readLine() ) != null )
+            {
+                getLogger().debug( "Consuming: " + line );
+                RE changeRegexp = new RE( "Change (\\d+)" );
+                if ( changeRegexp.match( line ) )
+                {
+                    lastChangelistStr = changeRegexp.getParen( 1 );
+                }
+            }
+            br.close();
+            // TODO: Read errors from STDERR?
+
+            try
+            {
+                lastChangelist = Integer.parseInt(lastChangelistStr);
+            }
+            catch( NumberFormatException nfe ) {
+                getLogger().debug("Could not parse changelist from line " + line);
+            }
+        }
+        catch ( IOException e )
+        {
+            getLogger().error( e );
+        }
+        catch ( CommandLineException e )
+        {
+            getLogger().error( e );
+        }
+
+        return lastChangelist;
+    }
 }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/checkout/PerforceCheckOutConsumer.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/checkout/PerforceCheckOutConsumer.java?rev=770320&r1=770319&r2=770320&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/checkout/PerforceCheckOutConsumer.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/checkout/PerforceCheckOutConsumer.java Thu Apr 30 16:50:15 2009
@@ -94,7 +94,7 @@
         }
 
         // Handle case where the clientspec is current
-        if ( currentState == STATE_NORMAL && line.indexOf( "file(s) up-to-date" ) != -1 )
+        if ( currentState == STATE_NORMAL && line.indexOf( "ile(s) up-to-date" ) != -1 )
         {
             return;
         }

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/update/PerforceHaveConsumer.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/update/PerforceHaveConsumer.java?rev=770320&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/update/PerforceHaveConsumer.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/update/PerforceHaveConsumer.java Thu Apr 30 16:50:15 2009
@@ -0,0 +1,87 @@
+package org.apache.maven.scm.provider.perforce.command.update;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.scm.ChangeFile;
+import org.apache.maven.scm.ChangeSet;
+import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.log.ScmLogger;
+import org.apache.maven.scm.util.AbstractConsumer;
+import org.apache.regexp.RE;
+import org.apache.regexp.RESyntaxException;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public class PerforceHaveConsumer
+    extends AbstractConsumer
+{
+    private String have;
+
+    /**
+     * The regular expression used to match header lines
+     */
+    private RE revisionRegexp;
+
+    private static final String PATTERN = "^Change (\\d+) " + // changelist number
+        "on (.*) " + // date
+        "by (.*)@"; // author
+
+    public PerforceHaveConsumer( ScmLogger logger )
+    {
+        super( logger );
+
+        try
+        {
+            revisionRegexp = new RE( PATTERN );
+        }
+        catch ( RESyntaxException ignored )
+        {
+            if ( getLogger().isErrorEnabled() )
+            {
+                getLogger().error( "Could not create regexp to parse perforce log file", ignored );
+            }
+        }
+    }
+
+    public String getHave() throws ScmException
+    {
+        return have;
+    }
+
+    // ----------------------------------------------------------------------
+    // StreamConsumer Implementation
+    // ----------------------------------------------------------------------
+
+    /** {@inheritDoc} */
+    public void consumeLine( String line )
+    {
+        if( revisionRegexp.match( line ) )
+        {
+            have = revisionRegexp.getParen( 1 );
+        }
+    }
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/update/PerforceHaveConsumer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/update/PerforceHaveConsumer.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Revision Id

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/update/PerforceUpdateCommand.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/update/PerforceUpdateCommand.java?rev=770320&r1=770319&r2=770320&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/update/PerforceUpdateCommand.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/update/PerforceUpdateCommand.java Thu Apr 30 16:50:15 2009
@@ -28,11 +28,20 @@
 import org.apache.maven.scm.command.checkout.CheckOutScmResult;
 import org.apache.maven.scm.command.update.AbstractUpdateCommand;
 import org.apache.maven.scm.command.update.UpdateScmResult;
+import org.apache.maven.scm.command.update.UpdateScmResultWithRevision;
 import org.apache.maven.scm.provider.ScmProviderRepository;
+import org.apache.maven.scm.provider.perforce.PerforceScmProvider;
+import org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository;
 import org.apache.maven.scm.provider.perforce.command.PerforceCommand;
 import org.apache.maven.scm.provider.perforce.command.changelog.PerforceChangeLogCommand;
 import org.apache.maven.scm.provider.perforce.command.checkout.PerforceCheckOutCommand;
 
+import org.codehaus.plexus.util.cli.CommandLineException;
+import org.codehaus.plexus.util.cli.CommandLineUtils;
+import org.codehaus.plexus.util.cli.Commandline;
+
+import java.io.File;
+
 /**
  * @author Mike Perham
  * @version $Id$
@@ -61,7 +70,45 @@
                                         false );
         }
 
-        return new UpdateScmResult( cosr.getCommandLine(), cosr.getCheckedOutFiles() );
+        PerforceScmProviderRepository p4repo = (PerforceScmProviderRepository) repo;
+        String clientspec = PerforceScmProvider.getClientspecName( getLogger(), p4repo, files.getBasedir() );
+        Commandline cl = createCommandLine( p4repo, files.getBasedir(), clientspec );
+
+        String location = PerforceScmProvider.getRepoPath( getLogger(), p4repo, files.getBasedir() );
+        PerforceHaveConsumer consumer =
+            new PerforceHaveConsumer( getLogger() );
+
+        try
+        {
+            if ( getLogger().isDebugEnabled() )
+            {
+                getLogger().debug( PerforceScmProvider.clean( "Executing " + cl.toString() ) );
+            }
+
+            CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();
+            int exitCode = CommandLineUtils.executeCommandLine( cl, consumer, err );
+
+            if ( exitCode != 0 )
+            {
+                String cmdLine = CommandLineUtils.toString( cl.getCommandline() );
+
+                StringBuffer msg = new StringBuffer( "Exit code: " + exitCode + " - " + err.getOutput() );
+                msg.append( '\n' );
+                msg.append( "Command line was:" + cmdLine );
+
+                throw new CommandLineException( msg.toString() );
+            }
+        }
+        catch ( CommandLineException e )
+        {
+            if ( getLogger().isErrorEnabled() )
+            {
+                getLogger().error( "CommandLineException " + e.getMessage(), e );
+            }
+        }
+
+        return new UpdateScmResultWithRevision( cosr.getCommandLine(), cosr.getCheckedOutFiles(),
+                                                String.valueOf( consumer.getHave() ) );
     }
 
     /** {@inheritDoc} */
@@ -71,4 +118,22 @@
         command.setLogger( getLogger() );
         return command;
     }
+
+    public static Commandline createCommandLine( PerforceScmProviderRepository repo, File workingDirectory,
+                                                 String clientspec )
+    {
+        Commandline command = PerforceScmProvider.createP4Command( repo, workingDirectory );
+
+        if ( clientspec != null )
+        {
+            command.createArg().setValue( "-c" );
+            command.createArg().setValue( clientspec );
+        }
+        command.createArg().setValue( "changes" );
+        command.createArg().setValue( "-m1" );
+        command.createArg().setValue( "-ssubmitted" );
+        command.createArg().setValue( "//" + clientspec + "/...#have" );
+
+	return command;
+    }
 }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogCommandTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogCommandTest.java?rev=770320&r1=770319&r2=770320&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogCommandTest.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogCommandTest.java Thu Apr 30 16:50:15 2009
@@ -20,12 +20,16 @@
  */
 
 import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.ScmRevision;
+import org.apache.maven.scm.ScmVersion;
 import org.apache.maven.scm.provider.perforce.PerforceScmProvider;
 import org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository;
 import org.apache.maven.scm.repository.ScmRepository;
 import org.codehaus.plexus.util.cli.Commandline;
 
 import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 
 /**
  * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
@@ -42,14 +46,14 @@
     public void testGetCommandLine()
         throws Exception
     {
-        testCommandLine( "scm:perforce://depot/projects/pathname", cmdPrefix + " filelog -t -l ..." );
+        testCommandLine( "scm:perforce://depot/projects/pathname", cmdPrefix + " changes -t ..." );
     }
 
     public void testGetCommandLineWithHost()
         throws Exception
     {
         testCommandLine( "scm:perforce:a:username@//depot/projects/pathname",
-                         cmdPrefix + " -p a -u username filelog -t -l ..." );
+                         cmdPrefix + " -p a -u username changes -t ..." );
     }
 
     public void testGetCommandLineWithHostAndPort()
@@ -57,7 +61,7 @@
     {
         System.setProperty( PerforceScmProvider.DEFAULT_CLIENTSPEC_PROPERTY, "foo" );
         testCommandLine( "scm:perforce:myhost:1234:username@//depot/projects/pathname",
-                         cmdPrefix + " -p myhost:1234 -u username -c foo filelog -t -l ..." );
+                         cmdPrefix + " -p myhost:1234 -u username -c foo changes -t ..." );
     }
 
     // ----------------------------------------------------------------------
@@ -71,8 +75,50 @@
 
         PerforceScmProviderRepository repo = (PerforceScmProviderRepository) repository.getProviderRepository();
 
+        Commandline cl = PerforceChangeLogCommand.createCommandLine( repo, workingDirectory,
+            System.getProperty( PerforceScmProvider.DEFAULT_CLIENTSPEC_PROPERTY ),
+             null, null, null, null, null );
+
+        assertCommandLine( commandLine, null, cl );
+    }
+
+    public void testGetCommandLineWithStartAndEndDates()
+        throws Exception
+    {
+        System.setProperty( PerforceScmProvider.DEFAULT_CLIENTSPEC_PROPERTY, "foo" );
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+        testCommandLineDates( cmdPrefix + " -c foo changes -t ...@2008/07/15:00:00:00,2008/07/16:00:00:00", sdf.parse("2008/07/15 00:00:00"), sdf.parse("2008/07/16 00:00:00") );
+    }
+
+    public void testGetCommandLineWithStartAndEndChangelists()
+        throws Exception
+    {
+        System.setProperty( PerforceScmProvider.DEFAULT_CLIENTSPEC_PROPERTY, "foo" );
+        testCommandLineRevs( cmdPrefix + " -c foo changes -t ...@123456,234567", new ScmRevision( "123456" ), new ScmRevision( "234567" ) );
+    }
+
+    private void testCommandLineRevs( String commandLine, ScmVersion version1, ScmVersion version2 )
+        throws Exception
+    {
+        ScmRepository repository = getScmManager().makeScmRepository( "scm:perforce://depot/projects/pathname");
+
+        PerforceScmProviderRepository repo = (PerforceScmProviderRepository) repository.getProviderRepository();
+
+        Commandline cl = PerforceChangeLogCommand.createCommandLine( repo, workingDirectory, System.getProperty(
+            PerforceScmProvider.DEFAULT_CLIENTSPEC_PROPERTY ), null, null, null, version1, version2 );
+
+        assertCommandLine( commandLine, null, cl );
+    }
+
+    private void testCommandLineDates( String commandLine, Date date1, Date date2 )
+        throws Exception
+    {
+        ScmRepository repository = getScmManager().makeScmRepository( "scm:perforce://depot/projects/pathname");
+
+        PerforceScmProviderRepository repo = (PerforceScmProviderRepository) repository.getProviderRepository();
+
         Commandline cl = PerforceChangeLogCommand.createCommandLine( repo, workingDirectory, System.getProperty(
-            PerforceScmProvider.DEFAULT_CLIENTSPEC_PROPERTY ) );
+            PerforceScmProvider.DEFAULT_CLIENTSPEC_PROPERTY ), null, date1, date2, null, null );
 
         assertCommandLine( commandLine, null, cl );
     }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogConsumerTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogConsumerTest.java?rev=770320&r1=770319&r2=770320&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogConsumerTest.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogConsumerTest.java Thu Apr 30 16:50:15 2009
@@ -42,8 +42,8 @@
     {
         File testFile = getTestFile( "src/test/resources/perforce/perforcelog.txt" );
 
-        PerforceChangeLogConsumer consumer =
-            new PerforceChangeLogConsumer( "//depot/test", null, null, null, new DefaultLog() );
+        PerforceChangesConsumer consumer =
+            new PerforceChangesConsumer( new DefaultLog() );
 
         FileInputStream fis = new FileInputStream( testFile );
         BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
@@ -54,12 +54,9 @@
             s = in.readLine();
         }
 
-        ArrayList entries = new ArrayList( consumer.getModifications() );
+        ArrayList entries = new ArrayList( consumer.getChanges() );
         assertEquals( "Wrong number of entries returned", 7, entries.size() );
-        ChangeSet entry = (ChangeSet) entries.get(0);
-        assertEquals( "jim", entry.getAuthor() );
-        assertEquals( "demo/demo.c", ( (ChangeFile) entry.getFiles().get( 0 ) ).getName() );
-        assertEquals( "2003-10-01", entry.getDateFormatted() );
-        assertEquals( "16:24:20", entry.getTimeFormatted() );
+        String changelist = (String) entries.get(2);
+        assertEquals( "9", changelist );
     }
 }

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceDescribeConsumerTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceDescribeConsumerTest.java?rev=770320&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceDescribeConsumerTest.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceDescribeConsumerTest.java Thu Apr 30 16:50:15 2009
@@ -0,0 +1,70 @@
+package org.apache.maven.scm.provider.perforce.command.changelog;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.scm.ChangeFile;
+import org.apache.maven.scm.ChangeSet;
+import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.log.DefaultLog;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public class PerforceDescribeConsumerTest
+    extends ScmTestCase
+{
+    public void testParse()
+        throws Exception
+    {
+        File testFile = getTestFile( "src/test/resources/perforce/perforcedescribelog.txt" );
+
+        PerforceDescribeConsumer consumer =
+            new PerforceDescribeConsumer( "//depot/test", null, new DefaultLog() );
+
+        FileInputStream fis = new FileInputStream( testFile );
+        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
+        String s = in.readLine();
+        while ( s != null )
+        {
+            consumer.consumeLine( s );
+            s = in.readLine();
+        }
+
+        ArrayList entries = new ArrayList( consumer.getModifications() );
+        assertEquals( "Wrong number of entries returned", 7, entries.size() );
+        ChangeSet entry = (ChangeSet) entries.get(0);
+        assertEquals( "mcronin", entry.getAuthor() );
+        assertEquals( "Wrong number of files returned", 3, entry.getFiles().size() );
+        assertEquals( "demo/demo.c", ( (ChangeFile) entry.getFiles().get( 0 ) ).getName() );
+        assertEquals( "2003-08-07", entry.getDateFormatted() );
+        assertEquals( "17:21:57", entry.getTimeFormatted() );
+        entry = (ChangeSet) entries.get(6);
+        assertEquals( "jim", entry.getAuthor() );
+        assertEquals( "Wrong number of files returned", 1, entry.getFiles().size() );
+        assertEquals( "junk/linefeed.txt", ( (ChangeFile) entry.getFiles().get( 0 ) ).getName() );
+    }
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceDescribeConsumerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceDescribeConsumerTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Revision Id

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/resources/perforce/perforcedescribelog.txt
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/resources/perforce/perforcedescribelog.txt?rev=770320&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/resources/perforce/perforcedescribelog.txt (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/resources/perforce/perforcedescribelog.txt Thu Apr 30 16:50:15 2009
@@ -0,0 +1,69 @@
+Change 13 by jim@cpt-jcrossley on 2003/10/15 13:38:40
+
+	Where's my change #
+
+Affected files ...
+
+... //depot/test/junk/linefeed.txt#3 edit
+... //depot/not-test/stuff.txt#1 add
+
+Change 10 by jim@jcrossley on 2003/10/15 07:14:46
+
+	Added a linefeed at the end to see if the [noeol] descriptor goes away in vim.
+
+Jobs fixed ...
+
+bug000001 on 2003/10/15 by jim *closed*
+
+	Description of the bug
+
+Affected files ...
+
+... //depot/test/junk/linefeed.txt#2 edit
+
+Change 9 by jim@cpt-jcrossley on 2003/10/15 07:01:59
+
+	Testing CR/LF resolution on different platforms
+
+Affected files ...
+
+... //depot/test/junk/linefeed.txt#1 add
+
+Change 7 by jim@cpt-jcrossley on 2003/10/01 16:24:20
+
+	Backing out my test changes
+	
+	Updating a description
+
+Affected files ...
+
+... //depot/test/demo/demo.c#4 edit
+
+Change 4 by jim@cpt-jcrossley on 2003/10/01 08:35:08
+
+	Another test
+
+Affected files ...
+
+... //depot/test/demo/demo.c#3 edit
+
+Change 3 by jim@cpt-jcrossley on 2003/10/01 08:29:15
+
+	Testing review daemon
+	
+	Updating description
+
+Affected files ...
+
+... //depot/test/demo/demo.c#2 edit
+
+Change 1 by mcronin@mcronin on 2003/08/07 17:21:57
+
+	demonstration of Perforce on Windows, Unix and VMS.
+
+Affected files ...
+
+... //depot/test/demo/demo.c#1 add
+... //depot/test/demo/dictcalls.txt#1 add
+... //depot/test/demo/dictwords.txt#1 add
+

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/resources/perforce/perforcedescribelog.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/resources/perforce/perforcedescribelog.txt
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/resources/perforce/perforcelog.txt
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/resources/perforce/perforcelog.txt?rev=770320&r1=770319&r2=770320&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/resources/perforce/perforcelog.txt (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/resources/perforce/perforcelog.txt Thu Apr 30 16:50:15 2009
@@ -1,47 +1,32 @@
-//depot/test/demo/demo.c
-... #4 change 7 edit on 2003/10/01 16:24:20 by jim@cpt-jcrossley (text)
+Change 13 on 2003/10/15 13:38:40 by jim@cpt-jcrossley
+
+	Where's my change #
+
+Change 10 on 2003/10/15 07:14:46 by jim@jcrossley
+
+	Added a linefeed at the end to see if the [noeol] descriptor goes away in vim.
+
+Change 9 on 2003/10/15 07:01:59 by jim@cpt-jcrossley
+
+	Testing CR/LF resolution on different platforms
+
+Change 7 on 2003/10/01 16:24:20 by jim@cpt-jcrossley
 
 	Backing out my test changes
 	
 	Updating a description
 
-... #3 change 4 edit on 2003/10/01 08:35:08 by jim@cpt-jcrossley (text)
+Change 4 on 2003/10/01 08:35:08 by jim@cpt-jcrossley
 
 	Another test
 
-... #2 change 3 edit on 2003/10/01 08:29:15 by jim@cpt-jcrossley (text)
+Change 3 on 2003/10/01 08:29:15 by jim@cpt-jcrossley
 
 	Testing review daemon
 	
 	Updating description
 
-... #1 change 1 add on 2003/08/07 17:21:57 by mcronin@mcronin (text)
-
-	demonstration of Perforce on Windows, Unix and VMS.
-
-... ... branch into //depot/releases/test-1/demo/demo.c#1
-//depot/test/demo/dictcalls.txt
-... #1 change 1 add on 2003/08/07 17:21:57 by mcronin@mcronin (text)
+Change 1 on 2003/08/07 17:21:57 by mcronin@mcronin
 
 	demonstration of Perforce on Windows, Unix and VMS.
 
-... ... branch into //depot/releases/test-1/demo/dictcalls.txt#1
-//depot/test/demo/dictwords.txt
-... #1 change 1 add on 2003/08/07 17:21:57 by mcronin@mcronin (text)
-
-	demonstration of Perforce on Windows, Unix and VMS.
-
-... ... branch into //depot/releases/test-1/demo/dictwords.txt#1
-//depot/test/junk/linefeed.txt
-... #3 change 13 edit on 2003/10/15 13:38:40 by jim@cpt-jcrossley (text)
-
-	Where's my change #
-
-... #2 change 10 edit on 2003/10/15 07:14:46 by jim@jcrossley (text)
-
-	Added a linefeed at the end to see if the [noeol] descriptor goes away in vim.
-
-... #1 change 9 add on 2003/10/15 07:01:59 by jim@cpt-jcrossley (text)
-
-	Testing CR/LF resolution on different platforms
-



Mime
View raw message