maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mper...@apache.org
Subject svn commit: r365733 - 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/checkout/ main/java/org/apache/maven/scm/provider/...
Date Tue, 03 Jan 2006 20:18:36 GMT
Author: mperham
Date: Tue Jan  3 12:18:29 2006
New Revision: 365733

URL: http://svn.apache.org/viewcvs?rev=365733&view=rev
Log:
PR: SCM-119  Support SCM URLs which already have the dots in them

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/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/test/java/org/apache/maven/scm/provider/perforce/PerforceScmProviderTest.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/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/PerforceScmProvider.java?rev=365733&r1=365732&r2=365733&view=diff
==============================================================================
--- 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
Tue Jan  3 12:18:29 2006
@@ -275,4 +275,28 @@
         int end = string.indexOf(' ', idx);
         return string.substring( 0, idx ) + StringUtils.repeat( "*", end - idx ) + string.substring(
end );
     }
+    
+    /**
+     * Given a path like "//depot/foo/bar", returns the
+     * proper path to include everything beneath it.
+     * 
+     * //depot/foo/bar -> //depot/foo/bar/...
+     * //depot/foo/bar/ -> //depot/foo/bar/...
+     * //depot/foo/bar/... -> //depot/foo/bar/...
+     */
+    public static String getCanonicalRepoPath( String repoPath ) 
+    {
+        if ( repoPath.endsWith( "/..." ) )
+        {
+            return repoPath;
+        }
+        else if ( repoPath.endsWith( "/" ) ) 
+        {
+            return repoPath + "...";
+        }
+        else 
+        {
+            return repoPath + "/...";
+        }
+    }
 }

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/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/checkout/PerforceCheckOutCommand.java?rev=365733&r1=365732&r2=365733&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/checkout/PerforceCheckOutCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/checkout/PerforceCheckOutCommand.java
Tue Jan  3 12:18:29 2006
@@ -165,8 +165,8 @@
         buf.append( "Client: " ).append( clientspecName ).append( NEWLINE );
         buf.append( "Root: " ).append( workDir ).append( NEWLINE );
         buf.append( "View:" ).append( NEWLINE );
-        buf.append( "\t" ).append( repoPath ).append( "/... //" ).append( clientspecName
).append( "/..." )
-            .append( NEWLINE );
+        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
);
         return buf.toString();

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/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/status/PerforceStatusCommand.java?rev=365733&r1=365732&r2=365733&view=diff
==============================================================================
--- 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
Tue Jan  3 12:18:29 2006
@@ -122,7 +122,7 @@
     {
         Commandline command = PerforceScmProvider.createP4Command( repo, workingDirectory
);
         command.createArgument().setValue( "opened" );
-        command.createArgument().setValue( repo.getPath() + "/..." );
+        command.createArgument().setValue( PerforceScmProvider.getCanonicalRepoPath( repo.getPath()
) );
         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/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/tag/PerforceTagCommand.java?rev=365733&r1=365732&r2=365733&view=diff
==============================================================================
--- 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
Tue Jan  3 12:18:29 2006
@@ -179,7 +179,7 @@
     {
         StringBuffer buf = new StringBuffer();
         buf.append( "Label: " ).append( tag ).append( NEWLINE );
-        buf.append( "View: " ).append( repo.getPath() ).append( "/..." ).append( NEWLINE
);
+        buf.append( "View: " ).append( PerforceScmProvider.getCanonicalRepoPath( repo.getPath()
) ).append( NEWLINE );
         return buf.toString();
     }
 

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/PerforceScmProviderTest.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/PerforceScmProviderTest.java?rev=365733&r1=365732&r2=365733&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/PerforceScmProviderTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/PerforceScmProviderTest.java
Tue Jan  3 12:18:29 2006
@@ -152,6 +152,15 @@
 
         assertEquals( "//depot/projects/pathname", p4Repo.getPath() );
     }
+    
+    public void testRepositoryPathCanonicalization() 
+    {
+        assertEquals( "//depot/foo/bar/...", PerforceScmProvider.getCanonicalRepoPath( "//depot/foo/bar"
) );
+    
+        assertEquals( "//depot/foo/bar/...", PerforceScmProvider.getCanonicalRepoPath( "//depot/foo/bar/"
) );
+        
+        assertEquals( "//depot/foo/bar/...", PerforceScmProvider.getCanonicalRepoPath( "//depot/foo/bar/..."
) );
+    }
 
     // TODO: Add more tests for invalid connection strings.
 }



Mime
View raw message