maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cliff Evans (JIRA)" <>
Subject [jira] Commented: (SCM-269) Perforce support doesn't work when there's a space in the local path
Date Wed, 23 Dec 2009 15:38:55 GMT


Cliff Evans commented on SCM-269:

To make this work the Repo path in the Clientspec needs to be quoted.  Changing the createClientspec
method in the org/apache/maven/scm/provider/perforce/ file to that
shown below fixes the issue.  (I've changed the style of the section I changed to make it
standout more.)

     * Clientspec name can be overridden with the system property below.  I don't
     * know of any way for this code to get access to maven's settings.xml so this
     * is the best I can do.
     * Sample clientspec:

     Client: mperham-mikeperham-dt-maven
     Root: d:\temp\target
     Owner: mperham
     //depot/sandbox/mperham/tsa/tsa-domain/... //mperham-mikeperham-dt-maven/...
     Created by maven-scm-provider-perforce

    public static String createClientspec( ScmLogger logger, PerforceScmProviderRepository
repo, File workDir,
                                           String repoPath )
        String clientspecName = getClientspecName( logger, repo, workDir );
        String userName = getUsername( logger, repo );

        String rootDir;
            // SCM-184
            rootDir = workDir.getCanonicalPath();
        catch ( IOException ex )
            //getLogger().error("Error getting canonical path for working directory: " + workDir,
            rootDir = workDir.getAbsolutePath();

        StringBuffer buf = new StringBuffer();
        buf.append( "Client: " ).append( clientspecName ).append( NEWLINE );
        buf.append( "Root: " ).append( rootDir ).append( NEWLINE );
        buf.append( "Owner: " ).append( userName ).append( NEWLINE );
        // SCM-269
        buf.append( "View:" ).append( NEWLINE )
           .append( "\t\"" ).append( PerforceScmProvider.getCanonicalRepoPath( repoPath )
           .append( "\" //" ).append( clientspecName ).append( "/..." ).append( NEWLINE );
        buf.append( "Description:" ).append( NEWLINE );
        buf.append( "\t" ).append( "Created by maven-scm-provider-perforce" ).append( NEWLINE
        return buf.toString();

A unit test for it might look something like:

    public void testCreateClientSpec ()
        File workDir = new File ( "/work/directory" );
        ScmRepository repo = makeScmRepository( "scm:perforce:host://depot/projects/path name"
        PerforceScmProviderRepository p4Repo = (PerforceScmProviderRepository) repo.getProviderRepository();
        String cs = createClientspec ( null, p4Repo, workDir, "//depot/projects/path name"
        assertTrue( cs.contains ( "\"//depot/projects/path name/...\"" );

but I haven't tested this since I don't have access to the SVN repo other than through a browser.
 Paranoid SAs.



> Perforce support doesn't work when there's a space in the local path
> --------------------------------------------------------------------
>                 Key: SCM-269
>                 URL:
>             Project: Maven SCM
>          Issue Type: Bug
>          Components: maven-scm-provider-perforce
>    Affects Versions: 1.0-beta-4
>            Reporter: David Jackman
>            Assignee: Mike Perham
>             Fix For: future
> Create a view of a Maven project in Perforce in a local directory whose path contains
a space.  Perform some SCM goal (I was trying to scm:update).  It won't work.  The error message
is very cryptic ("Unable to sync.  Are you logged in?").  From the looks of it, the client
command (which is run just before the sync command) has problems, but these problems aren't
reported.  I think the main problem is the fact that the local path is used in the client
name, and client names can't contain spaces.  Other elements of the client (root and view)
also will contain spaces, but I don't know if Perforce has a problem with these.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


View raw message