maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1042247 - in /maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src: main/java/org/apache/maven/scm/provider/accurev/ main/java/org/apache/maven/scm/provider/accurev/cli/ main/java/org/apache/maven/scm/provider/accurev/command...
Date Sat, 04 Dec 2010 22:22:50 GMT
Author: olamy
Date: Sat Dec  4 22:22:50 2010
New Revision: 1042247

URL: http://svn.apache.org/viewvc?rev=1042247&view=rev
Log:
[SCM-586] AccuRev 4.9 compatibility
Submitted by Grant Gardner .

Added:
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/util/WorkspaceUtils.java   (with props)
Modified:
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRev.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevCapability.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevInfo.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevScmProviderRepository.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevVersion.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/cli/AccuRevCommandLine.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/command/AbstractAccuRevExtractSourceCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/command/checkout/AccuRevCheckOutCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/command/export/AccuRevExportCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/command/status/AccuRevStatusCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/site/apt/index.apt
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/site/apt/tcktests.apt
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/site/apt/todos.apt
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/AccuRevCapabilityTest.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/cli/AccuRevCommandLineTest.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/command/AbstractAccuRevCommandTest.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/command/checkout/AccuRevCheckOutCommandTest.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/command/export/AccuRevExportCommandTest.java

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRev.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRev.java?rev=1042247&r1=1042246&r2=1042247&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRev.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRev.java Sat Dec  4 22:22:50 2010
@@ -56,15 +56,20 @@ public interface AccuRev
     void reset();
 
     /**
-     * Populate external to a workspace a specific version, to a specific location.
+     * Populate external to a workspace a (stream) and transactionId/time, to a specific location.
+     * 
+     * <p>
+     * You must check {@link AccuRevCapability#POPULATE_TO_TRANSACTION} before passing a tranid/time
+     * to this method. If not supported should pass "now","highest" or null for tranSpec
      * 
      * @param basedir
-     * @param versionSpec
+     * @param stream stream to update to
+     * @param tranSpec transaction to update to or "now" if not supported.
      * @param elements (must be depot relative. if null "/./" root is used)
      * @return
      * @throws AccuRevException
      */
-    List<File> pop( File basedir, String versionSpec, Collection<File> elements )
+    List<File> popExternal( File basedir, String stream, String tranSpec, Collection<File> elements )
         throws AccuRevException;
 
     /**
@@ -244,8 +249,8 @@ public interface AccuRev
 
     /**
      * AccuRev annotate an element
-     * @param file
      * 
+     * @param file
      * @return
      * @throws AccuRevException
      */
@@ -263,10 +268,10 @@ public interface AccuRev
     boolean login( String user, String password )
         throws AccuRevException;
 
-    Map<String, WorkSpace> showWorkSpaces( )
+    Map<String, WorkSpace> showWorkSpaces()
         throws AccuRevException;
 
-    Map<String, WorkSpace> showRefTrees( )
+    Map<String, WorkSpace> showRefTrees()
         throws AccuRevException;
 
     Stream showStream( String stream )

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevCapability.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevCapability.java?rev=1042247&r1=1042246&r2=1042247&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevCapability.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevCapability.java Sat Dec  4 22:22:50 2010
@@ -19,30 +19,30 @@ package org.apache.maven.scm.provider.ac
  * under the License.
  */
 
-public enum AccuRevCapability
-{
-    DIFF_BETWEEN_STREAMS( "4.7.2", null );
-
-    private String fromVersion;
-
-    private String toVersion;
-
-    private AccuRevCapability( String fromVersion, String toVersion )
-    {
-        this.fromVersion = fromVersion;
-        this.toVersion = toVersion;
-    }
-
-    /**
-     * @todo simple string compare because the version numbers have never used more than one digit.
-     * @param version
-     * @return if the capability is available for this version
-     */
-    public boolean isSupported( String version )
-    {
-        return ( fromVersion == null || fromVersion.compareTo( version ) <= 0 )
-            && ( toVersion == null || toVersion.compareTo( version ) >= 0 );
+public enum AccuRevCapability {
+	DIFF_BETWEEN_STREAMS("4.7.2", null), POPULATE_TO_TRANSACTION("4.9.0", "4.9.9"), STAT_ADDED_NOT_PROMOTED_BUG("4.9.0","4.9.9");
 
-    }
+	public static final String DEFAULT_VERSION_FOR_TESTS = "4.9.0";
+	
+	private String fromVersion;
+
+	private String toVersion;
+
+	private AccuRevCapability(String fromVersion, String toVersion) {
+		this.fromVersion = fromVersion;
+		this.toVersion = toVersion;
+	}
+
+	/**
+	 * @todo simple string compare because the version numbers have never used
+	 *       more than one digit.
+	 * @param version
+	 * @return if the capability is available for this version
+	 */
+	public boolean isSupported(String version) {
+		return (fromVersion == null || fromVersion.compareTo(version) <= 0)
+				&& (toVersion == null || toVersion.compareTo(version) >= 0);
+
+	}
 
 }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevInfo.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevInfo.java?rev=1042247&r1=1042246&r2=1042247&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevInfo.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevInfo.java Sat Dec  4 22:22:50 2010
@@ -21,6 +21,8 @@ package org.apache.maven.scm.provider.ac
 
 import java.io.File;
 
+import org.apache.maven.scm.provider.accurev.util.WorkspaceUtils;
+
 public class AccuRevInfo
 {
 
@@ -105,6 +107,7 @@ public class AccuRevInfo
 
     public AccuRevInfo( File basedir )
     {
+
         this.basedir = basedir;
     }
 
@@ -113,14 +116,16 @@ public class AccuRevInfo
         return getWorkSpace() != null;
     }
 
-    public boolean isWorkSpaceTop()
-    {
-        return ( getTop() != null ) && getBasedir().equals( new File( getTop() ) );
-    }
 
     public boolean isLoggedIn()
     {
         return !( this.user == null || "(not logged in)".equals( this.user ) );
     }
 
+    public boolean isWorkSpaceTop()
+    {
+        return WorkspaceUtils.isSameFile( this.getBasedir(), this.getTop() );
+
+    }
+
 }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevScmProviderRepository.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevScmProviderRepository.java?rev=1042247&r1=1042246&r2=1042247&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevScmProviderRepository.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevScmProviderRepository.java Sat Dec  4 22:22:50 2010
@@ -29,6 +29,7 @@ import java.util.regex.Pattern;
 import org.apache.maven.scm.ScmVersion;
 import org.apache.maven.scm.log.ScmLogger;
 import org.apache.maven.scm.provider.ScmProviderRepositoryWithHost;
+import org.apache.maven.scm.provider.accurev.util.WorkspaceUtils;
 import org.codehaus.plexus.util.StringUtils;
 
 public class AccuRevScmProviderRepository
@@ -107,16 +108,16 @@ public class AccuRevScmProviderRepositor
      */
     public boolean isWorkSpaceRoot( AccuRevInfo info )
     {
-
-        return ( ( getProjectPath() != null && info.getBasedir().equals( new File( info.getTop(), getProjectPath() ) ) ) || isWorkSpaceTop( info ) );
+        return ( ( getProjectPath() != null && WorkspaceUtils.isSameFile(info.getBasedir(), new File( info.getTop(), getProjectPath() ) ) ) || isWorkSpaceTop( info ) );
     }
 
     public boolean isWorkSpaceTop( AccuRevInfo info )
     {
-        return info.isWorkSpaceTop();
+        return info.isWorkSpaceTop();      
 
     }
 
+   
     String tagToStream( String tagName )
     {
         return String.format( getTagFormat(), tagName );
@@ -351,14 +352,14 @@ public class AccuRevScmProviderRepositor
 
     public static String formatTimeSpec( Date when )
     {
-    
+
         if ( when == null )
         {
             return "now";
         }
-    
+
         return AccuRev.ACCUREV_TIME_SPEC.format( when );
-    
+
     }
 
 }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevVersion.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevVersion.java?rev=1042247&r1=1042246&r2=1042247&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevVersion.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/AccuRevVersion.java Sat Dec  4 22:22:50 2010
@@ -2,6 +2,8 @@ package org.apache.maven.scm.provider.ac
 
 import java.util.Date;
 
+import org.codehaus.plexus.util.StringUtils;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -21,48 +23,46 @@ import java.util.Date;
  * under the License.
  */
 
-public class AccuRevVersion
-{
+public class AccuRevVersion {
+
+	private String basisStream;
+
+	private String timeSpec;
+
+	public AccuRevVersion(String basisStream, String tran) {
+
+		this.basisStream = basisStream;
+		this.timeSpec = tran;
+	}
+
+	public String getBasisStream() {
+		return basisStream;
+	}
+
+	public String getTimeSpec() {
+		return timeSpec;
+	}
+
+	public AccuRevVersion(String basis, Date startDate) {
+		this(basis, AccuRev.ACCUREV_TIME_SPEC.format(startDate));
+	}
+
+	public AccuRevVersion(String basis, long transactionId) {
+		this(basis, Long.toString(transactionId));
+	}
 
-    private String basisStream;
+	public boolean isNow() {
+		return isNow(this.timeSpec);
+	}
 
-    private String timeSpec;
+	@Override
+	public String toString() {
+		return String.format("AccuRevVersion: stream = %s, transaction= %s",
+				basisStream, timeSpec);
+	}
 
-    public AccuRevVersion( String basisStream, String tran )
-    {
-
-        this.basisStream = basisStream;
-        this.timeSpec = tran;
-    }
-
-    public String getBasisStream()
-    {
-        return basisStream;
-    }
-
-    public String getTimeSpec()
-    {
-        return timeSpec;
-    }
-
-    public AccuRevVersion( String basis, Date startDate )
-    {
-        this( basis, AccuRev.ACCUREV_TIME_SPEC.format( startDate ) );
-    }
-
-    public AccuRevVersion( String basis, long transactionId )
-    {
-        this( basis, Long.toString( transactionId ) );
-    }
-
-    public boolean isNow()
-    {
-        return timeSpec == null || "highest".equalsIgnoreCase( timeSpec ) || "now".equalsIgnoreCase( timeSpec );
-    }
-
-    @Override
-    public String toString()
-    {
-        return String.format( "AccuRevVersion: stream = %s, transaction= %s", basisStream, timeSpec );
-    }
+	public static boolean isNow(String timeSpec) {
+		return StringUtils.isBlank(timeSpec) || "highest".equalsIgnoreCase(timeSpec)
+				|| "now".equalsIgnoreCase(timeSpec);
+	}
 }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/cli/AccuRevCommandLine.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/cli/AccuRevCommandLine.java?rev=1042247&r1=1042246&r2=1042247&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/cli/AccuRevCommandLine.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/cli/AccuRevCommandLine.java Sat Dec  4 22:22:50 2010
@@ -36,6 +36,7 @@ import org.apache.maven.scm.provider.acc
 import org.apache.maven.scm.provider.accurev.AccuRevException;
 import org.apache.maven.scm.provider.accurev.AccuRevInfo;
 import org.apache.maven.scm.provider.accurev.AccuRevStat;
+import org.apache.maven.scm.provider.accurev.AccuRevVersion;
 import org.apache.maven.scm.provider.accurev.CategorisedElements;
 import org.apache.maven.scm.provider.accurev.FileDifference;
 import org.apache.maven.scm.provider.accurev.Stream;
@@ -78,15 +79,12 @@ public class AccuRevCommandLine
 
     public AccuRevCommandLine()
     {
-
         super();
         reset();
-
     }
 
     public AccuRevCommandLine( String host, int port )
     {
-
         this();
         setServer( host, port );
     }
@@ -251,6 +249,7 @@ public class AccuRevCommandLine
         errorOutput = new StringBuffer();
         cl.getShell().setQuotedArgumentsEnabled( true );
         cl.setExecutable( executable );
+
         try
         {
             cl.addSystemEnvironment();
@@ -259,7 +258,7 @@ public class AccuRevCommandLine
         {
             if ( getLogger().isDebugEnabled() )
             {
-                getLogger().warn( "Unable to obtain system environment", e );
+                getLogger().debug( "Unable to obtain system environment", e );
             }
             else
             {
@@ -279,7 +278,6 @@ public class AccuRevCommandLine
         String[] mkws = { "mkws", "-b", basisStream, "-w", workspaceName, "-l", basedir.getAbsolutePath() };
 
         return executeCommandLine( mkws );
-
     }
 
     /**
@@ -555,7 +553,7 @@ public class AccuRevCommandLine
                         : null;
     }
 
-    public List<File> pop( File basedir, String versionSpec, Collection<File> elements )
+    public List<File> popExternal( File basedir, String versionSpec, String tranSpec, Collection<File> elements )
         throws AccuRevException
     {
 
@@ -564,10 +562,24 @@ public class AccuRevCommandLine
             elements = Collections.singletonList( new File( "/./" ) );
         }
 
-        String[] pop = { "pop", "-v", versionSpec, "-L", basedir.getAbsolutePath(), "-R" };
+        if ( StringUtils.isBlank( tranSpec ) )
+        {
+            tranSpec = "now";
+        }
+
+        String[] popArgs;
+        if ( AccuRevVersion.isNow( tranSpec ) )
+        {
+            popArgs = new String[] { "pop", "-v", versionSpec, "-L", basedir.getAbsolutePath(), "-R" };
+        }
+        else //this will BARF for pre 4.9.0, but clients are expected to check AccuRevCapability before calling.
+        {
+            popArgs = new String[] { "pop", "-v", versionSpec, "-L", basedir.getAbsolutePath(), "-t", tranSpec, "-R" };
+        }
+       
 
         List<File> poppedFiles = new ArrayList<File>();
-        return executeCommandLine( basedir, pop, elements, FileConsumer.POPULATE_PATTERN, poppedFiles ) ? poppedFiles
+        return executeCommandLine( basedir, popArgs, elements, FileConsumer.POPULATE_PATTERN, poppedFiles ) ? poppedFiles
                         : null;
     }
 

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/command/AbstractAccuRevExtractSourceCommand.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/command/AbstractAccuRevExtractSourceCommand.java?rev=1042247&r1=1042246&r2=1042247&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/command/AbstractAccuRevExtractSourceCommand.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/command/AbstractAccuRevExtractSourceCommand.java Sat Dec  4 22:22:50 2010
@@ -52,10 +52,6 @@ public abstract class AbstractAccuRevExt
 
         ScmVersion scmVersion = parameters.getScmVersion( CommandParameter.SCM_VERSION, null );
 
-        AccuRevVersion accuRevVersion = repository.getAccuRevVersion( scmVersion );
-
-        String basisStream = accuRevVersion.getBasisStream();
-        String transactionId = accuRevVersion.getTimeSpec();
 
         File basedir = fileSet.getBasedir();
         String outputDirectory = parameters.getString( CommandParameter.OUTPUT_DIRECTORY, null );
@@ -74,17 +70,19 @@ public abstract class AbstractAccuRevExt
             throw new ScmException( "Checkout directory " + basedir.getAbsolutePath() + " not empty" );
         }
 
-        List<File> checkedOutFiles = extractSource( repository, basedir, basisStream, transactionId );
+        AccuRevVersion accuRevVersion = repository.getAccuRevVersion( scmVersion );
+        
+        List<File> checkedOutFiles = extractSource( repository, basedir, accuRevVersion );
         List<ScmFile> scmFiles =
             checkedOutFiles == null ? null : getScmFiles( checkedOutFiles, ScmFileStatus.CHECKED_OUT );
 
-        return getScmResult( repository, scmFiles );
+        return getScmResult( repository, scmFiles, scmVersion );
 
     }
 
-    protected abstract ScmResult getScmResult( AccuRevScmProviderRepository repository, List<ScmFile> scmFiles );
+    protected abstract ScmResult getScmResult( AccuRevScmProviderRepository repository, List<ScmFile> scmFiles, ScmVersion scmVersion );
 
     protected abstract List<File> extractSource( AccuRevScmProviderRepository repository, File basedir,
-                                                 String basisStream, String transactionId )
+                                                 AccuRevVersion version )
         throws AccuRevException;
 }
\ No newline at end of file

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/command/checkout/AccuRevCheckOutCommand.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/command/checkout/AccuRevCheckOutCommand.java?rev=1042247&r1=1042246&r2=1042247&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/command/checkout/AccuRevCheckOutCommand.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/command/checkout/AccuRevCheckOutCommand.java Sat Dec  4 22:22:50 2010
@@ -28,6 +28,7 @@ import org.apache.maven.scm.ScmException
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmFileSet;
 import org.apache.maven.scm.ScmResult;
+import org.apache.maven.scm.ScmVersion;
 import org.apache.maven.scm.command.checkout.CheckOutScmResult;
 import org.apache.maven.scm.log.ScmLogger;
 import org.apache.maven.scm.provider.ScmProviderRepository;
@@ -35,6 +36,7 @@ import org.apache.maven.scm.provider.acc
 import org.apache.maven.scm.provider.accurev.AccuRevException;
 import org.apache.maven.scm.provider.accurev.AccuRevInfo;
 import org.apache.maven.scm.provider.accurev.AccuRevScmProviderRepository;
+import org.apache.maven.scm.provider.accurev.AccuRevVersion;
 import org.apache.maven.scm.provider.accurev.command.AbstractAccuRevExtractSourceCommand;
 
 public class AccuRevCheckOutCommand
@@ -55,8 +57,7 @@ public class AccuRevCheckOutCommand
     }
 
     @Override
-    protected List<File> extractSource( AccuRevScmProviderRepository repository, File basedir, String basisStream,
-                                        String transactionId )
+    protected List<File> extractSource( AccuRevScmProviderRepository repository, File basedir, AccuRevVersion version )
         throws AccuRevException
     {
         AccuRev accuRev = repository.getAccuRev();
@@ -64,6 +65,9 @@ public class AccuRevCheckOutCommand
         AccuRevInfo info = accuRev.info( basedir );
 
         List<File> extractedFiles = new ArrayList<File>();
+        
+        String basisStream = version.getBasisStream();
+        String transactionId = version.getTimeSpec();
 
         boolean success = true;
         if ( info.isWorkSpace() )
@@ -86,6 +90,9 @@ public class AccuRevCheckOutCommand
             if ( success )
             {
                 // repopulate everything in the workspace.
+                // note we do NOT want -t here, we just fill in any missing files
+                // to the current transaction watermark...
+                // the update later on will get the extra files
                 List<File> poppedFiles = accuRev.pop( basedir, null );
                 if ( poppedFiles != null )
                 {
@@ -107,6 +114,12 @@ public class AccuRevCheckOutCommand
             String workSpaceName = getWorkSpaceName( basedir, basisStream );
 
             success = accuRev.mkws( basisStream, workSpaceName, basedir );
+            
+            //Even though a new workspace starts with "0" as the high water mark
+            //it can't be updated to anything less than its own mkstream transaction
+            //now is close enough since even if something does sneak inbetween we
+            //were just lucky that it didn't happen before...
+            transactionId = "now";
 
             if ( success )
             {
@@ -130,7 +143,7 @@ public class AccuRevCheckOutCommand
     }
 
     @Override
-    protected ScmResult getScmResult( AccuRevScmProviderRepository repository, List<ScmFile> scmFiles )
+    protected ScmResult getScmResult( AccuRevScmProviderRepository repository, List<ScmFile> scmFiles , ScmVersion version)
     {
 
         AccuRev accuRev = repository.getAccuRev();

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/command/export/AccuRevExportCommand.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/command/export/AccuRevExportCommand.java?rev=1042247&r1=1042246&r2=1042247&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/command/export/AccuRevExportCommand.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/command/export/AccuRevExportCommand.java Sat Dec  4 22:22:50 2010
@@ -28,15 +28,18 @@ import org.apache.maven.scm.ScmException
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmFileSet;
 import org.apache.maven.scm.ScmResult;
+import org.apache.maven.scm.ScmVersion;
 import org.apache.maven.scm.command.export.ExportScmResult;
+import org.apache.maven.scm.command.export.ExportScmResultWithRevision;
 import org.apache.maven.scm.log.ScmLogger;
 import org.apache.maven.scm.provider.ScmProviderRepository;
 import org.apache.maven.scm.provider.accurev.AccuRev;
+import org.apache.maven.scm.provider.accurev.AccuRevCapability;
 import org.apache.maven.scm.provider.accurev.AccuRevException;
 import org.apache.maven.scm.provider.accurev.AccuRevInfo;
 import org.apache.maven.scm.provider.accurev.AccuRevScmProviderRepository;
+import org.apache.maven.scm.provider.accurev.AccuRevVersion;
 import org.apache.maven.scm.provider.accurev.command.AbstractAccuRevExtractSourceCommand;
-import org.codehaus.plexus.util.StringUtils;
 
 public class AccuRevExportCommand
     extends AbstractAccuRevExtractSourceCommand
@@ -54,14 +57,22 @@ public class AccuRevExportCommand
     }
 
     @Override
-    protected List<File> extractSource( AccuRevScmProviderRepository repository, File basedir, String basisStream,
-                                        String transactionId )
+    protected List<File> extractSource( AccuRevScmProviderRepository repository, File basedir, AccuRevVersion version )
         throws AccuRevException
     {
         AccuRev accuRev = repository.getAccuRev();
         AccuRevInfo info = accuRev.info( basedir );
+        String basisStream = version.getBasisStream();
+        String transactionId = version.getTimeSpec();
 
-        validateTransactionId( transactionId );
+        if ( !AccuRevVersion.isNow( transactionId )
+            && !AccuRevCapability.POPULATE_TO_TRANSACTION.isSupported( accuRev.getClientVersion() ) )
+        {
+            getLogger().warn(
+                              String.format( "Ignoring transaction id %s, Export can only extract current sources",
+                                             transactionId ) );
+            transactionId = "now";
+        }
 
         boolean removedWorkspace = false;
 
@@ -88,8 +99,11 @@ public class AccuRevExportCommand
 
         try
         {
-            return accuRev.pop( basedir, basisStream,
-                                Collections.singletonList( new File( repository.getDepotRelativeProjectPath() ) ) );
+            return accuRev.popExternal(
+                                        basedir,
+                                        basisStream,
+                                        transactionId,
+                                        Collections.singletonList( new File( repository.getDepotRelativeProjectPath() ) ) );
 
         }
         finally
@@ -101,31 +115,21 @@ public class AccuRevExportCommand
         }
     }
 
-    private void validateTransactionId( String transactionId )
-        throws AccuRevException
-    {
-        if ( StringUtils.isBlank( transactionId ) )
-        {
-            return;
-        }
-
-        transactionId = transactionId.trim();
-
-        if ( "highest".equals( transactionId ) || "now".equals( transactionId ) )
-        {
-            return;
-        }
-
-        getLogger().warn( String.format("Ignoring transaction id %s, Export can only extract current sources",transactionId ));
-    }
-
     @Override
-    protected ScmResult getScmResult( AccuRevScmProviderRepository repository, List<ScmFile> scmFiles )
+    protected ScmResult getScmResult( AccuRevScmProviderRepository repository, List<ScmFile> scmFiles,
+                                      ScmVersion scmVersion )
     {
         AccuRev accuRev = repository.getAccuRev();
         if ( scmFiles != null )
         {
-            return new ExportScmResult( accuRev.getCommandLines(), scmFiles );
+            if ( scmVersion == null )
+            {
+                return new ExportScmResult( accuRev.getCommandLines(), scmFiles );
+            }
+            else
+            {
+                return new ExportScmResultWithRevision( accuRev.getCommandLines(), scmFiles, scmVersion.toString() );
+            }
         }
         else
         {

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/command/status/AccuRevStatusCommand.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/command/status/AccuRevStatusCommand.java?rev=1042247&r1=1042246&r2=1042247&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/command/status/AccuRevStatusCommand.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/command/status/AccuRevStatusCommand.java Sat Dec  4 22:22:50 2010
@@ -33,6 +33,7 @@ import org.apache.maven.scm.command.stat
 import org.apache.maven.scm.log.ScmLogger;
 import org.apache.maven.scm.provider.ScmProviderRepository;
 import org.apache.maven.scm.provider.accurev.AccuRev;
+import org.apache.maven.scm.provider.accurev.AccuRevCapability;
 import org.apache.maven.scm.provider.accurev.AccuRevException;
 import org.apache.maven.scm.provider.accurev.AccuRevScmProviderRepository;
 import org.apache.maven.scm.provider.accurev.AccuRevStat;
@@ -101,9 +102,19 @@ public class AccuRevStatusCommand
             return error( accuRev, "Failed stat backing stream to split modified and added elements" );
         }
 
-        List<File> addedElements = catElems.getNonMemberElements();
         modifiedElements = catElems.getMemberElements();
 
+        List<File> addedElements;
+        if ( AccuRevCapability.STAT_ADDED_NOT_PROMOTED_BUG.isSupported( accuRev.getClientVersion() ) )
+        {
+            modOrAddedElements.removeAll( modifiedElements );
+            addedElements = modOrAddedElements;
+        }
+        else
+        {
+            addedElements = catElems.getNonMemberElements();
+        }
+
         List<File> missingElements = accuRev.stat( basedir, elements, AccuRevStat.MISSING );
 
         if ( missingElements == null )

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/util/WorkspaceUtils.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/util/WorkspaceUtils.java?rev=1042247&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/util/WorkspaceUtils.java (added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/util/WorkspaceUtils.java Sat Dec  4 22:22:50 2010
@@ -0,0 +1,48 @@
+package org.apache.maven.scm.provider.accurev.util;
+
+import java.io.File;
+import java.io.IOException;
+
+public class WorkspaceUtils
+{
+    public static boolean isSameFile( File file1, String filename2)
+    {
+        return isSameFile( file1, filename2 == null ? null : new File( filename2 ) );
+
+    }
+
+    //We need to canonicalise the files (if we can) before we compare them..
+    public static boolean isSameFile( File file1, File file2 )
+    {
+        
+        if ( file1 == file2 || ( file1 == null && file2 == null ) )
+        {
+            return true;
+        }
+
+        if ( file1 == null || file2 == null )
+        {
+            return false;
+        }
+
+        try
+        {
+            file1 = file1.getCanonicalFile();
+        }
+        catch ( IOException ioEx )
+        {
+            //Oh well, we'll compare the non-canonicalised file then.
+        }
+
+        try
+        {
+            file2 = file2.getCanonicalFile();
+        }
+        catch ( IOException ioEx )
+        {
+            //Oh well, we'll compare the non-canonicalised file then.
+        }
+        return file1.equals( file2 );
+    }
+
+}

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/util/WorkspaceUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/main/java/org/apache/maven/scm/provider/accurev/util/WorkspaceUtils.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/site/apt/index.apt?rev=1042247&r1=1042246&r2=1042247&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/site/apt/index.apt (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/site/apt/index.apt Sat Dec  4 22:22:50 2010
@@ -12,11 +12,11 @@ Use Cases
 
  The provider must handle a number of different use cases:
 
- * DONE Label a source tree and check out that label to a temp directory (the release plugin)
-
- * DONE: Check out to a directory or update that source regularly as part of a build server (Continuum)
+ * Label a source tree and check out that label to a temp directory (the release plugin)
+ 
+ * Provide a changelog between dates/revisions and checkout code to a directory (Continuum et al)
 
- * MOST: Map a number of commands designed for CVS/SVN onto the semantics provided by AccuRev (the scm plugin)
+ * Map a number of commands designed for CVS/SVN onto the semantics provided by AccuRev (the scm plugin)
 
 Details
 
@@ -108,7 +108,8 @@ SCM Commands  
 
  The final step is to update the workspace to the tranid/timestamp specified in the supplied version (or "highest" if
  not specified). Note that workspaces cannot go backwards, even when reparented or repopulated and you will get
- "transaction out of range" errors if you try.
+ "transaction out of range" errors if you try. Since you can't update a workspace to a transaction less than one used
+ to create it, any transaction information supplied for an initial checkout will be silently ignored.
   
  * Non persistent checkout
 
@@ -119,6 +120,8 @@ SCM Commands  
  A populate outside of a workspace <<<accurev pop -V -l >>> If the checkout directory exists
  within a subdirectory of a workspace AccuRev would normally generate an error. To work around this restriction
  the existing workspace is temporarily deactivated during the export.
+ 
+ For AccuRev 4.9.x the provider supports export to a specific tranid/timestamp.
     
 * Tag
 
@@ -133,7 +136,7 @@ SCM Commands  
 
    Equivalent to <<<accurev update>>>. The working directory must be in a workspace (or reftree) and that whole
    workspace is updated.
-   
+   here has been the option to populate to a specific transaction id.
    A version of the form basisStream/timeSpec can be supplied (tag/branch/revision). If the basis stream of this version
    is different to the current basis of the workspace, then a <<<accurev chws>>> is performed. The timespec component
    is passed as the <<< -t >>> option to the update command. If not supplied the timespec is set to "highest".
@@ -165,7 +168,9 @@ SCM Commands  
   * <<<accurev stat -m>>> modified files
   
   * <<<accurev stat -b>>> to find state of kept and modified files in the backing stream to determine
-  whether their Maven ScmFileStatus is "ADDED" or "MODIFIED"
+  whether their Maven ScmFileStatus is "ADDED" or "MODIFIED". An unintended change in stat -b output
+  for AccuRev 4.9.0 breaks this distinction.
+  
   
   * <<<accurev stat -M>>> missing files => "MISSING" status
   

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/site/apt/tcktests.apt
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/site/apt/tcktests.apt?rev=1042247&r1=1042246&r2=1042247&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/site/apt/tcktests.apt (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/site/apt/tcktests.apt Sat Dec  4 22:22:50 2010
@@ -6,7 +6,7 @@
  January 2009
  --------------
 
-Junit4 + JMock
+Junit4 + Mockito
 
  This provider requires Java 1.5 and generally uses Junit4 annotations and <<<assertThat>>> syntax with {{{http://hamcrest.org}Hamcrest}} matchers.
  

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/site/apt/todos.apt
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/site/apt/todos.apt?rev=1042247&r1=1042246&r2=1042247&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/site/apt/todos.apt (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/site/apt/todos.apt Sat Dec  4 22:22:50 2010
@@ -8,7 +8,9 @@
  
   * Handle replicas
   
-  * Issue package on checkout - from a special file?
+  * Issue package on checkin - from a special file?
+  
+  * Issues in changelog output
   
   * consider using a property to specify workspace name. (or pattern %s replaced with basisStream+baseName)
  

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/AccuRevCapabilityTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/AccuRevCapabilityTest.java?rev=1042247&r1=1042246&r2=1042247&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/AccuRevCapabilityTest.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/AccuRevCapabilityTest.java Sat Dec  4 22:22:50 2010
@@ -36,4 +36,13 @@ public class AccuRevCapabilityTest
         assertThat( AccuRevCapability.DIFF_BETWEEN_STREAMS.isSupported( "4.7.4" ), is( true ) );
         assertThat( AccuRevCapability.DIFF_BETWEEN_STREAMS.isSupported( "5.0.1" ), is( true ) );
     }
+
+    @Test
+    public void testPopToTransaction()
+        throws Exception
+    {
+        assertThat( AccuRevCapability.POPULATE_TO_TRANSACTION.isSupported( "4.7.4b" ), is( false ) );
+        assertThat( AccuRevCapability.POPULATE_TO_TRANSACTION.isSupported( "4.9.0c" ), is( true ) );
+        assertThat( AccuRevCapability.POPULATE_TO_TRANSACTION.isSupported( "5.0.1" ), is( false ) );
+    }
 }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/cli/AccuRevCommandLineTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/cli/AccuRevCommandLineTest.java?rev=1042247&r1=1042246&r2=1042247&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/cli/AccuRevCommandLineTest.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/cli/AccuRevCommandLineTest.java Sat Dec  4 22:22:50 2010
@@ -228,7 +228,7 @@ public class AccuRevCommandLineTest
     }
 
     @Test
-    public void testPop()
+    public void testPopExternal()
         throws Exception
     {
 
@@ -236,15 +236,47 @@ public class AccuRevCommandLineTest
         accuRevCL.setExecutable( "accurev.exe" );
         File testfile = new File( "/my/export" );
         File projectDir = new File( "/./project/dir" );
-        accuRevCL.pop( testfile, "stream/12", Collections.singleton( projectDir ) );
+        accuRevCL.popExternal( testfile, "stream", "12", Collections.singleton( projectDir ) );
 
         Commandline lastCL = accuRevCL.getCommandline();
         assertThat( lastCL.getExecutable(), is( "accurev.exe" ) );
-        assertThat( lastCL.getArguments(), is( new String[] { "pop", "-H", "aHost:5051", "-v", "stream/12", "-L",
-            testfile.getAbsolutePath(), "-R", projectDir.getPath() } ) );
+        assertThat( lastCL.getArguments(), is( new String[] { "pop", "-H", "aHost:5051", "-v", "stream", "-L",
+            testfile.getAbsolutePath(), "-t", "12", "-R", projectDir.getPath() } ) );
+
+    }
+
+    @Test
+    public void testPopExternalWithTransactionNow()
+        throws Exception
+    {
+        AccuRevCommandLineTester accuRevCL = new AccuRevCommandLineTester( "aHost", 5051 );
+        accuRevCL.setExecutable( "accurev.exe" );
+        File testfile = new File( "/my/export" );
+        File projectDir = new File( "/./project/dir" );
+        accuRevCL.popExternal( testfile, "stream", "now", Collections.singleton( projectDir ) );
 
+        Commandline lastCL = accuRevCL.getCommandline();
+        assertThat( lastCL.getExecutable(), is( "accurev.exe" ) );
+        assertThat( lastCL.getArguments(), is( new String[] { "pop", "-H", "aHost:5051", "-v", "stream", "-L",
+            testfile.getAbsolutePath(),  "-R", projectDir.getPath() } ) );
     }
+    
+    @Test
+    public void testPopExternalWithTransactionNull()
+        throws Exception
+    {
+        AccuRevCommandLineTester accuRevCL = new AccuRevCommandLineTester( "aHost", 5051 );
+        accuRevCL.setExecutable( "accurev.exe" );
+        File testfile = new File( "/my/export" );
+        File projectDir = new File( "/./project/dir" );
+        accuRevCL.popExternal( testfile, "stream", null, Collections.singleton( projectDir ) );
 
+        Commandline lastCL = accuRevCL.getCommandline();
+        assertThat( lastCL.getExecutable(), is( "accurev.exe" ) );
+        assertThat( lastCL.getArguments(), is( new String[] { "pop", "-H", "aHost:5051", "-v", "stream", "-L",
+            testfile.getAbsolutePath(), "-R", projectDir.getPath() } ) );
+    }
+    
     @Test
     public void testPopWorkSpace()
         throws Exception

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/command/AbstractAccuRevCommandTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/command/AbstractAccuRevCommandTest.java?rev=1042247&r1=1042246&r2=1042247&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/command/AbstractAccuRevCommandTest.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/command/AbstractAccuRevCommandTest.java Sat Dec  4 22:22:50 2010
@@ -78,7 +78,7 @@ public abstract class AbstractAccuRevCom
 
         when( accurev.getCommandLines() ).thenReturn( "accurev mock" );
         when( accurev.getErrorOutput() ).thenReturn( "accurev mock error output" );
-        when( accurev.getClientVersion() ).thenReturn( "4.7.4b" );
+        when( accurev.getClientVersion() ).thenReturn( "4.9.0" );
         when( accurev.showStream( "myStream" ) ).thenReturn(
                                                              new Stream( "myStream", 10L, "myDepot", 1L, "myDepot",
                                                                          new Date(), "normal" ) );

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/command/checkout/AccuRevCheckOutCommandTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/command/checkout/AccuRevCheckOutCommandTest.java?rev=1042247&r1=1042246&r2=1042247&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/command/checkout/AccuRevCheckOutCommandTest.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/command/checkout/AccuRevCheckOutCommandTest.java Sat Dec  4 22:22:50 2010
@@ -35,10 +35,10 @@ import org.apache.maven.scm.CommandParam
 import org.apache.maven.scm.ScmException;
 import org.apache.maven.scm.ScmFileSet;
 import org.apache.maven.scm.ScmFileStatus;
+import org.apache.maven.scm.ScmRevision;
 import org.apache.maven.scm.ScmTag;
 import org.apache.maven.scm.command.checkout.CheckOutScmResult;
 import org.apache.maven.scm.provider.accurev.command.AbstractAccuRevCommandTest;
-import org.junit.Before;
 import org.junit.Test;
 
 /**
@@ -54,15 +54,6 @@ public class AccuRevCheckOutCommandTest
     extends AbstractAccuRevCommandTest
 {
 
-    @Before
-    public void setUp()
-        throws Exception
-    {
-        super.setUp();
-        when( accurev.info( basedir ) ).thenReturn( info );
-
-    }
-
     @SuppressWarnings( "unchecked" )
     @Test
     public void testCheckout()
@@ -73,7 +64,7 @@ public class AccuRevCheckOutCommandTest
                                                                                                                                 true );
 
         List<File> updatedFiles = Collections.singletonList( new File( "updated/file" ) );
-        when( accurev.update( basedir, null ) ).thenReturn( updatedFiles );
+        when( accurev.update( basedir, "now" ) ).thenReturn( updatedFiles );
 
         AccuRevCheckOutCommand command = new AccuRevCheckOutCommand( getLogger() );
 
@@ -94,7 +85,7 @@ public class AccuRevCheckOutCommandTest
 
         when( accurev.mkws( "myStream", AccuRevCheckOutCommand.getWorkSpaceName( basedir, "myStream" ), basedir ) ).thenReturn(
                                                                                                                                 true );
-        when( accurev.update( basedir, null ) ).thenReturn( null );
+        when( accurev.update( basedir, "now" ) ).thenReturn( null );
 
         AccuRevCheckOutCommand command = new AccuRevCheckOutCommand( getLogger() );
 
@@ -145,7 +136,7 @@ public class AccuRevCheckOutCommandTest
         when( accurev.chws( basedir, "someOldStream_someUser", "mySnapShot" ) ).thenReturn( true );
 
         List<File> emptyPop = Collections.emptyList();
-        when( accurev.pop( basedir, null ) ).thenReturn( emptyPop );
+        when( accurev.popExternal( basedir, null, null, null ) ).thenReturn( emptyPop );
 
         List<File> updatedFiles = Collections.singletonList( new File( "updated/file" ) );
         when( accurev.update( basedir, null ) ).thenReturn( updatedFiles );
@@ -183,4 +174,57 @@ public class AccuRevCheckOutCommandTest
 
     }
 
+    @Test
+    public void testCheckoutToVersionNewWorkspace()
+        throws Exception
+    {
+
+        when( accurev.mkws( "anotherStream", AccuRevCheckOutCommand.getWorkSpaceName( basedir, "anotherStream" ), basedir ) ).thenReturn(
+                                                                                                                                true );
+
+        List<File> updatedFiles = Collections.singletonList( new File( "updated/file" ) );
+        when( accurev.update( basedir, "now" ) ).thenReturn( updatedFiles );
+
+        AccuRevCheckOutCommand command = new AccuRevCheckOutCommand( getLogger() );
+
+        CommandParameters parameters = new CommandParameters();
+        parameters.setScmVersion( CommandParameter.SCM_VERSION, new ScmRevision( "anotherStream/12" ) );
+        
+        CheckOutScmResult result = command.checkout( repo, new ScmFileSet( basedir ), parameters );
+
+        assertThat( result.isSuccess(), is( true ) );
+        assertThat( result.getCheckedOutFiles().size(), is( 1 ) );
+
+    }
+    
+    @Test
+    public void testCheckoutToVersionExistingWorkspace()
+        throws Exception
+    {
+
+        // Set the info result to return a workspace that already exists
+        info.setWorkSpace( "someOldStream_someUser" );
+        info.setBasis( "myStream" );
+        info.setTop( basedir.getAbsolutePath() );
+
+        List<File> emptyList = Collections.emptyList();
+
+        when( accurev.pop( basedir, null ) ).thenReturn( emptyList );
+
+        List<File> updatedFiles = Collections.singletonList( new File( "updated/file" ) );
+        when( accurev.update( basedir, "12" ) ).thenReturn( updatedFiles );
+
+        AccuRevCheckOutCommand command = new AccuRevCheckOutCommand( getLogger() );
+
+        CommandParameters parameters = new CommandParameters();
+        parameters.setScmVersion( CommandParameter.SCM_VERSION, new ScmRevision( "myStream/12" ) );
+        CheckOutScmResult result = command.checkout( repo, new ScmFileSet( basedir ), parameters );
+
+        verify( accurev ).pop( basedir, null );
+
+        assertThat( result.isSuccess(), is( true ) );
+        assertThat( result.getCheckedOutFiles().size(), is( 1 ) );
+
+    }
+
 }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/command/export/AccuRevExportCommandTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/command/export/AccuRevExportCommandTest.java?rev=1042247&r1=1042246&r2=1042247&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/command/export/AccuRevExportCommandTest.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-accurev/src/test/java/org/apache/maven/scm/provider/accurev/command/export/AccuRevExportCommandTest.java Sat Dec  4 22:22:50 2010
@@ -53,6 +53,35 @@ public class AccuRevExportCommandTest
 {
 
     @Test
+    public void testExportToVersionPre490()
+        throws Exception
+    {
+     // info defaults to no workspace...
+        info.setWorkSpace( null );
+
+        when( accurev.info( basedir ) ).thenReturn( info );
+        
+        // A version that does not support pop -t
+        when( accurev.getClientVersion()).thenReturn( "4.7.4b" );
+
+        List<File> poppedFiles = Collections.singletonList( new File( "exported/file" ) );
+        when(
+              accurev.popExternal( eq( basedir ), eq( "mySnapShot" ), eq( "now" ),
+                                   (Collection<File>) argThat( hasItem( new File( "/./project/dir" ) ) ) ) ).thenReturn(
+                                                                                                                         poppedFiles );
+
+        AccuRevExportCommand command = new AccuRevExportCommand( getLogger() );
+
+        CommandParameters params = new CommandParameters();
+        params.setScmVersion( CommandParameter.SCM_VERSION, new ScmTag( "mySnapShot/676" ) );
+
+        ExportScmResult result = command.export( repo, new ScmFileSet( basedir ), params );
+
+        assertTrue( result.isSuccess() );
+        assertHasScmFile( result.getExportedFiles(), "exported/file", ScmFileStatus.CHECKED_OUT );
+
+    }
+    @Test
     public void testExportVersionOutSideWorkspace()
         throws Exception
     {
@@ -64,9 +93,9 @@ public class AccuRevExportCommandTest
 
         List<File> poppedFiles = Collections.singletonList( new File( "exported/file" ) );
         when(
-              accurev.pop( eq( basedir ), eq( "mySnapShot" ),
-                           (Collection<File>) argThat( hasItem( new File( "/./project/dir" ) ) ) ) ).thenReturn(
-                                                                                                                 poppedFiles );
+              accurev.popExternal( eq( basedir ), eq( "mySnapShot" ), eq( (String) null ),
+                                   (Collection<File>) argThat( hasItem( new File( "/./project/dir" ) ) ) ) ).thenReturn(
+                                                                                                                         poppedFiles );
 
         AccuRevExportCommand command = new AccuRevExportCommand( getLogger() );
 
@@ -88,15 +117,16 @@ public class AccuRevExportCommandTest
         // info defaults to no workspace...
         info.setWorkSpace( null );
         when( accurev.info( basedir ) ).thenReturn( info );
-
+        when( accurev.getClientVersion()).thenReturn( "4.9.0" );
         when(
-              accurev.pop( eq( basedir ), eq( "mySnapShot" ),
-                           (Collection<File>) argThat( hasItem( new File( "/./project/dir" ) ) ) ) ).thenReturn( null );
+              accurev.popExternal( eq( basedir ), eq( "mySnapShot" ), eq("544"),
+                                   (Collection<File>) argThat( hasItem( new File( "/./project/dir" ) ) ) ) ).thenReturn(
+                                                                                                                         null );
 
         AccuRevExportCommand command = new AccuRevExportCommand( getLogger() );
 
         CommandParameters params = new CommandParameters();
-        params.setScmVersion( CommandParameter.SCM_VERSION, new ScmTag( "mySnapShot" ) );
+        params.setScmVersion( CommandParameter.SCM_VERSION, new ScmTag( "mySnapShot/544"));
 
         ExportScmResult result = command.export( repo, new ScmFileSet( basedir ), params );
 
@@ -119,9 +149,9 @@ public class AccuRevExportCommandTest
         when( accurev.rmws( "myStream_me" ) ).thenReturn( Boolean.TRUE );
         List<File> poppedFiles = Collections.singletonList( new File( "exported/file" ) );
         when(
-              accurev.pop( eq( basedir ), eq( "mySnapShot" ),
-                           (Collection<File>) argThat( hasItem( new File( "/./project/dir" ) ) ) ) ).thenReturn(
-                                                                                                                 poppedFiles );
+              accurev.popExternal( eq( basedir ), eq( "mySnapShot" ), eq( "now" ),
+                                   (Collection<File>) argThat( hasItem( new File( "/./project/dir" ) ) ) ) ).thenReturn(
+                                                                                                                         poppedFiles );
         when( accurev.reactivate( "myStream_me" ) ).thenReturn( Boolean.TRUE );
 
         repo.setPersistCheckout( true );
@@ -156,9 +186,9 @@ public class AccuRevExportCommandTest
         when( accurev.rmws( "myStream_me" ) ).thenReturn( Boolean.TRUE );
         List<File> poppedFiles = Collections.singletonList( new File( "exported/file" ) );
         when(
-              accurev.pop( eq( basedir ), eq( "mySnapShot" ),
-                           (Collection<File>) argThat( hasItem( new File( "/./project/dir" ) ) ) ) ).thenReturn(
-                                                                                                                 poppedFiles );
+              accurev.popExternal( eq( basedir ), eq( "mySnapShot" ), eq( "now" ),
+                                   (Collection<File>) argThat( hasItem( new File( "/./project/dir" ) ) ) ) ).thenReturn(
+                                                                                                                         poppedFiles );
         when( accurev.reactivate( "myStream_me" ) ).thenReturn( Boolean.TRUE );
 
         repo.setPersistCheckout( false );



Mime
View raw message