maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mper...@apache.org
Subject svn commit: r481514 - in /maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src: main/java/org/apache/maven/scm/provider/perforce/ main/java/org/apache/maven/scm/provider/perforce/command/ main/java/org/apache/maven/scm/provider/perforce/...
Date Sat, 02 Dec 2006 07:18:11 GMT
Author: mperham
Date: Fri Dec  1 23:18:10 2006
New Revision: 481514

URL: http://svn.apache.org/viewvc?view=rev&rev=481514
Log:
PR: SCM-229
Adapt to invalid SCM URLs by using the 'p4 where' command at runtime.

Added:
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/PerforceWhereCommand.java
  (with props)
Modified:
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/PerforceScmProvider.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/PerforceInfoCommand.java
    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/checkin/PerforceCheckInCommand.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/status/PerforceStatusCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/tag/PerforceTagCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/repository/PerforceScmProviderRepository.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/site/apt/index.apt
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/checkin/PerforceCheckInCommandTest.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/status/PerforceStatusCommandTest.java

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/PerforceScmProvider.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/PerforceScmProvider.java?view=diff&rev=481514&r1=481513&r2=481514
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/PerforceScmProvider.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/PerforceScmProvider.java
Fri Dec  1 23:18:10 2006
@@ -19,6 +19,7 @@
 import org.apache.maven.scm.CommandParameters;
 import org.apache.maven.scm.ScmException;
 import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.log.ScmLogger;
 import org.apache.maven.scm.command.add.AddScmResult;
 import org.apache.maven.scm.command.changelog.ChangeLogScmResult;
 import org.apache.maven.scm.command.checkin.CheckInScmResult;
@@ -45,6 +46,7 @@
 import org.apache.maven.scm.provider.perforce.command.tag.PerforceTagCommand;
 import org.apache.maven.scm.provider.perforce.command.unedit.PerforceUnEditCommand;
 import org.apache.maven.scm.provider.perforce.command.update.PerforceUpdateCommand;
+import org.apache.maven.scm.provider.perforce.command.PerforceWhereCommand;
 import org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository;
 import org.apache.maven.scm.repository.ScmRepository;
 import org.apache.maven.scm.repository.ScmRepositoryException;
@@ -328,7 +330,7 @@
      Created by maven-scm-provider-perforce
 
      */
-    public static String createClientspec(PerforceScmProviderRepository repo, File workDir)
+    public static String createClientspec( PerforceScmProviderRepository repo, File workDir,
String repoPath )
     {
         String clientspecName = getClientspecName( repo, workDir );
         String userName = getUsername( repo );
@@ -350,7 +352,7 @@
         buf.append( "Root: " ).append( rootDir ).append( NEWLINE );
         buf.append( "Owner: " ).append( userName ).append( NEWLINE );
         buf.append( "View:" ).append( NEWLINE );
-        buf.append( "\t" ).append( PerforceScmProvider.getCanonicalRepoPath( repo.getPath()
) );
+        buf.append( "\t" ).append( PerforceScmProvider.getCanonicalRepoPath( repoPath ) );
         buf.append( " //" ).append( clientspecName ).append( "/..." ).append( NEWLINE );
         buf.append( "Description:" ).append( NEWLINE );
         buf.append( "\t" ).append( "Created by maven-scm-provider-perforce" ).append( NEWLINE
);
@@ -397,4 +399,49 @@
         }
         return username;
     }
-}
+
+    /**
+     * This is a "safe" method which handles cases where repo.getPath() is
+     * not actually a valid Perforce depot location.  This is a frequent error
+     * due to branches and directory naming where dir name != artifactId.
+     * @param log the logging object to use
+     * @param repo the Perforce repo
+     * @param basedir the base directory we are operating in.  If pom.xml exists in this
directory,
+     * this method will verify <pre>repo.getPath()/pom.xml</pre> == <pre>p4
where basedir/pom.xml</pre>
+     * @return repo.getPath if it is determined to be accurate.  The p4 where location otherwise.
+     */
+    public static String getRepoPath( ScmLogger log, PerforceScmProviderRepository repo,
File basedir )
+    {
+        PerforceWhereCommand where = new PerforceWhereCommand( log, repo );
+
+        // Handle an edge case where we release:prepare'd a module with an invalid SCM location.
+        // In this case, the release.properties will contain the invalid URL for checkout
purposes
+        // during release:perform.  In this case, the basedir is not the module root so we
detect that
+        // and remove the trailing target/checkout directory.
+        if ( basedir.toString().replace( '\\', '/' ).endsWith( "/target/checkout" ) )
+        {
+            String dir = basedir.toString();
+            basedir = new File( dir.substring( 0, dir.length() - "/target/checkout".length()
) );
+            log.debug( "Fixing checkout URL: " + basedir );
+        }
+        File pom = new File( basedir, "pom.xml" );
+        String loc = repo.getPath();
+        log.debug( "SCM path in pom: " + loc );
+        if ( pom.exists() )
+        {
+            loc = where.getDepotLocation( pom );
+            if ( loc.endsWith( "/pom.xml" ) )
+            {
+                loc = loc.substring( 0, loc.length() - "/pom.xml".length() );
+                log.debug( "Actual POM location: " + loc );
+                if ( !repo.getPath().equals( loc ) )
+                {
+                    log.info( "The SCM location in your pom.xml (" + repo.getPath() +
+                        ") is not equal to the depot location (" + loc + ").  This happens
frequently with branches.  " +
+                        "Ignoring the SCM location.");
+                }
+            }
+        }
+        return loc;
+    }
+}
\ No newline at end of file

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/PerforceInfoCommand.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/PerforceInfoCommand.java?view=diff&rev=481514&r1=481513&r2=481514
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/PerforceInfoCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/PerforceInfoCommand.java
Fri Dec  1 23:18:10 2006
@@ -1,21 +1,21 @@
 package org.apache.maven.scm.provider.perforce.command;
 
-import org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository;
-import org.apache.maven.scm.provider.perforce.PerforceScmProvider;
-import org.apache.maven.scm.provider.ScmProviderRepository;
-import org.apache.maven.scm.command.AbstractCommand;
-import org.apache.maven.scm.ScmResult;
-import org.apache.maven.scm.ScmFileSet;
 import org.apache.maven.scm.CommandParameters;
 import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.ScmResult;
+import org.apache.maven.scm.command.AbstractCommand;
+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.codehaus.plexus.util.cli.CommandLineException;
 import org.codehaus.plexus.util.cli.Commandline;
 
-import java.util.Map;
-import java.util.HashMap;
 import java.io.BufferedReader;
-import java.io.InputStreamReader;
 import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * Encapsulates the 'p4 info' command which can be very useful in determining

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/PerforceWhereCommand.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/PerforceWhereCommand.java?view=auto&rev=481514
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/PerforceWhereCommand.java
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/PerforceWhereCommand.java
Fri Dec  1 23:18:10 2006
@@ -0,0 +1,91 @@
+package org.apache.maven.scm.provider.perforce.command;
+
+import org.apache.maven.scm.log.ScmLogger;
+import org.apache.maven.scm.provider.perforce.PerforceScmProvider;
+import org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository;
+import org.codehaus.plexus.util.cli.CommandLineException;
+import org.codehaus.plexus.util.cli.Commandline;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+/**
+ * Encapsulates the 'p4 where' command which can be very useful in determining
+ * a file's location within the depot.  Use <code>getDepotLocation(String path)</code>
to query
+ * the depot location for a particular file.  The data from p4 where looks like this:
+ *
+ * <pre>
+   p4 where pom.xml
+   //depot/modules/fabric/trunk/pom.xml //mikeperham-dt/depot/modules/fabric/trunk/pom.xml
d:\perforce\depot\modules\fabric\trunk\pom.xml
+   </pre>
+ *
+ * @author mperham
+ */
+public class PerforceWhereCommand
+{
+    private ScmLogger logger = null;
+    private PerforceScmProviderRepository repo = null;
+
+    public PerforceWhereCommand( ScmLogger log, PerforceScmProviderRepository repos )
+    {
+        logger = log;
+        repo = repos;
+    }
+
+    public String getDepotLocation( File file )
+    {
+        return getDepotLocation( file.getAbsolutePath() );
+    }
+
+    /**
+     * @param filepath an absolute file path
+     * @return the absolute location of the given file within the Perforce repository or
null if the file
+     * does not exist in a mapping within the current clientspec.
+     */
+    public String getDepotLocation( String filepath )
+    {
+        try
+        {
+            Commandline command = PerforceScmProvider.createP4Command( repo, null );
+            command.createArgument().setValue( "where" );
+            command.createArgument().setValue( filepath );
+            logger.debug( PerforceScmProvider.clean( "Executing: " + command.toString() )
);
+            Process proc = command.execute();
+            BufferedReader br = new BufferedReader( new InputStreamReader( proc.getInputStream()
) );
+            String line;
+            String path = null;
+            while ( ( line = br.readLine() ) != null )
+            {
+                if ( line.indexOf( "not in client view" ) != -1 )
+                {
+                    // uh oh, something bad is happening
+                    logger.error( line );
+                    return null;
+                }
+                if ( line.indexOf( "is not under" ) != -1 )
+                {
+                    // uh oh, something bad is happening
+                    logger.error( line );
+                    return null;
+                }
+
+                logger.debug(line);
+                // verify that "//" appears twice in the line
+                path = line.substring( 0, line.lastIndexOf( "//" ) - 1 );
+            }
+            return path;
+        }
+        catch ( CommandLineException e )
+        {
+            logger.error( e );
+            throw new RuntimeException( e.getLocalizedMessage() );
+        }
+        catch ( IOException e )
+        {
+            logger.error( e );
+            throw new RuntimeException( e.getLocalizedMessage() );
+        }
+    }
+}

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

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?view=diff&rev=481514&r1=481513&r2=481514
==============================================================================
--- 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
Fri Dec  1 23:18:10 2006
@@ -58,8 +58,9 @@
         String clientspec = PerforceScmProvider.getClientspecName( p4repo, fileSet.getBasedir()
);
         Commandline cl = createCommandLine( p4repo, fileSet.getBasedir(), clientspec );
 
+        String location = PerforceScmProvider.getRepoPath( getLogger(), p4repo, fileSet.getBasedir()
);
         PerforceChangeLogConsumer consumer =
-            new PerforceChangeLogConsumer( p4repo.getPath(), startDate, endDate, datePattern,
getLogger() );
+            new PerforceChangeLogConsumer( location, startDate, endDate, datePattern, getLogger()
);
 
         try
         {

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/checkin/PerforceCheckInCommand.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/checkin/PerforceCheckInCommand.java?view=diff&rev=481514&r1=481513&r2=481514
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/checkin/PerforceCheckInCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/checkin/PerforceCheckInCommand.java
Fri Dec  1 23:18:10 2006
@@ -23,6 +23,7 @@
 import org.apache.maven.scm.provider.ScmProviderRepository;
 import org.apache.maven.scm.provider.perforce.PerforceScmProvider;
 import org.apache.maven.scm.provider.perforce.command.PerforceCommand;
+import org.apache.maven.scm.provider.perforce.command.PerforceWhereCommand;
 import org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository;
 import org.codehaus.plexus.util.cli.CommandLineException;
 import org.codehaus.plexus.util.cli.Commandline;
@@ -34,8 +35,8 @@
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.util.HashSet;
-import java.util.Set;
 import java.util.List;
+import java.util.Set;
 
 /**
  * @author Mike Perham
@@ -59,7 +60,10 @@
             Process proc = cl.execute();
             OutputStream out = proc.getOutputStream();
             DataOutputStream dos = new DataOutputStream( out );
-            String changes = createChangeListSpecification( (PerforceScmProviderRepository)
repo, files, message );
+            PerforceScmProviderRepository prepo = (PerforceScmProviderRepository) repo;
+            String changes = createChangeListSpecification( prepo, files, message,
+                                                            PerforceScmProvider.getRepoPath(
+                                                                getLogger(), prepo, files.getBasedir()
) );
             getLogger().debug( "Sending changelist:\n" + changes );
             dos.write( changes.getBytes() );
             dos.close();
@@ -97,7 +101,7 @@
     private static final String NEWLINE = "\r\n";
 
     public static String createChangeListSpecification( PerforceScmProviderRepository repo,
ScmFileSet files,
-                                                        String msg )
+                                                        String msg, String canonicalPath
)
     {
         StringBuffer buf = new StringBuffer();
         buf.append( "Change: new" ).append( NEWLINE ).append( NEWLINE );
@@ -134,7 +138,7 @@
                 {
                     canfile = canfile.substring( candir.length() + 1 );
                 }
-                buf.append( "\t" ).append( repo.getPath() ).append( "/" ).append( canfile.replace(
'\\', '/' ) )
+                buf.append( "\t" ).append( canonicalPath ).append( "/" ).append( canfile.replace(
'\\', '/' ) )
                     .append( NEWLINE );
             }
         }

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?view=diff&rev=481514&r1=481513&r2=481514
==============================================================================
--- 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
Fri Dec  1 23:18:10 2006
@@ -43,6 +43,7 @@
     extends AbstractCheckOutCommand
     implements PerforceCommand
 {
+    private String actualLocation;
 
     /**
      * Check out the depot code at <code>repo.getPath()</code> into the target
@@ -60,8 +61,10 @@
         PerforceScmProviderRepository prepo = (PerforceScmProviderRepository) repo;
         File workingDirectory = new File( files.getBasedir().getAbsolutePath() );
 
+        actualLocation = PerforceScmProvider.getRepoPath( getLogger(), prepo, files.getBasedir()
);
+
         String specname = PerforceScmProvider.getClientspecName( prepo, workingDirectory
);
-        PerforceCheckOutConsumer consumer = new PerforceCheckOutConsumer( specname, prepo.getPath()
);
+        PerforceCheckOutConsumer consumer = new PerforceCheckOutConsumer( specname, actualLocation
);
         getLogger().info( "Checkout working directory: " + workingDirectory );
         Commandline cl = null;
 
@@ -79,7 +82,7 @@
             // Write clientspec to STDIN
             OutputStream out = proc.getOutputStream();
             DataOutputStream dos = new DataOutputStream( out );
-            String client = PerforceScmProvider.createClientspec( prepo, workingDirectory
);
+            String client = PerforceScmProvider.createClientspec( prepo, workingDirectory,
actualLocation );
             getLogger().debug( "Updating clientspec:\n" + client );
             dos.write( client.getBytes() );
             dos.close();

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/status/PerforceStatusCommand.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/status/PerforceStatusCommand.java?view=diff&rev=481514&r1=481513&r2=481514
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/status/PerforceStatusCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/status/PerforceStatusCommand.java
Fri Dec  1 23:18:10 2006
@@ -47,17 +47,19 @@
     extends AbstractStatusCommand
     implements PerforceCommand
 {
+    private String actualLocation;
 
     protected StatusScmResult executeStatusCommand( ScmProviderRepository repo, ScmFileSet
files )
         throws ScmException
     {
         PerforceScmProviderRepository prepo = (PerforceScmProviderRepository) repo;
+        actualLocation = PerforceScmProvider.getRepoPath( getLogger(), prepo, files.getBasedir()
);
         PerforceStatusConsumer consumer = new PerforceStatusConsumer();
         Commandline command = readOpened( prepo, files, consumer );
 
         if ( consumer.isSuccess() )
         {
-            List scmfiles = createResults( prepo.getPath(), consumer );
+            List scmfiles = createResults( actualLocation, consumer );
             return new StatusScmResult( command.toString(), scmfiles );
         }
         else
@@ -93,7 +95,7 @@
     private Commandline readOpened( PerforceScmProviderRepository prepo, ScmFileSet files,
                                     PerforceStatusConsumer consumer )
     {
-        Commandline cl = createOpenedCommandLine( prepo, files.getBasedir() );
+        Commandline cl = createOpenedCommandLine( prepo, files.getBasedir(), actualLocation
);
         try
         {
             getLogger().debug( PerforceScmProvider.clean( "Executing " + cl.toString() )
);
@@ -118,11 +120,12 @@
         return cl;
     }
 
-    public static Commandline createOpenedCommandLine( PerforceScmProviderRepository repo,
File workingDirectory )
+    public static Commandline createOpenedCommandLine( PerforceScmProviderRepository repo,
File workingDirectory,
+                                                       String location )
     {
         Commandline command = PerforceScmProvider.createP4Command( repo, workingDirectory
);
         command.createArgument().setValue( "opened" );
-        command.createArgument().setValue( PerforceScmProvider.getCanonicalRepoPath( repo.getPath()
) );
+        command.createArgument().setValue( PerforceScmProvider.getCanonicalRepoPath( location
) );
         return command;
     }
 }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/tag/PerforceTagCommand.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/tag/PerforceTagCommand.java?view=diff&rev=481514&r1=481513&r2=481514
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/tag/PerforceTagCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/tag/PerforceTagCommand.java
Fri Dec  1 23:18:10 2006
@@ -25,6 +25,7 @@
 import org.apache.maven.scm.provider.perforce.PerforceScmProvider;
 import org.apache.maven.scm.provider.perforce.command.PerforceCommand;
 import org.apache.maven.scm.provider.perforce.command.PerforceInfoCommand;
+import org.apache.maven.scm.provider.perforce.command.PerforceWhereCommand;
 import org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository;
 import org.codehaus.plexus.util.cli.CommandLineException;
 import org.codehaus.plexus.util.cli.Commandline;
@@ -46,10 +47,14 @@
     extends AbstractTagCommand
     implements PerforceCommand
 {
+    private String actualRepoLocation = null;
 
     protected ScmResult executeTagCommand( ScmProviderRepository repo, ScmFileSet files,
String tag )
         throws ScmException
     {
+        PerforceScmProviderRepository prepo = (PerforceScmProviderRepository) repo;
+        actualRepoLocation = PerforceScmProvider.getRepoPath( getLogger(), prepo, files.getBasedir()
);
+
         PerforceTagConsumer consumer = new PerforceTagConsumer();
         createLabel( repo, files, tag, consumer, false );
         if ( consumer.isSuccess() )
@@ -80,7 +85,7 @@
 
     private boolean shouldLock()
     {
-        return Boolean.getBoolean( System.getProperty( "maven.scm.locktag", "true" ) );
+        return Boolean.valueOf( System.getProperty( "maven.scm.locktag", "true" ) ).booleanValue();
     }
 
     private void syncLabel( ScmProviderRepository repo, ScmFileSet files, String tag, PerforceTagConsumer
consumer )
@@ -119,6 +124,7 @@
             OutputStream out = proc.getOutputStream();
             DataOutputStream dos = new DataOutputStream( out );
             String label = createLabelSpecification( (PerforceScmProviderRepository) repo,
tag, lock );
+            getLogger().debug( "LabelSpec: " + NEWLINE + label );
             dos.write( label.getBytes() );
             dos.close();
             out.close();
@@ -178,7 +184,7 @@
     {
         StringBuffer buf = new StringBuffer();
         buf.append( "Label: " ).append( tag ).append( NEWLINE );
-        buf.append( "View: " ).append( PerforceScmProvider.getCanonicalRepoPath( repo.getPath()
) ).append( NEWLINE );
+        buf.append( "View: " ).append( PerforceScmProvider.getCanonicalRepoPath( actualRepoLocation
) ).append( NEWLINE );
         String username = repo.getUser();
         if ( username == null )
         {

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/repository/PerforceScmProviderRepository.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/repository/PerforceScmProviderRepository.java?view=diff&rev=481514&r1=481513&r2=481514
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/repository/PerforceScmProviderRepository.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/repository/PerforceScmProviderRepository.java
Fri Dec  1 23:18:10 2006
@@ -17,6 +17,9 @@
  */
 
 import org.apache.maven.scm.provider.ScmProviderRepositoryWithHost;
+import org.apache.maven.scm.provider.perforce.command.PerforceWhereCommand;
+
+import java.io.File;
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/site/apt/index.apt?view=diff&rev=481514&r1=481513&r2=481514
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/site/apt/index.apt
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/site/apt/index.apt
Fri Dec  1 23:18:10 2006
@@ -33,6 +33,8 @@
  * <<<maven.scm.persistcheckout>>> - Controls whether the Perforce provider
will delete
  the clientspec once the operation is done.  In the case where we just want to check out
a source tree to a temporary directory (like with the release plugin), we want this to be
false since there is no reason to keep the clientspec around.  On the other hand, when used
with Continuum, you want to remember the checkout so that repeated syncs take a minimum of
time.  The default is false.
 
+ * <<<maven.scm.locktag>>> - Controls whether the provider will lock the
tag once it has been successfully created.  This is useful for the release plugin since the
tag should be frozen based on a one-time release.  Defaults to true since none of the above
usecases require a floating label.
+
 Troubleshooting
 
  * Under the covers, the provider just executes the <<<p4>>> command. 
<<<p4>>> must be in your path.

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/checkin/PerforceCheckInCommandTest.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/checkin/PerforceCheckInCommandTest.java?view=diff&rev=481514&r1=481513&r2=481514
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/checkin/PerforceCheckInCommandTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/checkin/PerforceCheckInCommandTest.java
Fri Dec  1 23:18:10 2006
@@ -68,7 +68,8 @@
 
         assertEquals( commandLine, cl.toString() );
 
-        String change = PerforceCheckInCommand.createChangeListSpecification( svnRepository,
files, "Test checkin" );
+        String change = PerforceCheckInCommand.createChangeListSpecification( svnRepository,
files, "Test checkin",
+                                                                              "//depot/projects/pathname"
);
         assertContains( change, "//depot/projects/pathname/foo.xml" );
         assertContains( change, "//depot/projects/pathname/bar.xml" );
         assertContains( change, "Test checkin" );

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/status/PerforceStatusCommandTest.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/status/PerforceStatusCommandTest.java?view=diff&rev=481514&r1=481513&r2=481514
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/status/PerforceStatusCommandTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/status/PerforceStatusCommandTest.java
Fri Dec  1 23:18:10 2006
@@ -50,7 +50,8 @@
         ScmRepository repository = getScmManager().makeScmRepository( "scm:perforce://depot/projects/pathname"
);
         PerforceScmProviderRepository svnRepository = (PerforceScmProviderRepository) repository
             .getProviderRepository();
-        Commandline cl1 = PerforceStatusCommand.createOpenedCommandLine( svnRepository, workingDirectory
);
+        Commandline cl1 = PerforceStatusCommand.createOpenedCommandLine( svnRepository, workingDirectory,
+                                                                         "//depot/projects/pathname"
);
         assertEquals( expected, cl1.toString() );
     }
 }



Mime
View raw message