maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject cvs commit: maven-scm/maven-scm-api/src/main/java/org/apache/maven/scm/provider AbstractScmProvider.java ScmProvider.java
Date Thu, 28 Oct 2004 23:26:48 GMT
evenisse    2004/10/28 16:26:48

  Modified:    maven-scm-api/src/main/java/org/apache/maven/scm
                        ScmTestCase.java
               maven-scm-api/src/main/java/org/apache/maven/scm/manager
                        DefaultScmManager.java
               maven-scm-api/src/main/java/org/apache/maven/scm/provider
                        AbstractScmProvider.java ScmProvider.java
  Log:
  Add delimiter for scm string.
  
  Revision  Changes    Path
  1.3       +12 -1     maven-scm/maven-scm-api/src/main/java/org/apache/maven/scm/ScmTestCase.java
  
  Index: ScmTestCase.java
  ===================================================================
  RCS file: /home/cvs/maven-scm/maven-scm-api/src/main/java/org/apache/maven/scm/ScmTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ScmTestCase.java	26 Oct 2004 12:37:05 -0000	1.2
  +++ ScmTestCase.java	28 Oct 2004 23:26:47 -0000	1.3
  @@ -25,6 +25,7 @@
   
   import org.codehaus.plexus.PlexusTestCase;
   import org.codehaus.plexus.util.FileUtils;
  +import org.codehaus.plexus.util.StringUtils;
   import org.codehaus.plexus.util.cli.CommandLineUtils;
   import org.codehaus.plexus.util.cli.Commandline;
   import org.codehaus.plexus.util.cli.CommandLineUtils.StringStreamConsumer;
  @@ -131,5 +132,15 @@
           {
               fail( "Exit value wasn't 0, was:" + exitValue );
           }
  +    }
  +
  +    // ----------------------------------------------------------------------
  +    // Assertions
  +    // ----------------------------------------------------------------------
  +
  +    protected void assertPath( String expectedPath, String actualPath )
  +    	throws Exception
  +    {
  +        assertEquals( StringUtils.replace( expectedPath, "\\", "/" ), StringUtils.replace(
expectedPath, "\\", "/" ) );
       }
   }
  
  
  
  1.3       +20 -9     maven-scm/maven-scm-api/src/main/java/org/apache/maven/scm/manager/DefaultScmManager.java
  
  Index: DefaultScmManager.java
  ===================================================================
  RCS file: /home/cvs/maven-scm/maven-scm-api/src/main/java/org/apache/maven/scm/manager/DefaultScmManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultScmManager.java	26 Oct 2004 12:37:06 -0000	1.2
  +++ DefaultScmManager.java	28 Oct 2004 23:26:48 -0000	1.3
  @@ -19,6 +19,7 @@
   import java.io.File;
   import java.util.Date;
   import java.util.HashMap;
  +import java.util.Iterator;
   import java.util.Map;
   
   import org.apache.maven.scm.CommandNameConstants;
  @@ -30,6 +31,7 @@
   import org.apache.maven.scm.command.checkin.CheckInScmResult;
   import org.apache.maven.scm.command.checkout.CheckOutScmResult;
   import org.apache.maven.scm.command.update.UpdateScmResult;
  +import org.apache.maven.scm.provider.AbstractScmProvider;
   import org.apache.maven.scm.provider.ScmProvider;
   import org.apache.maven.scm.provider.ScmProviderRepository;
   import org.apache.maven.scm.repository.ScmRepository;
  @@ -92,22 +94,31 @@
               throw new ScmRepositoryException( "The scm url must be on the form 'scm:<scm
provider>:'." );
           }
   
  -//        char delimiter = scmUrl.charAt( 3 );
  +        String scmUrlTmp = scmUrl.substring( 4 );
   
  -//        repository.setDelimiter( delimiter );
  +        String providerType = null;
   
  -        int index = scmUrl.indexOf( ":", 4 );
  +        String delimiter = null;
   
  -        if ( index <= 0 )
  +        for ( Iterator iter = scmProviders.values().iterator(); iter.hasNext(); )
           {
  -            throw new ScmRepositoryException( "The scm url must be on the form 'scm:<scm
provider>:'." );
  +            String providerName = ( (AbstractScmProvider) iter.next() ).getScmType();
  +
  +            if ( scmUrlTmp.startsWith( providerName ) )
  +            {
  +                providerType = providerName;
  +
  +                delimiter = scmUrlTmp.substring( providerName.length(), providerName.length()
+ 1 );
  +
  +                break;
  +            }
           }
   
  -        String providerType = scmUrl.substring( 4, index );
  +        ScmProvider provider = getScmProvider( providerType );
   
  -        String scmSpecificUrl = scmUrl.substring( index + 1 );
  +        String scmSpecificUrl = scmUrl.substring( providerType.length() + 5 );
   
  -        ScmProviderRepository providerRepository = getScmProvider( providerType ).makeProviderScmRepository(
scmSpecificUrl );
  +        ScmProviderRepository providerRepository = provider.makeProviderScmRepository(
scmSpecificUrl, delimiter );
   
           return new ScmRepository( providerType, scmSpecificUrl, providerRepository );
   	}
  
  
  
  1.3       +1 -3      maven-scm/maven-scm-api/src/main/java/org/apache/maven/scm/provider/AbstractScmProvider.java
  
  Index: AbstractScmProvider.java
  ===================================================================
  RCS file: /home/cvs/maven-scm/maven-scm-api/src/main/java/org/apache/maven/scm/provider/AbstractScmProvider.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractScmProvider.java	26 Oct 2004 12:37:06 -0000	1.2
  +++ AbstractScmProvider.java	28 Oct 2004 23:26:48 -0000	1.3
  @@ -42,8 +42,6 @@
   
       protected abstract Map getCommands();
   
  -    protected abstract String getScmType();
  -
       // ----------------------------------------------------------------------
       // Component Implementation
       // ----------------------------------------------------------------------
  
  
  
  1.3       +4 -2      maven-scm/maven-scm-api/src/main/java/org/apache/maven/scm/provider/ScmProvider.java
  
  Index: ScmProvider.java
  ===================================================================
  RCS file: /home/cvs/maven-scm/maven-scm-api/src/main/java/org/apache/maven/scm/provider/ScmProvider.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ScmProvider.java	26 Oct 2004 12:37:06 -0000	1.2
  +++ ScmProvider.java	28 Oct 2004 23:26:48 -0000	1.3
  @@ -31,7 +31,9 @@
   {
       String ROLE = ScmProvider.class.getName();
   
  -    ScmProviderRepository makeProviderScmRepository( String scmSpecificUrl )
  +    String getScmType();
  +
  +    ScmProviderRepository makeProviderScmRepository( String scmSpecificUrl, String delimiter
)
       	throws ScmRepositoryException;
   
       ScmResult execute( String commandName, ScmProviderRepository repository, File workingDirectory,
CommandParameters parameters )
  
  
  

Mime
View raw message