maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r209102 - in /maven/scm/trunk: ./ maven-scm-api/src/main/java/org/apache/maven/scm/provider/ maven-scm-api/src/main/java/org/apache/maven/scm/repository/ maven-scm-providers/maven-scm-provider-cvs/src/main/java/org/apache/maven/scm/provider...
Date Mon, 04 Jul 2005 17:30:27 GMT
Author: evenisse
Date: Mon Jul  4 10:30:26 2005
New Revision: 209102

URL: http://svn.apache.org/viewcvs?rev=209102&view=rev
Log:
[SCM-37]. Add ability to find the SCM url from a directory

Added:
    maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/repository/UnknownRepositoryStructure.java
  (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Entries
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Entries.Extra
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Entries.Extra.Old
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Entries.Old
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Repository
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Root
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Template
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/pom.xml
  (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/util/
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/util/EntriesReader.java
  (with props)
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/util/Entry.java
  (with props)
Modified:
    maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/AbstractScmProvider.java
    maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/ScmProvider.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/java/org/apache/maven/scm/provider/cvslib/CvsScmProvider.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib/repository/CvsScmProviderRepositoryTest.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/SvnScmProvider.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/repository/SvnScmProviderRepositoryTest.java
    maven/scm/trunk/pom.xml

Modified: maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/AbstractScmProvider.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/AbstractScmProvider.java?rev=209102&r1=209101&r2=209102&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/AbstractScmProvider.java
(original)
+++ maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/AbstractScmProvider.java
Mon Jul  4 10:30:26 2005
@@ -24,8 +24,10 @@
 import org.apache.maven.scm.log.ScmLogDispatcher;
 import org.apache.maven.scm.log.ScmLogger;
 import org.apache.maven.scm.repository.ScmRepositoryException;
+import org.apache.maven.scm.repository.UnknownRepositoryStructure;
 import org.apache.maven.scm.command.Command;
 
+import java.io.File;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.Map;
@@ -148,5 +150,14 @@
     public ScmLogger getLogger()
     {
         return logDispatcher;
+    }
+
+    /**
+     * @see org.apache.maven.scm.provider.ScmProvider#makeProviderScmRepository(java.io.File,
java.lang.String)
+     */
+    public ScmProviderRepository makeProviderScmRepository( File path )
+        throws ScmRepositoryException, UnknownRepositoryStructure
+    {
+        throw new UnknownRepositoryStructure();
     }
 }

Modified: maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/ScmProvider.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/ScmProvider.java?rev=209102&r1=209101&r2=209102&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/ScmProvider.java
(original)
+++ maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/ScmProvider.java
Mon Jul  4 10:30:26 2005
@@ -16,6 +16,7 @@
  * limitations under the License.
  */
 
+import java.io.File;
 import java.util.List;
 
 import org.apache.maven.scm.CommandParameters;
@@ -24,6 +25,7 @@
 import org.apache.maven.scm.ScmResult;
 import org.apache.maven.scm.log.ScmLogger;
 import org.apache.maven.scm.repository.ScmRepositoryException;
+import org.apache.maven.scm.repository.UnknownRepositoryStructure;
 
 /**
  * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
@@ -39,6 +41,9 @@
 
     ScmProviderRepository makeProviderScmRepository( String scmSpecificUrl, char delimiter
)
         throws ScmRepositoryException;
+
+    ScmProviderRepository makeProviderScmRepository( File path )
+        throws ScmRepositoryException, UnknownRepositoryStructure;
 
     List validateScmUrl( String scmSpecificUrl, char delimiter );
 

Added: maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/repository/UnknownRepositoryStructure.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/repository/UnknownRepositoryStructure.java?rev=209102&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/repository/UnknownRepositoryStructure.java
(added)
+++ maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/repository/UnknownRepositoryStructure.java
Mon Jul  4 10:30:26 2005
@@ -0,0 +1,26 @@
+package org.apache.maven.scm.repository;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public class UnknownRepositoryStructure
+    extends Exception
+{
+}

Propchange: maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/repository/UnknownRepositoryStructure.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/repository/UnknownRepositoryStructure.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/java/org/apache/maven/scm/provider/cvslib/CvsScmProvider.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/java/org/apache/maven/scm/provider/cvslib/CvsScmProvider.java?rev=209102&r1=209101&r2=209102&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/java/org/apache/maven/scm/provider/cvslib/CvsScmProvider.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/main/java/org/apache/maven/scm/provider/cvslib/CvsScmProvider.java
Mon Jul  4 10:30:26 2005
@@ -20,8 +20,12 @@
 import org.apache.maven.scm.provider.ScmProviderRepository;
 import org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository;
 import org.apache.maven.scm.repository.ScmRepositoryException;
+import org.apache.maven.scm.repository.UnknownRepositoryStructure;
+import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.StringUtils;
 
+import java.io.File;
+import java.io.IOException;
 import java.util.Map;
 import java.util.List;
 import java.util.ArrayList;
@@ -65,7 +69,7 @@
     // ----------------------------------------------------------------------
 
     public ScmProviderRepository makeProviderScmRepository( String scmSpecificUrl, char delimiter
)
-    	throws ScmRepositoryException
+        throws ScmRepositoryException
     {
         ScmUrlParserResult result = parseScmUrl( scmSpecificUrl, delimiter );
 
@@ -77,6 +81,49 @@
         return result.repository;
     }
 
+    /**
+     * @see org.apache.maven.scm.provider.AbstractScmProvider#makeProviderScmRepository(java.io.File)
+     */
+    public ScmProviderRepository makeProviderScmRepository( File path )
+        throws ScmRepositoryException, UnknownRepositoryStructure
+    {
+        if ( path == null || !path.isDirectory() )
+        {
+            throw new ScmRepositoryException( path.getAbsolutePath() + " isn't a valid directory."
);
+        }
+
+        File cvsDirectory = new File( path, "CVS" );
+
+        if ( !cvsDirectory.exists() )
+        {
+            throw new ScmRepositoryException( path.getAbsolutePath() + " isn't a cvs checkout
directory." );
+        }
+
+        File cvsRootFile = new File( cvsDirectory, "Root" );
+        File moduleFile = new File( cvsDirectory, "Repository" );
+        String cvsRoot;
+        String module;
+
+        try
+        {
+            cvsRoot = FileUtils.fileRead( cvsRootFile ).trim().substring( 1 );
+        }
+        catch ( IOException e )
+        {
+            throw new ScmRepositoryException( "Can't read " + cvsRootFile.getAbsolutePath()
);
+        }
+        try
+        {
+            module = FileUtils.fileRead( moduleFile ).trim();
+        }
+        catch ( IOException e )
+        {
+            throw new ScmRepositoryException( "Can't read " + moduleFile.getAbsolutePath()
);
+        }
+
+        return makeProviderScmRepository( cvsRoot + ":" + module, ':' );
+    }
+
     public List validateScmUrl( String scmSpecificUrl, char delimiter )
     {
         ScmUrlParserResult result = parseScmUrl( scmSpecificUrl, delimiter );
@@ -117,16 +164,15 @@
 
         String cvsroot;
 
-        String transport = tokens[ 0 ];
+        String transport = tokens[0];
 
         if ( transport.equalsIgnoreCase( TRANSPORT_LOCAL ) )
         {
             // use the local repository directory eg. '/home/cvspublic'
-            cvsroot = tokens[ 1 ];
+            cvsroot = tokens[1];
         }
-        else if ( transport.equalsIgnoreCase( TRANSPORT_PSERVER ) ||
-                  transport.equalsIgnoreCase( TRANSPORT_LSERVER ) ||
-                  transport.equalsIgnoreCase( TRANSPORT_EXT ) )
+        else if ( transport.equalsIgnoreCase( TRANSPORT_PSERVER ) || transport.equalsIgnoreCase(
TRANSPORT_LSERVER )
+                  || transport.equalsIgnoreCase( TRANSPORT_EXT ) )
         {
             if ( tokens.length != 4 && transport.equalsIgnoreCase( TRANSPORT_EXT
) )
             {
@@ -144,18 +190,18 @@
             if ( transport.equalsIgnoreCase( TRANSPORT_LSERVER ) )
             {
                 //create the cvsroot as the local socket cvsroot
-                cvsroot = tokens[ 1 ] + ":" + tokens[ 2 ];
+                cvsroot = tokens[1] + ":" + tokens[2];
             }
             else
             {
                 //create the cvsroot as the remote cvsroot
                 if ( tokens.length == 4 )
                 {
-                    cvsroot = ":" + transport + ":" + tokens[ 1 ] + ":" + tokens[ 2 ];
+                    cvsroot = ":" + transport + ":" + tokens[1] + ":" + tokens[2];
                 }
                 else
                 {
-                    cvsroot = ":" + transport + ":" + tokens[ 1 ] + ":" + tokens[ 2 ] + ":"
+ tokens[ 3 ];
+                    cvsroot = ":" + transport + ":" + tokens[1] + ":" + tokens[2] + ":" +
tokens[3];
                 }
             }
         }
@@ -172,7 +218,7 @@
 
         if ( !transport.equalsIgnoreCase( TRANSPORT_LOCAL ) )
         {
-            String userhost = tokens[ 1 ];
+            String userhost = tokens[1];
 
             int index = userhost.indexOf( "@" );
 
@@ -196,25 +242,25 @@
 
         if ( transport.equals( TRANSPORT_LOCAL ) )
         {
-            path = tokens[ 1 ];
+            path = tokens[1];
 
-            module = tokens[ 2 ];
+            module = tokens[2];
         }
         else
         {
             if ( tokens.length == 4 )
             {
-                path = tokens[ 2 ];
+                path = tokens[2];
 
-                module = tokens[ 3 ];
+                module = tokens[3];
             }
             else
             {
-                port = new Integer( tokens[ 2 ] ).intValue();
+                port = new Integer( tokens[2] ).intValue();
 
-                path = tokens[ 3 ];
+                path = tokens[3];
 
-                module = tokens[ 4 ];
+                module = tokens[4];
             }
         }
 

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib/repository/CvsScmProviderRepositoryTest.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib/repository/CvsScmProviderRepositoryTest.java?rev=209102&r1=209101&r2=209102&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib/repository/CvsScmProviderRepositoryTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/java/org/apache/maven/scm/provider/cvslib/repository/CvsScmProviderRepositoryTest.java
Mon Jul  4 10:30:26 2005
@@ -17,6 +17,7 @@
  */
 
 import org.apache.maven.scm.provider.cvslib.AbstractCvsScmTest;
+import org.apache.maven.scm.provider.cvslib.CvsScmProvider;
 import org.apache.maven.scm.repository.ScmRepository;
 import org.apache.maven.scm.repository.ScmRepositoryException;
 import org.codehaus.plexus.scm.ScmManager;
@@ -39,6 +40,25 @@
         scmManager = getScmManager();
     }
 
+    public void testParseConnectionFromPath()
+        throws Exception
+    {
+        CvsScmProvider provider = new CvsScmProvider();
+
+        CvsScmProviderRepository repo = (CvsScmProviderRepository) provider
+            .makeProviderScmRepository( getTestFile( "src/test/resources/checkoutdir" ) );
+
+        assertEquals( "ext", repo.getTransport() );
+
+        assertEquals( "evenisse", repo.getUser() );
+
+        assertEquals( "cvs.surefire.codehaus.org", repo.getHost() );
+
+        assertEquals( "/home/projects/surefire/scm", repo.getPath() );
+
+        assertEquals( "surefire", repo.getModule() );
+    }
+
     public void testParseRemotePserverConnection()
         throws Exception
     {
@@ -59,25 +79,25 @@
     }
 
     public void testParseRemotePserverConnectionWithPort()
-    throws Exception
-{
-    String url = "pserver:anoncvs@cvs.apache.org:2401:/home/cvspublic:maven";
+        throws Exception
+    {
+        String url = "pserver:anoncvs@cvs.apache.org:2401:/home/cvspublic:maven";
 
-    CvsScmProviderRepository repo = testUrl( url );
+        CvsScmProviderRepository repo = testUrl( url );
 
-    assertEquals( "pserver", repo.getTransport() );
+        assertEquals( "pserver", repo.getTransport() );
 
-    assertEquals( "anoncvs", repo.getUser() );
+        assertEquals( "anoncvs", repo.getUser() );
 
-    assertEquals( "cvs.apache.org", repo.getHost() );
+        assertEquals( "cvs.apache.org", repo.getHost() );
 
-    assertEquals( "/home/cvspublic", repo.getPath() );
+        assertEquals( "/home/cvspublic", repo.getPath() );
 
-    assertEquals( 2401, repo.getPort() );
+        assertEquals( 2401, repo.getPort() );
 
-    assertEquals( ":pserver:anoncvs@cvs.apache.org:2401:/home/cvspublic", repo.getCvsRoot()
);
+        assertEquals( ":pserver:anoncvs@cvs.apache.org:2401:/home/cvspublic", repo.getCvsRoot()
);
 
-}
+    }
 
     public void testParseRemotePserverConnectionWithBarsAsDelimiter()
         throws Exception
@@ -114,9 +134,9 @@
 
         assertNull( repo.getHost() );
 
-        assertEquals("/home/cvspublic", repo.getPath() );
+        assertEquals( "/home/cvspublic", repo.getPath() );
 
-        assertEquals("/home/cvspublic", repo.getCvsRoot() );
+        assertEquals( "/home/cvspublic", repo.getCvsRoot() );
     }
 
     // ----------------------------------------------------------------------
@@ -132,8 +152,8 @@
 
         assertNotNull( "The provider repository was null.", repository.getProviderRepository()
);
 
-        assertTrue( "The SCM Repository isn't a " + CvsScmProviderRepository.class.getName()
+ ".",
-                    repository.getProviderRepository() instanceof CvsScmProviderRepository
);
+        assertTrue( "The SCM Repository isn't a " + CvsScmProviderRepository.class.getName()
+ ".", repository
+            .getProviderRepository() instanceof CvsScmProviderRepository );
 
         return (CvsScmProviderRepository) repository.getProviderRepository();
     }
@@ -158,4 +178,4 @@
             // expected
         }
     }
- }
+}

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Entries
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Entries?rev=209102&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Entries
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Entries
Mon Jul  4 10:30:26 2005
@@ -0,0 +1 @@
+/pom.xml/1.10/Sat Jul  2 13:13:10 2005//

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Entries.Extra
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Entries.Extra?rev=209102&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Entries.Extra
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Entries.Extra
Mon Jul  4 10:30:26 2005
@@ -0,0 +1,9 @@
+D/surefire///
+D/surefire-beanshell///
+D/surefire-booter///
+D/surefire-jython///
+D/surefire-web///
+D/surefire-xmlrpc///
+D/xdocs///
+/project.xml///
+/pom.xml///

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Entries.Extra.Old
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Entries.Extra.Old?rev=209102&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Entries.Extra.Old
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Entries.Extra.Old
Mon Jul  4 10:30:26 2005
@@ -0,0 +1,9 @@
+D/surefire////
+D/surefire-beanshell////
+D/surefire-booter////
+D/surefire-jython////
+D/surefire-web////
+D/surefire-xmlrpc////
+D/xdocs////
+/project.xml////
+/pom.xml////

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Entries.Old
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Entries.Old?rev=209102&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Entries.Old
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Entries.Old
Mon Jul  4 10:30:26 2005
@@ -0,0 +1,9 @@
+D/surefire////
+D/surefire-beanshell////
+D/surefire-booter////
+D/surefire-jython////
+D/surefire-web////
+D/surefire-xmlrpc////
+D/xdocs////
+/project.xml/1.2/Fri Oct  8 21:29:26 2004//
+/pom.xml/1.6/Wed Mar 23 20:50:26 2005//

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Repository
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Repository?rev=209102&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Repository
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Repository
Mon Jul  4 10:30:26 2005
@@ -0,0 +1 @@
+surefire

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Root
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Root?rev=209102&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Root
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Root
Mon Jul  4 10:30:26 2005
@@ -0,0 +1 @@
+:ext:evenisse@cvs.surefire.codehaus.org:/home/projects/surefire/scm

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Template
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/CVS/Template?rev=209102&view=auto
==============================================================================
    (empty)

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/pom.xml
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/pom.xml?rev=209102&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/pom.xml
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/pom.xml
Mon Jul  4 10:30:26 2005
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>surefire</groupId>
+  <artifactId>surefire-root</artifactId>
+  <packaging>pom</packaging>
+  <name>SureFire Parent</name>
+  <version>1.1-SNAPSHOT</version>
+  <description>Surefire is a test framework project.</description>
+  <url>http://surefire.codehaus.org/</url>
+  <issueManagement>
+    <system>jira</system>
+    <url>http://jira.codehaus.org/browse/SUREFIRE</url>
+  </issueManagement>
+  <ciManagement>
+    <system>continuum</system>
+    <url></url>
+    <notifiers>
+      <notifier>
+        <type>email</type>
+        <address>dev@surefire.codehaus.org</address>
+      </notifier>
+    </notifiers>
+  </ciManagement>
+  <inceptionYear>2004</inceptionYear>
+  <mailingLists>
+    <mailingList>
+      <name>Surefire User List</name>
+      <subscribe>user-subscribe@surefire.codehaus.org</subscribe>
+      <unsubscribe>user-unsubscribe@surefire.codehaus.org</unsubscribe>
+      <archive>http://archive.surefire.codehaus.org/user/</archive>
+    </mailingList>
+    <mailingList>
+      <name>Surefire Developer List</name>
+      <subscribe>dev-subscribe@surefire.codehaus.org</subscribe>
+      <unsubscribe>dev-unsubscribe@surefire.codehaus.org</unsubscribe>
+      <archive>http://archive.surefire.codehaus.org/dev/</archive>
+    </mailingList>
+  </mailingLists>
+  <developers>
+    <developer>
+      <id>jvanzyl</id>
+      <name>Jason van Zyl</name>
+      <email>jason@zenplex.com</email>
+      <organization>Zenplex</organization>
+      <roles>
+        <role>Developer</role>
+      </roles>
+    </developer>
+    <developer>
+      <id>evenisse</id>
+      <name>Emmanuel Venisse</name>
+      <email>evenisse@codehaus.org</email>
+      <organization>Codehaus</organization>
+      <roles>
+        <role>Developer</role>
+      </roles>
+    </developer>
+  </developers>
+  <scm>
+    <connection>scm:cvs:pserver:anoncvs@cvs.surefire.codehaus.org:/scm/surefire:surefire</connection>
+    <developerConnection>scm:cvs:ext:${maven.username}@cvs.surefire.codehaus.org:/scm/surefire:surefire</developerConnection>
+    <url>http://cvs.surefire.codehaus.org/surefire/</url>
+  </scm>
+  <organization>
+    <name>Codehaus</name>
+    <url>http://www.codehaus.org/</url>
+  </organization>
+  <distributionManagement>
+    <repository>
+      <id>repo1</id>
+      <name>Maven Central Repository</name>
+      <url>scp://repo1.maven.org/home/projects/maven/repository-staging/to-ibiblio/maven2</url>
+    </repository>
+    <site>
+      <id>surefire</id>
+      <name>Surefire Site at Codehaus</name>
+      <url>scp://beaver.codehaus.org//home/projects/surefire/public_html</url>
+    </site>
+  </distributionManagement>
+  <modules>
+    <module>surefire</module>
+    <module>surefire-booter</module>
+  </modules>
+  <build>
+    <sourceDirectory>src/main</sourceDirectory>
+    <testSourceDirectory>src/test</testSourceDirectory>
+  </build>
+</project>

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-providers/maven-scm-provider-cvs/src/test/resources/checkoutdir/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/SvnScmProvider.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/SvnScmProvider.java?rev=209102&r1=209101&r2=209102&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/SvnScmProvider.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/SvnScmProvider.java
Mon Jul  4 10:30:26 2005
@@ -19,8 +19,14 @@
 import org.apache.maven.scm.provider.AbstractScmProvider;
 import org.apache.maven.scm.provider.ScmProviderRepository;
 import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
+import org.apache.maven.scm.provider.svn.util.EntriesReader;
+import org.apache.maven.scm.provider.svn.util.Entry;
 import org.apache.maven.scm.repository.ScmRepositoryException;
+import org.apache.maven.scm.repository.UnknownRepositoryStructure;
 
+import java.io.File;
+import java.io.FileReader;
+import java.util.Iterator;
 import java.util.Map;
 import java.util.List;
 import java.util.ArrayList;
@@ -61,6 +67,58 @@
         }
 
         return result.repository;
+    }
+
+    /**
+     * @see org.apache.maven.scm.provider.AbstractScmProvider#makeProviderScmRepository(java.io.File)
+     */
+    public ScmProviderRepository makeProviderScmRepository( File path )
+        throws ScmRepositoryException, UnknownRepositoryStructure
+    {
+        if ( path == null || !path.isDirectory() )
+        {
+            throw new ScmRepositoryException( path.getAbsolutePath() + " isn't a valid directory."
);
+        }
+
+        File svnDirectory = new File( path, ".svn" );
+
+        if ( !svnDirectory.exists() )
+        {
+            throw new ScmRepositoryException( path.getAbsolutePath() + " isn't a svn checkout
directory." );
+        }
+
+        File svnEntriesFile = new File( svnDirectory, "entries" );
+
+        String svnUrl = null;
+
+        try
+        {
+            FileReader reader = new FileReader( svnEntriesFile );
+
+            EntriesReader entriesReader = new EntriesReader();
+
+            List entries = entriesReader.read( reader );
+            
+            for ( Iterator i = entries.iterator(); i.hasNext(); )
+            {
+                Entry svnEntry = (Entry) i.next();
+
+                if ( "".equals( svnEntry.getName() ) )
+                {
+                    svnUrl = svnEntry.getUrl();
+                }
+            }
+        }
+        catch( Exception e )
+        {
+            ScmRepositoryException ex = new ScmRepositoryException( "Can't read " + svnEntriesFile.getAbsolutePath()
);
+
+            ex.setStackTrace( e.getStackTrace() );
+
+            throw ex;
+        }
+
+        return makeProviderScmRepository( svnUrl, ':' );
     }
 
     public List validateScmUrl( String scmSpecificUrl, char delimiter )

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/util/EntriesReader.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/util/EntriesReader.java?rev=209102&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/util/EntriesReader.java
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/util/EntriesReader.java
Mon Jul  4 10:30:26 2005
@@ -0,0 +1,77 @@
+package org.apache.maven.scm.provider.svn.util;
+
+import org.codehaus.plexus.util.xml.pull.MXParser;
+import org.codehaus.plexus.util.xml.pull.XmlPullParser;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.List;
+
+public class EntriesReader
+{
+    public List read( Reader reader )
+        throws IOException, XmlPullParserException
+    {
+        XmlPullParser parser = new MXParser();
+
+        parser.setInput( reader );
+
+        List entries = new ArrayList();
+
+        int eventType = parser.getEventType();
+
+        while ( eventType != XmlPullParser.END_DOCUMENT )
+        {
+            if ( eventType == XmlPullParser.START_TAG )
+            {
+                while ( parser.nextTag() == XmlPullParser.START_TAG )
+                {
+                    if ( parser.getName().equals( "entry" ) )
+                    {
+                        entries.add( parseEntry( "entry", parser ) );
+                    }
+                    else
+                    {
+                        parser.nextText();
+                    }
+                }
+            }
+            eventType = parser.next();
+        }
+
+        return entries;
+    }
+
+    private Entry parseEntry( String tagName, XmlPullParser parser )
+        throws IOException, XmlPullParserException
+    {
+        Entry entry = new Entry();
+
+
+        entry.setName( getTrimmedValue( parser.getAttributeValue( "", "name" ) ) );
+
+        entry.setUrl( getTrimmedValue( parser.getAttributeValue( "", "url" ) ) );
+
+        return entry;
+    }
+
+    public int getIntegerValue( String s )
+    {
+        if ( s != null )
+        {
+            return Integer.valueOf( s ).intValue();
+        }
+        return 0;
+    }
+
+    public String getTrimmedValue( String s )
+    {
+        if ( s != null )
+        {
+            s = s.trim();
+        }
+        return s;
+    }
+}

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

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

Added: maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/util/Entry.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/util/Entry.java?rev=209102&view=auto
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/util/Entry.java
(added)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/util/Entry.java
Mon Jul  4 10:30:26 2005
@@ -0,0 +1,283 @@
+/*
+ * $Id$
+ */
+
+package org.apache.maven.scm.provider.svn.util;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import java.util.*;
+
+/**
+ * Class Entry.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class Entry implements java.io.Serializable {
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Field committedRevision
+     */
+    private int committedRevision = 0;
+
+    /**
+     * Field name
+     */
+    private String name;
+
+    /**
+     * Field committedDate
+     */
+    private String committedDate;
+
+    /**
+     * Field url
+     */
+    private String url;
+
+    /**
+     * Field lastAuthor
+     */
+    private String lastAuthor;
+
+    /**
+     * Field kind
+     */
+    private String kind;
+
+    /**
+     * Field uuid
+     */
+    private String uuid;
+
+    /**
+     * Field propertyTime
+     */
+    private String propertyTime;
+
+    /**
+     * Field revision
+     */
+    private int revision = 0;
+
+    /**
+     * Field textTime
+     */
+    private String textTime;
+
+    /**
+     * Field checksum
+     */
+    private String checksum;
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method getChecksum
+     */
+    public String getChecksum()
+    {
+        return this.checksum;
+    } //-- String getChecksum() 
+
+    /**
+     * Method getCommittedDate
+     */
+    public String getCommittedDate()
+    {
+        return this.committedDate;
+    } //-- String getCommittedDate() 
+
+    /**
+     * Method getCommittedRevision
+     */
+    public int getCommittedRevision()
+    {
+        return this.committedRevision;
+    } //-- int getCommittedRevision() 
+
+    /**
+     * Method getKind
+     */
+    public String getKind()
+    {
+        return this.kind;
+    } //-- String getKind() 
+
+    /**
+     * Method getLastAuthor
+     */
+    public String getLastAuthor()
+    {
+        return this.lastAuthor;
+    } //-- String getLastAuthor() 
+
+    /**
+     * Method getName
+     */
+    public String getName()
+    {
+        return this.name;
+    } //-- String getName() 
+
+    /**
+     * Method getPropertyTime
+     */
+    public String getPropertyTime()
+    {
+        return this.propertyTime;
+    } //-- String getPropertyTime() 
+
+    /**
+     * Method getRevision
+     */
+    public int getRevision()
+    {
+        return this.revision;
+    } //-- int getRevision() 
+
+    /**
+     * Method getTextTime
+     */
+    public String getTextTime()
+    {
+        return this.textTime;
+    } //-- String getTextTime() 
+
+    /**
+     * Method getUrl
+     */
+    public String getUrl()
+    {
+        return this.url;
+    } //-- String getUrl() 
+
+    /**
+     * Method getUuid
+     */
+    public String getUuid()
+    {
+        return this.uuid;
+    } //-- String getUuid() 
+
+    /**
+     * Method setChecksum
+     * 
+     * @param checksum
+     */
+    public void setChecksum(String checksum)
+    {
+        this.checksum = checksum;
+    } //-- void setChecksum(String) 
+
+    /**
+     * Method setCommittedDate
+     * 
+     * @param committedDate
+     */
+    public void setCommittedDate(String committedDate)
+    {
+        this.committedDate = committedDate;
+    } //-- void setCommittedDate(String) 
+
+    /**
+     * Method setCommittedRevision
+     * 
+     * @param committedRevision
+     */
+    public void setCommittedRevision(int committedRevision)
+    {
+        this.committedRevision = committedRevision;
+    } //-- void setCommittedRevision(int) 
+
+    /**
+     * Method setKind
+     * 
+     * @param kind
+     */
+    public void setKind(String kind)
+    {
+        this.kind = kind;
+    } //-- void setKind(String) 
+
+    /**
+     * Method setLastAuthor
+     * 
+     * @param lastAuthor
+     */
+    public void setLastAuthor(String lastAuthor)
+    {
+        this.lastAuthor = lastAuthor;
+    } //-- void setLastAuthor(String) 
+
+    /**
+     * Method setName
+     * 
+     * @param name
+     */
+    public void setName(String name)
+    {
+        this.name = name;
+    } //-- void setName(String) 
+
+    /**
+     * Method setPropertyTime
+     * 
+     * @param propertyTime
+     */
+    public void setPropertyTime(String propertyTime)
+    {
+        this.propertyTime = propertyTime;
+    } //-- void setPropertyTime(String) 
+
+    /**
+     * Method setRevision
+     * 
+     * @param revision
+     */
+    public void setRevision(int revision)
+    {
+        this.revision = revision;
+    } //-- void setRevision(int) 
+
+    /**
+     * Method setTextTime
+     * 
+     * @param textTime
+     */
+    public void setTextTime(String textTime)
+    {
+        this.textTime = textTime;
+    } //-- void setTextTime(String) 
+
+    /**
+     * Method setUrl
+     * 
+     * @param url
+     */
+    public void setUrl(String url)
+    {
+        this.url = url;
+    } //-- void setUrl(String) 
+
+    /**
+     * Method setUuid
+     * 
+     * @param uuid
+     */
+    public void setUuid(String uuid)
+    {
+        this.uuid = uuid;
+    } //-- void setUuid(String) 
+
+}

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

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

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/repository/SvnScmProviderRepositoryTest.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/repository/SvnScmProviderRepositoryTest.java?rev=209102&r1=209101&r2=209102&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/repository/SvnScmProviderRepositoryTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/repository/SvnScmProviderRepositoryTest.java
Mon Jul  4 10:30:26 2005
@@ -17,10 +17,13 @@
  */
 
 import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.provider.svn.SvnScmProvider;
 import org.apache.maven.scm.repository.ScmRepository;
 import org.apache.maven.scm.repository.ScmRepositoryException;
 import org.codehaus.plexus.scm.ScmManager;
 
+import java.io.File;
+
 /**
  * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
  * @version $Id$
@@ -98,6 +101,18 @@
         throws Exception
     {
         testIllegalUrl( "file:/tmp/svn" );
+    }
+
+    // ----------------------------------------------------------------------
+    // Testing provider from path
+    // ----------------------------------------------------------------------
+
+    public void testSvnFromPath()
+        throws Exception
+    {
+        SvnScmProvider provider = new SvnScmProvider();
+
+        SvnScmProviderRepository repo = (SvnScmProviderRepository) provider.makeProviderScmRepository(
new File( getBasedir() ) );
     }
 
     // ----------------------------------------------------------------------

Modified: maven/scm/trunk/pom.xml
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/pom.xml?rev=209102&r1=209101&r2=209102&view=diff
==============================================================================
--- maven/scm/trunk/pom.xml (original)
+++ maven/scm/trunk/pom.xml Mon Jul  4 10:30:26 2005
@@ -38,7 +38,7 @@
     <dependency>
       <groupId>plexus</groupId>
       <artifactId>plexus-utils</artifactId>
-      <version>1.0-alpha-3</version>
+      <version>1.0.1-SNAPSHOT</version>
     </dependency>
   </dependencies>
   <organization>



Mime
View raw message