src/main/java/org/apache/maven/scm/provider/svn/svnjava/command/changelog/SvnJavaChangeLogCommand.java
public class SvnJavaChangeLogCommand
    extends AbstractChangeLogCommand
    implements SvnCommand
{
    /**
     * {@inheritDoc}
     */
    protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repository, ScmFileSet fileSet,
                                                          ScmVersion startVersion, ScmVersion endVersion,
                                                          String datePattern )
        throws ScmException
    {
        throw new UnsupportedOperationException( "executeChangeLogCommand( ScmProviderRepository repository, "
                                                     + "ScmFileSet fileSet, ScmVersion startVersion, ScmVersion endVersion, String datePattern ) is not "
                                                     + "implemented" );
    }

    /**
     * {@inheritDoc}
     */
    protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repo, ScmFileSet fileSet,
                                                          Date startDate, Date endDate, ScmBranch branch,
                                                          String datePattern )
        throws ScmException
    {
        SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repo;

        SVNRevision startRevision = ( startDate != null ) ? SVNRevision.create( startDate ) : SVNRevision.UNDEFINED;
        SVNRevision endRevision = ( endDate != null ) ? SVNRevision.create( endDate ) : SVNRevision.HEAD;

        try
        {
            SVNURL url = javaRepo.getSvnUrl();

            if ( branch != null )
            {
                url = SVNURL.parseURIEncoded( SvnTagBranchUtils.resolveBranchUrl( javaRepo, branch ) );
            }

            ChangeLogHandler handler = new ChangeLogHandler( startDate, endDate );

            SvnJavaUtil.changelog( javaRepo.getClientManager(), url, startRevision, endRevision, true, // stopOnCopy
                                   true, // reportPaths
                                   handler );

            return new ChangeLogScmResult( SvnJavaScmProvider.COMMAND_LINE, handler.getChangeSets() );
        }
        catch ( SVNException e )
        {
            return new ChangeLogScmResult( SvnJavaScmProvider.COMMAND_LINE, "SVN Changelog failed.", e.getMessage(),
                                           false );
        }
    }

    // ----------------------------------------------------------------------
    //
    // ----------------------------------------------------------------------

    protected static class ChangeLogHandler
        implements ISVNLogEntryHandler
    {
        private ChangeLogSet changeLogSet;

        private List<ChangeSet> changeSets = new ArrayList<ChangeSet>();

        public ChangeLogHandler( Date startDate, Date endDate )
        {
            changeLogSet = new ChangeLogSet( startDate, endDate );
        }

        public void handleLogEntry( SVNLogEntry logEntry )
            throws SVNException
        {
            List<ChangeFile> changedFiles = new ArrayList<ChangeFile>();

            for ( String changedPath : logEntry.getChangedPaths().keySet() )
            {
                changedFiles.add( new ChangeFile( changedPath, Long.toString( logEntry.getRevision() ) ) );
            }

            SvnChangeSet changeSet =
                new SvnChangeSet( logEntry.getDate(), logEntry.getMessage(), logEntry.getAuthor(), changedFiles );
            changeSet.setRevision( Long.toString( logEntry.getRevision() ) );
            changeSets.add( changeSet );
        }

        public ChangeLogSet getChangeSets()
        {
            changeLogSet.setChangeSets( changeSets );

            return changeLogSet;
        }
    }
}
src/main/java/org/apache/maven/scm/provider/svn/svnjava/command/checkin/SvnJavaCheckInCommand.java
public class SvnJavaCheckInCommand
    extends AbstractCheckInCommand
    implements SvnCommand
{
    /**
     * {@inheritDoc}
     */
    protected CheckInScmResult executeCheckInCommand( ScmProviderRepository repo, ScmFileSet fileSet, String message,
                                                      ScmVersion tag )
        throws ScmException
    {
        if ( getLogger().isInfoEnabled() )
        {
            getLogger().info( "SVN commit directory: " + fileSet.getBasedir().getAbsolutePath() );
        }

        SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repo;

        CommitHandler handler = new CommitHandler( fileSet.getBasedir().getAbsolutePath() );

        SVNCommitClient svnCommitClient = javaRepo.getClientManager().getCommitClient();

        svnCommitClient.setCommitHandler( handler );

        try
        {
            List<File> tmpPaths = fileSet.getFileList();
            List<File> paths;
            if ( tmpPaths == null || tmpPaths.isEmpty() )
            {
                paths = new ArrayList<File>( 1 );
                paths.add( fileSet.getBasedir() );
            }
            else
            {
                paths = new ArrayList<File>( tmpPaths.size() );
                for ( File f : tmpPaths )
                {
                    if ( f.isAbsolute() )
                    {
                        paths.add( f );
                    }
                    else
                    {
                        paths.add( new File( fileSet.getBasedir(), f.toString() ) );
                    }
                }
            }

            SVNCommitInfo svnCommitInfo =
                SvnJavaUtil.commit( svnCommitClient, paths.toArray( new File[paths.size()] ), false, message, true );

            List<ScmFile> files = new ArrayList<ScmFile>();
            for ( String filePath : handler.getFiles() )
            {
                files.add( new ScmFile( filePath, ScmFileStatus.CHECKED_IN ) );
            }

            return new CheckInScmResult( SvnJavaScmProvider.COMMAND_LINE, files,
                                         Long.toString( svnCommitInfo.getNewRevision() ) );
        }
        catch ( SVNException e )
        {
            return new CheckInScmResult( SvnJavaScmProvider.COMMAND_LINE, "SVN commit failed.", e.getMessage(), false );
        }
        finally
        {
            javaRepo.getClientManager().getCommitClient().setEventHandler( null );
        }
    }

    public static class CommitHandler
        implements ISVNCommitHandler
    {
        private List<String> files = new ArrayList<String>();

        private String baseDirectory;

        public CommitHandler( String baseDirectory )
        {
            this.baseDirectory = FilenameUtils.separatorsToUnix( baseDirectory );
            if ( !StringUtils.endsWith( this.baseDirectory, "/" ) )
            {
                this.baseDirectory += "/";
            }
        }

        public String getCommitMessage( String message, SVNCommitItem[] commitItems )
            throws SVNException
        {
            if ( commitItems != null )
            {

                {
                    for ( SVNCommitItem commitItem : commitItems )
                    {
                        if ( commitItem.getFile().isFile() )
                        {
                            String path =
                                StringUtils.removeStartIgnoreCase( commitItem.getFile().getPath(), baseDirectory );

                            files.add( path );
                        }
                    }
                }
            }
            return message;
        }

        public SVNProperties getRevisionProperties( String arg0, SVNCommitItem[] arg1, SVNProperties svnProperties )
            throws SVNException
        {
            return svnProperties;
        }

        public List<String> getFiles()
        {
            return files;
        }

    }
}
src/main/java/org/apache/maven/scm/provider/svn/svnjava/command/remoteinfo/SvnJavaRemoteInfoCommand.java
public class SvnJavaRemoteInfoCommand
    extends AbstractRemoteInfoCommand
    implements SvnCommand
{
    @Override
    public RemoteInfoScmResult executeRemoteInfoCommand( ScmProviderRepository repository, ScmFileSet fileSet,
                                                         CommandParameters parameters )
        throws ScmException
    {
        SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repository;

        String url = ( (SvnScmProviderRepository) repository ).getUrl();
        // use a default svn layout, url is here http://svn.apache.org/repos/asf/maven/maven-3/trunk
        // so as we presume we have good users using standard svn layout, we calculate tags and branches url
        String baseUrl = StringUtils.endsWith( url, "/" )
            ? StringUtils.substringAfter( StringUtils.removeEnd( url, "/" ), "/" )
            : StringUtils.substringBeforeLast( url, "/" );

        RemoteInfoScmResult remoteInfoScmResult = new RemoteInfoScmResult( null, null, null, true );

        try
        {

            DirEntryHandler dirEntryHandler = new DirEntryHandler( baseUrl );
            javaRepo.getClientManager().getLogClient().doList( SVNURL.parseURIEncoded( baseUrl + "/tags" ),
                                                               SVNRevision.HEAD, SVNRevision.HEAD, false, false,
                                                               dirEntryHandler );
            remoteInfoScmResult.setTags( dirEntryHandler.infos );
        }
        catch ( SVNException e )
        {
            return new RemoteInfoScmResult( null, e.getMessage(), null, false );
        }

        try
        {

            DirEntryHandler dirEntryHandler = new DirEntryHandler( baseUrl );
            javaRepo.getClientManager().getLogClient().doList( SVNURL.parseURIEncoded( baseUrl + "/branches" ),
                                                               SVNRevision.HEAD, SVNRevision.HEAD, false, false,
                                                               dirEntryHandler );
            remoteInfoScmResult.setBranches( dirEntryHandler.infos );
        }
        catch ( SVNException e )
        {
            return new RemoteInfoScmResult( null, e.getMessage(), null, false );
        }

        return remoteInfoScmResult;

    }

    public boolean remoteUrlExist( ScmProviderRepository repository, CommandParameters parameters )
        throws ScmException
    {
        SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repository;

        String url = ( (SvnScmProviderRepository) repository ).getUrl();

        try
        {

            javaRepo.getClientManager().getWCClient().doInfo( SVNURL.parseURIEncoded( url ), SVNRevision.HEAD,
                                                              SVNRevision.HEAD, SVNDepth.EMPTY, new ISVNInfoHandler()
            {
                public void handleInfo( SVNInfo svnInfo )
                    throws SVNException
                {
                    svnInfo.getAuthor();
                }
            } );
        }
        catch ( SVNException e )
        {
            if ( e.getMessage().indexOf( "E170000" ) > -1 )
            {
                return false;
            }
            throw new ScmException( e.getMessage(), e );
        }
        return true;
    }

    public static class DirEntryHandler
        implements ISVNDirEntryHandler
    {
        String url;

        Map<String, String> infos = new HashMap<String, String>();

        DirEntryHandler( String url )
        {
            this.url = url;
        }

        public void handleDirEntry( SVNDirEntry svnDirEntry )
            throws SVNException
        {
            infos.put( svnDirEntry.getName(), svnDirEntry.getURL().toString() );
        }
    }
}
src/main/java/org/apache/maven/scm/provider/svn/svnjava/command/export/SvnJavaExportCommand.java
public class SvnJavaExportCommand
    extends AbstractExportCommand
    implements SvnCommand
{

    /**
     * @see org.apache.maven.scm.command.export.AbstractExportCommand#executeExportCommand(org.apache.maven.scm.provider.ScmProviderRepository, org.apache.maven.scm.ScmFileSet, org.apache.maven.scm.ScmVersion, java.lang.String)
     */
    protected ExportScmResult executeExportCommand( ScmProviderRepository repo, ScmFileSet fileSet, ScmVersion version,
                                                    String outputDirectory )
        throws ScmException
    {
        SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repo;

        ScmFileEventHandler handler = new ScmFileEventHandler( getLogger(), fileSet.getBasedir() );

        javaRepo.getClientManager().getUpdateClient().setEventHandler( handler );
        String url = javaRepo.getUrl();

        if ( version != null && StringUtils.isNotEmpty( version.getName() ) )
        {
            if ( version instanceof ScmTag )
            {
                url = SvnTagBranchUtils.resolveTagUrl( javaRepo, (ScmTag) version );
            }
            else if ( version instanceof ScmBranch )
            {
                url = SvnTagBranchUtils.resolveBranchUrl( javaRepo, (ScmBranch) version );
            }
        }

        url = SvnCommandUtils.fixUrl( url, javaRepo.getUser() );
        try
        {
            SvnJavaUtil.export( javaRepo.getClientManager(), SVNURL.parseURIEncoded( url ), SVNRevision.HEAD,
                                fileSet.getBasedir(), true );

            return new ExportScmResult( SvnJavaScmProvider.COMMAND_LINE, handler.getFiles() );
        }
        catch ( SVNException e )
        {
            return new ExportScmResult( SvnJavaScmProvider.COMMAND_LINE, "SVN checkout failed.", e.getMessage(),
                                        false );
        }
        finally
        {
            javaRepo.getClientManager().getUpdateClient().setEventHandler( null );
        }

    }

}
src/main/java/org/apache/maven/scm/provider/svn/svnjava/command/remove/SvnJavaRemoveCommand.java
public class SvnJavaRemoveCommand
    extends AbstractRemoveCommand
    implements SvnCommand
{
    /**
     * {@inheritDoc}
     */
    protected ScmResult executeRemoveCommand( ScmProviderRepository repo, ScmFileSet fileSet, String message )
        throws ScmException
    {
        if ( fileSet.getFileList().isEmpty() )
        {
            throw new ScmException( "You must provide at least one file/directory to remove" );
        }

        if ( getLogger().isInfoEnabled() )
        {
            getLogger().info( "SVN remove working directory: " + fileSet.getBasedir().getAbsolutePath() );
        }

        SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repo;

        ScmFileEventHandler handler = new ScmFileEventHandler( getLogger(), fileSet.getBasedir() );

        javaRepo.getClientManager().getWCClient().setEventHandler( handler );

        try
        {
            SvnJavaUtil.delete( javaRepo.getClientManager(), fileSet, true );

            return new RemoveScmResult( SvnJavaScmProvider.COMMAND_LINE, handler.getFiles() );
        }
        catch ( SVNException e )
        {
            return new RemoveScmResult( SvnJavaScmProvider.COMMAND_LINE, "SVN remove failed.", e.getMessage(), false );
        }
        finally
        {
            javaRepo.getClientManager().getWCClient().setEventHandler( null );
        }
    }
}
src/main/java/org/apache/maven/scm/provider/svn/svnjava/command/add/SvnJavaAddCommand.java
public class SvnJavaAddCommand
    extends AbstractAddCommand
    implements SvnCommand
{

    @Override
    protected ScmResult executeCommand( ScmProviderRepository repository, ScmFileSet fileSet,
                                        CommandParameters parameters )
        throws ScmException
    {
        if ( fileSet.getFileList().isEmpty() )
        {
            throw new ScmException( "You must provide at least one file/directory to add" );
        }

        final List<ScmFile> filesAdded = new ArrayList<ScmFile>();

        SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repository;

        SVNClientManager clientManager = javaRepo.getClientManager();

        try
        {
            clientManager.getWCClient().setEventHandler( new ISVNEventHandler()
            {

                public void handleEvent( SVNEvent event, double progress )
                {
                    if ( event.getAction() == SVNEventAction.ADD )
                    {
                        filesAdded.add( new ScmFile( event.getFile().getPath(), ScmFileStatus.ADDED ) );
                    }
                }

                public void checkCancelled()
                    throws SVNCancelException
                {
                    // null
                }
            } );

            for ( File file : fileSet.getFileList() )
            {
                File fileToAdd = new File( fileSet.getBasedir(), file.toString() );

                if ( getLogger().isDebugEnabled() )
                {
                    getLogger().debug( "SVN adding file: " + fileToAdd.getAbsolutePath() );
                }

                boolean forceAdd = parameters.getBoolean( CommandParameter.FORCE_ADD, false );
                SvnJavaUtil.add( clientManager, fileToAdd, false, forceAdd );
            }
        }
        catch ( SVNException e )
        {
            return new AddScmResult( SvnJavaScmProvider.COMMAND_LINE, "The svn operation failed.", e.getMessage(),
                                     false );
        }
        finally
        {
            clientManager.getWCClient().setEventHandler( null );
        }

        return new AddScmResult( null, filesAdded );
    }

    /**
     * {@inheritDoc}
     */
    protected ScmResult executeAddCommand( ScmProviderRepository repository, ScmFileSet fileSet, String message,
                                           boolean binary )
        throws ScmException
    {
        CommandParameters commandParameters = new CommandParameters();
        commandParameters.setString( CommandParameter.MESSAGE, message );
        return executeCommand( repository, fileSet, commandParameters );
    }
}
src/main/java/org/apache/maven/scm/provider/svn/svnjava/command/list/SvnJavaListCommand.java
public class SvnJavaListCommand
    extends AbstractListCommand
    implements SvnCommand
{

    @Override
    public ScmResult executeCommand( ScmProviderRepository repository, ScmFileSet fileSet,
                                     CommandParameters parameters )
        throws ScmException
    {
        boolean recursive = parameters == null ? false : parameters.getBoolean( CommandParameter.RECURSIVE );
        ScmVersion scmVersion =
            parameters == null ? null : parameters.getScmVersion( CommandParameter.SCM_VERSION, null );
        return executeListCommand( repository, fileSet, recursive, scmVersion );
    }

    @Override
    protected ListScmResult executeListCommand( ScmProviderRepository scmProviderRepository, ScmFileSet scmFileSet,
                                                boolean recursive, ScmVersion version )
        throws ScmException
    {
        SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) scmProviderRepository;

        String url = javaRepo.getUrl();

        SVNRevision revision = SVNRevision.HEAD;

        if ( version != null && StringUtils.isNotEmpty( version.getName() ) )
        {
            if ( version instanceof ScmTag )
            {
                url = SvnTagBranchUtils.resolveTagUrl( javaRepo, (ScmTag) version );
            }
            else if ( version instanceof ScmBranch )
            {
                url = SvnTagBranchUtils.resolveBranchUrl( javaRepo, (ScmBranch) version );
            }
            else if ( version instanceof ScmRevision )
            {
                try
                {
                    revision = SVNRevision.create( Long.parseLong( ( (ScmRevision) version ).getName() ) );
                }
                catch ( NumberFormatException exc )
                {
                    return new ListScmResult( SvnJavaScmProvider.COMMAND_LINE,
                                              "SVN checkout failed. Wrong format of revision number.", null, false );
                }
            }
        }

        if ( url != null )
        {
            url = SvnCommandUtils.fixUrl( url, javaRepo.getUser() );
        }
        ListEntryHandler listEntryHandler = new ListEntryHandler();

        /*
        SVNURL url,
        SVNRevision pegRevision,
        SVNRevision revision,
        boolean fetchLocks,
        SVNDepth depth,
        int entryFields,
        ISVNDirEntryHandler handler
        */

        try
        {
            javaRepo.getClientManager().getLogClient().doList(
                url == null ? javaRepo.getSvnUrl() : SVNURL.parseURIEncoded( url ), revision, revision, true,
                // boolean fetchLocks,
                SVNDepth.IMMEDIATES, 0, listEntryHandler );
        }
        catch ( SVNException e )
        {
            throw new ScmException( "Error while executing svn list.", e );
        }

        List<ScmFile> scmFiles = new ArrayList<ScmFile>( listEntryHandler.relativePaths.size() );

        for ( String path : listEntryHandler.relativePaths )
        {
            scmFiles.add( new ScmFile( path, ScmFileStatus.CHECKED_IN ) );
        }

        ListScmResult listScmResult = new ListScmResult( scmFiles, new ScmResult( null, null, null, false ) );
        return listScmResult;

    }

    private static class ListEntryHandler
        implements ISVNDirEntryHandler
    {
        private List<String> relativePaths = new ArrayList<String>();

        public void handleDirEntry( SVNDirEntry svnDirEntry )
            throws SVNException
        {
            if ( StringUtils.isNotEmpty( svnDirEntry.getRelativePath() ) )
            {
                relativePaths.add( svnDirEntry.getRelativePath() );
            }
        }
    }
}
src/main/java/org/apache/maven/scm/provider/svn/svnjava/command/diff/SvnJavaDiffCommand.java
public class SvnJavaDiffCommand
    extends AbstractDiffCommand
    implements SvnCommand
{
    /**
     * {@inheritDoc}
     */
    protected DiffScmResult executeDiffCommand( ScmProviderRepository repo, ScmFileSet fileSet,
                                                ScmVersion startRevision, ScmVersion endRevision )
        throws ScmException
    {
        if ( getLogger().isInfoEnabled() )
        {
            getLogger().info( "SVN diff directory: " + fileSet.getBasedir().getAbsolutePath() );
        }

        SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repo;

        ScmFileEventHandler handler = new ScmFileEventHandler( getLogger(), fileSet.getBasedir() );

        try
        {
            javaRepo.getClientManager().getDiffClient().setEventHandler( handler );

            SVNRevision start =
                ( startRevision == null ) ? SVNRevision.COMMITTED : SVNRevision.parse( startRevision.getName() );
            SVNRevision end =
                ( endRevision == null ) ? SVNRevision.WORKING : SVNRevision.parse( endRevision.getName() );

            ByteArrayOutputStream out =
                SvnJavaUtil.diff( javaRepo.getClientManager(), fileSet.getBasedir(), start, end );

            SvnDiffConsumer consumer = new SvnDiffConsumer( getLogger(), fileSet.getBasedir() );

            ByteArrayInputStream bis = new ByteArrayInputStream( out.toByteArray() );

            BufferedReader in = new BufferedReader( new InputStreamReader( bis ) );

            String line = in.readLine();
            while ( line != null )
            {
                consumer.consumeLine( line );

                line = in.readLine();
            }

            return new DiffScmResult( SvnJavaScmProvider.COMMAND_LINE, consumer.getChangedFiles(),
                                      consumer.getDifferences(), consumer.getPatch() );
        }
        catch ( IOException e )
        {
            return new DiffScmResult( SvnJavaScmProvider.COMMAND_LINE, "SVN diff failed.", e.getMessage(), false );
        }
        catch ( SVNException e )
        {
            return new DiffScmResult( SvnJavaScmProvider.COMMAND_LINE, "SVN diff failed.", e.getMessage(), false );
        }
        finally
        {
            javaRepo.getClientManager().getDiffClient().setEventHandler( null );
        }
    }
}
src/main/java/org/apache/maven/scm/provider/svn/svnjava/command/status/SvnJavaStatusCommand.java
public class SvnJavaStatusCommand
    extends AbstractStatusCommand
    implements SvnCommand
{
    /**
     * {@inheritDoc}
     */
    protected StatusScmResult executeStatusCommand( ScmProviderRepository repo, ScmFileSet fileSet )
        throws ScmException
    {
        if ( getLogger().isInfoEnabled() )
        {
            getLogger().info( "SVN status directory: " + fileSet.getBasedir().getAbsolutePath() );
        }

        SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repo;

        SvnStatusHandler handler = new SvnStatusHandler( fileSet.getBasedir() );

        try
        {
            SvnJavaUtil.status( javaRepo.getClientManager(), fileSet.getBasedir(), true, // isRecursive
                                true, // isRemote
                                handler );

            return new StatusScmResult( SvnJavaScmProvider.COMMAND_LINE, handler.getFiles() );
        }
        catch ( SVNException e )
        {
            return new StatusScmResult( SvnJavaScmProvider.COMMAND_LINE, "SVN status failed.", e.getMessage(), false );
        }
    }
}
src/main/java/org/apache/maven/scm/provider/svn/svnjava/command/update/SvnJavaUpdateCommand.java
public class SvnJavaUpdateCommand
    extends AbstractUpdateCommand
    implements SvnCommand
{
    /**
     * {@inheritDoc}
     */
    protected UpdateScmResult executeUpdateCommand( ScmProviderRepository repo, ScmFileSet fileSet, ScmVersion tag )
        throws ScmException
    {
        SvnScmProviderRepository repository = (SvnScmProviderRepository) repo;

        if ( getLogger().isInfoEnabled() )
        {
            getLogger().info( "SVN update directory: " + fileSet.getBasedir().getAbsolutePath() );
        }

        SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repo;

        try
        {
            ScmFileEventHandler handler = new ScmFileEventHandler( getLogger(), fileSet.getBasedir() );

            SVNUpdateClient updateClient = javaRepo.getClientManager().getUpdateClient();

            updateClient.setEventHandler( handler );

            long revision = 0;

            if ( tag == null || SvnTagBranchUtils.isRevisionSpecifier( tag ) )
            {
                SVNRevision rev = ( tag == null ? SVNRevision.parse( "" ) : SVNRevision.parse( tag.getName() ) );
                revision = SvnJavaUtil.update( updateClient, fileSet.getBasedir(), rev, true );
            }
            else
            {
                // The tag specified does not appear to be numeric, so assume it refers
                // to a branch/tag url and perform a switch operation rather than update
                revision = SvnJavaUtil.switchToURL( javaRepo.getClientManager(), fileSet.getBasedir(),
                                                    SVNURL.parseURIEncoded( SvnTagBranchUtils.resolveTagUrl( repository,
                                                                                                             new ScmTag(
                                                                                                                 tag.getName() ) ) ),
                                                    SVNRevision.HEAD, true );
            }

            return new UpdateScmResultWithRevision( SvnJavaScmProvider.COMMAND_LINE, handler.getFiles(),
                                                    Long.toString( revision ) );
        }
        catch ( SVNException e )
        {
            return new UpdateScmResultWithRevision( SvnJavaScmProvider.COMMAND_LINE, "SVN update failed.",
                                                    e.getMessage(), Long.toString( -1 ), false );
        }
        finally
        {
            javaRepo.getClientManager().getUpdateClient().setEventHandler( null );
        }
    }

    /**
     * {@inheritDoc}
     */
    protected ChangeLogCommand getChangeLogCommand()
    {
        SvnJavaChangeLogCommand command = new SvnJavaChangeLogCommand();

        command.setLogger( getLogger() );

        return command;
    }
}
src/main/java/org/apache/maven/scm/provider/svn/svnjava/command/info/SvnJavaInfoCommand.java
public class SvnJavaInfoCommand
    extends AbstractCommand
    implements SvnCommand
{
    protected ScmResult executeCommand( ScmProviderRepository repository, ScmFileSet fileSet,
                                        CommandParameters parameters )
        throws ScmException
    {
        return executeInfoCommand( repository, fileSet, parameters, false, "" );
    }

    public InfoScmResult executeInfoCommand( ScmProviderRepository repository, ScmFileSet fileSet,
                                             CommandParameters parameters, boolean recursive, String revision )
        throws ScmException
    {
        SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repository;
        List<InfoItem> infoItems = new ArrayList<InfoItem>();
        InfoScmResult svnInfoScmResult = new InfoScmResult( null, infoItems );

        @SuppressWarnings( "rawtypes" ) Iterator i = fileSet.getFileList().iterator();
        if ( i.hasNext() )
        {
            while ( i.hasNext() )
            {
                InfoItem currentItem = executeSingleInfoCommand( javaRepo, (File) ( i.next() ), revision );
                infoItems.add( currentItem );
            }
        }
        else
        {
            // no files just a base directory
            InfoItem currentItem = executeSingleInfoCommand( javaRepo, fileSet.getBasedir(), revision );
            infoItems.add( currentItem );
        }
        return svnInfoScmResult;
    }

    private InfoItem executeSingleInfoCommand( SvnJavaScmProviderRepository javaRepo, File f, String revision )
        throws ScmException
    {
        try
        {
            SVNRevision svnRev = null;
            if ( revision != null )
            {
                svnRev = SVNRevision.parse( revision );
            }

            SVNInfo svnInfo = null;
            
        	boolean isVersionedDirectory = SvnOperationFactory.isVersionedDirectory(f);
        	getLogger().debug("Get info, isVersionedDirectory: " + isVersionedDirectory );
        	
        	if (isVersionedDirectory) 
        	{
            	getLogger().info("Get info from versioned directory: " + f );
        		svnInfo = javaRepo.getClientManager().getWCClient().doInfo( f, svnRev );
        	}
        	else {
        		SVNURL svnUrl = javaRepo.getSvnUrl();
            	getLogger().info("Get info from svnUrl: " + svnUrl );
            	svnInfo = javaRepo.getClientManager().getWCClient().doInfo( svnUrl, SVNRevision.UNDEFINED, svnRev );
        	}

            InfoItem currentItem = new InfoItem();

            currentItem.setRevision(
                svnInfo.getRevision() != null ? Long.toString( svnInfo.getRevision().getNumber() ) : null );
            currentItem.setLastChangedAuthor( svnInfo.getAuthor() );
            currentItem.setLastChangedRevision( svnInfo.getCommittedRevision() != null
                                                    ? Long.toString( svnInfo.getCommittedRevision().getNumber() )
                                                    : null );
            currentItem.setLastChangedDate(
                svnInfo.getCommittedDate() != null ? svnInfo.getCommittedDate().toString() : null );

            currentItem.setURL( svnInfo.getURL() != null ? svnInfo.getURL().toString() : null );
            currentItem.setRepositoryUUID( svnInfo.getRepositoryUUID() );
            currentItem.setRepositoryRoot(
                svnInfo.getRepositoryRootURL() != null ? svnInfo.getRepositoryRootURL().toString() : null );
            currentItem.setNodeKind( svnInfo.getKind() != null ? svnInfo.getKind().toString() : null );
            return currentItem;
        }
        catch ( SVNException e )
        {
            throw new ScmException( e.getMessage(), e );
        }
    }
}
src/main/java/org/apache/maven/scm/provider/svn/svnjava/command/blame/SvnJavaBlameCommand.java
public class SvnJavaBlameCommand
    extends AbstractBlameCommand
    implements SvnCommand
{

    /**
     * @see org.apache.maven.scm.command.blame.AbstractBlameCommand#executeBlameCommand(org.apache.maven.scm.provider.ScmProviderRepository,
     *      org.apache.maven.scm.ScmFileSet, java.lang.String)
     */
    @Override
    public BlameScmResult executeBlameCommand( ScmProviderRepository repo, ScmFileSet workingDirectory,
                                               String filename )
        throws ScmException
    {
        try
        {
            SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repo;
            javaRepo.getClientManager();
            AnnotationHandler handler = new AnnotationHandler();
            SvnJavaUtil.blame( javaRepo.getClientManager(), new File( workingDirectory.getBasedir(), filename ),
                               handler );
            return new BlameScmResult( "", handler.lines );
        }
        catch ( SVNException e )
        {
            throw new ScmException( e.getMessage(), e );
        }
    }

    private static class AnnotationHandler
        implements ISVNAnnotateHandler
    {

        private List<BlameLine> lines = new ArrayList<BlameLine>();

        public void handleEOF()
        {
            // no op
        }

        /**
         * @deprecated
         */
        public void handleLine( Date arg0, long arg1, String arg2, String arg3 )
            throws SVNException
        {
            // no op
        }

        public void handleLine( Date date, long revision, String author, String line, Date mergedDate,
                                long mergedRevision, String mergedAuthor, String mergedPath, int lineNumber )
            throws SVNException
        {
            BlameLine blameLine = new BlameLine( date, Long.toString( revision ), author );
            if ( lines.size() > lineNumber )
            {
                lines.set( lineNumber, blameLine );
            }
            else
            {
                lines.add( blameLine );
            }
        }

        public boolean handleRevision( Date arg0, long arg1, String arg2, File arg3 )
            throws SVNException
        {
            return true;
        }

    }

}
src/main/java/org/apache/maven/scm/provider/svn/svnjava/repository/SvnJavaScmProviderRepository.java
public class SvnJavaScmProviderRepository
    extends SvnScmProviderRepository
{
    private SVNURL svnUrl;

    private SVNClientManager clientManager;

    public SvnJavaScmProviderRepository( SVNURL svnUrl, String strUrl )
    {
        super( strUrl, null, null );

        setUser( svnUrl.getUserInfo() );

        setPassword( null );

        this.svnUrl = svnUrl;

        if ( getUser() != null )
        {
            System.getProperties().setProperty( "javasvn.ssh2.username", getUser() );
        }
        if ( getPassword() != null )
        {
            System.getProperties().setProperty( "javasvn.ssh2.password", getPassword() );
        }

        initializeClientManager();
    }

    public SVNURL getSvnUrl()
    {
        return svnUrl;
    }

    public SVNClientManager getClientManager()
    {
        ISVNOptions options = SVNWCUtil.createDefaultOptions( true );

        String configDirectory = SvnUtil.getSettings().getConfigDirectory();

        ISVNAuthenticationManager isvnAuthenticationManager =
            SVNWCUtil.createDefaultAuthenticationManager( configDirectory == null ? null : new File( configDirectory ),
                                                          getUser(), getPassword(),
                                                          SvnUtil.getSettings().isUseAuthCache() );

        SVNClientManager svnClientManager = SVNClientManager.newInstance( options, isvnAuthenticationManager );

        return svnClientManager;

    }

    public void setPrivateKey( String privateKey )
    {
        super.setPrivateKey( privateKey );

        if ( getPrivateKey() != null )
        {
            System.getProperties().setProperty( "javasvn.ssh2.key", getPrivateKey() );
        }

        initializeClientManager();
    }

    public void setPassphrase( String passphrase )
    {
        super.setPassphrase( passphrase );

        if ( getPassphrase() != null )
        {
            System.getProperties().setProperty( "javasvn.ssh2.passphrase", getPassphrase() );
        }

        initializeClientManager();
    }

    public void setUser( String user )
    {
        super.setUser( user );

        if ( getUser() != null )
        {
            System.getProperties().setProperty( "javasvn.ssh2.username", getUser() );
        }

        initializeClientManager();
    }

    public void setPassword( String password )
    {
        super.setPassword( password );

        if ( getPassword() != null )
        {
            System.getProperties().setProperty( "javasvn.ssh2.password", getPassword() );
        }

        initializeClientManager();
    }

    private void initializeClientManager()
    {
        /*
        * Creates a default run-time configuration options driver. Default options
        * created in this way use the Subversion run-time configuration area (for
        * instance, on a Windows platform it can be found in the '%APPDATA%\Subversion'
        * directory).
        *
        * readonly = true - not to save  any configuration changes that can be done
        * during the program run to a config file (config settings will only
        * be read to initialize; to enable changes the readonly flag should be set
        * to false).
        *
        */
        ISVNOptions options = SVNWCUtil.createDefaultOptions( true );
        clientManager = SVNClientManager.newInstance( options, getAuthManager() );
    }

    private ISVNAuthenticationManager getAuthManager()
    {
        if ( getPrivateKey() != null )
        {
            SVNSSHAuthentication[] auth = new SVNSSHAuthentication[1];
            auth[0] = new SVNSSHAuthentication( getUser(), getPrivateKey().toCharArray(), getPassphrase(), -1, false );

            return new BasicAuthenticationManager( auth );
        }
        else if ( getUser() != null )
        {
            return new BasicAuthenticationManager( getUser(), getPassword() );
        }
        else
        {
            String configDirectory = SvnUtil.getSettings().getConfigDirectory();

            return SVNWCUtil.createDefaultAuthenticationManager(
                configDirectory == null ? null : new File( configDirectory ), getUser(), getPassword(),
                SvnUtil.getSettings().isUseAuthCache() );
        }
    }
}
src/main/java/org/apache/maven/scm/provider/svn/svnjava/command/branch/SvnJavaBranchCommand.java
public class SvnJavaBranchCommand
    extends AbstractBranchCommand
    implements SvnCommand
{

    /**
     * @see org.apache.maven.scm.command.branch.AbstractBranchCommand#executeBranchCommand(org.apache.maven.scm.provider.ScmProviderRepository, org.apache.maven.scm.ScmFileSet, java.lang.String, java.lang.String)
     */
    protected ScmResult executeBranchCommand( ScmProviderRepository repo, ScmFileSet fileSet, String branch,
                                              ScmBranchParameters scmBranchParameters )
        throws ScmException
    {
        if ( branch == null || StringUtils.isEmpty( branch.trim() ) )
        {
            throw new ScmException( "branch name must be specified" );
        }

        if ( !fileSet.getFileList().isEmpty() )
        {
            throw new ScmException( "This provider doesn't support branching subsets of a directory" );
        }
        SvnScmProviderRepository repository = (SvnScmProviderRepository) repo;

        SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repo;
        try
        {

            SVNURL destURL =
                SVNURL.parseURIEncoded( SvnTagBranchUtils.resolveBranchUrl( repository, new ScmBranch( branch ) ) );

            String message = "[maven-scm] copy for branch " + branch;
            if ( scmBranchParameters != null )
            {
                message = scmBranchParameters.getMessage();
            }

            SVNCommitInfo info;
            if ( scmBranchParameters != null && scmBranchParameters.isRemoteBranching() )
            {
                info = SvnJavaUtil.copy( javaRepo.getClientManager(), javaRepo.getSvnUrl(), destURL, false, message,
                                         null );
            }
            else
            {
                info = SvnJavaUtil.copy( javaRepo.getClientManager(), fileSet.getBasedir(), destURL, false, message,
                                         null );
            }

            if ( info.getErrorMessage() != null )
            {
                return new TagScmResult( SvnJavaScmProvider.COMMAND_LINE, "SVN tag failed.",
                                         info.getErrorMessage().getMessage(), false );
            }
            List<ScmFile> fileList = new ArrayList<ScmFile>();

            List<File> files = null;

            try
            {
                @SuppressWarnings( "unchecked" ) List<File> listFiles =
                    FileUtils.getFiles( fileSet.getBasedir(), "**", "**/.svn/**", false );
                files = listFiles;
            }
            catch ( IOException e )
            {
                throw new ScmException( "Error while executing command.", e );
            }

            for ( File f : files )
            {
                fileList.add( new ScmFile( f.getPath(), ScmFileStatus.TAGGED ) );
            }
            return new BranchScmResult( SvnJavaScmProvider.COMMAND_LINE, fileList );
        }
        catch ( SVNException e )
        {
            return new BranchScmResult( SvnJavaScmProvider.COMMAND_LINE, "SVN tag failed.", e.getMessage(), false );
        }
    }

    /**
     * {@inheritDoc}
     */
    public ScmResult executeBranchCommand( ScmProviderRepository repo, ScmFileSet fileSet, String branch,
                                           String message )
        throws ScmException
    {
        ScmBranchParameters scmBranchParameters = new ScmBranchParameters( message );
        return executeBranchCommand( repo, fileSet, branch, scmBranchParameters );
    }
}
src/main/java/org/apache/maven/scm/provider/svn/svnjava/command/tag/SvnTagCommand.java
public class SvnTagCommand
    extends AbstractTagCommand
    implements SvnCommand
{
    /**
     * {@inheritDoc}
     */
    protected ScmResult executeTagCommand( ScmProviderRepository repo, ScmFileSet fileSet, String tag, String message )
        throws ScmException
    {
        return executeTagCommand( repo, fileSet, tag, new ScmTagParameters( message ) );
    }

    protected ScmResult executeTagCommand( ScmProviderRepository repo, ScmFileSet fileSet, String tag,
                                           ScmTagParameters scmTagParameters )
        throws ScmException
    {
        if ( tag == null )
        {
            throw new ScmException( "tag must be specified" );
        }

        if ( !fileSet.getFileList().isEmpty() )
        {
            throw new ScmException( "This provider doesn't support tagging subsets of a directory" );
        }

        if ( getLogger().isInfoEnabled() )
        {
            getLogger().info( "SVN checkout directory: " + fileSet.getBasedir().getAbsolutePath() );
        }

        SvnScmProviderRepository repository = (SvnScmProviderRepository) repo;

        SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repo;

        try
        {
            SVNURL destURL = SVNURL.parseURIEncoded( SvnTagBranchUtils.resolveTagUrl( repository, new ScmTag( tag ) ) );

            String message = "[maven-scm] copy for tag " + tag;

            if ( StringUtils.isNotBlank( scmTagParameters.getMessage() ) )
            {
                message = scmTagParameters.getMessage();
            }

            SVNCommitInfo info;
            if ( scmTagParameters != null && scmTagParameters.isRemoteTagging() )
            {
                info = SvnJavaUtil.copy( javaRepo.getClientManager(), javaRepo.getSvnUrl(), destURL, false, message,
                                         scmTagParameters.getScmRevision() );
            }
            else
            {
                info = SvnJavaUtil.copy( javaRepo.getClientManager(), fileSet.getBasedir(), destURL, false, message,
                                         scmTagParameters.getScmRevision() );
            }

            if ( info.getErrorMessage() != null )
            {
                return new TagScmResult( SvnJavaScmProvider.COMMAND_LINE, "SVN tag failed.",
                                         info.getErrorMessage().getMessage(), false );
            }

            // The copy command doesn't return a list of files that were tagged,
            // so manually build the list from the contents of the fileSet.getBaseDir.
            List<ScmFile> fileList = new ArrayList<ScmFile>();
            List<File> files = null;
            try
            {
                @SuppressWarnings( "unchecked" ) List<File> list =
                    FileUtils.getFiles( fileSet.getBasedir(), "**", "**/.svn/**", false );
                files = list;
            }
            catch ( IOException e )
            {
                throw new ScmException( "Error while building list of tagged files.", e );
            }

            for ( Iterator<File> i = files.iterator(); i.hasNext(); )
            {
                File f = i.next();
                fileList.add( new ScmFile( f.getPath(), ScmFileStatus.TAGGED ) );
            }

            return new TagScmResult( SvnJavaScmProvider.COMMAND_LINE, fileList );
        }
        catch ( SVNException e )
        {
            return new TagScmResult( SvnJavaScmProvider.COMMAND_LINE, "SVN tag failed.", e.getMessage(), false );
        }
    }

}
src/main/java/org/apache/maven/scm/provider/svn/svnjava/command/checkout/SvnJavaCheckOutCommand.java
public class SvnJavaCheckOutCommand
    extends AbstractCheckOutCommand
    implements SvnCommand
{
    /**
     * {@inheritDoc}
     */
    protected CheckOutScmResult executeCheckOutCommand( ScmProviderRepository repo, ScmFileSet fileSet,
                                                        ScmVersion version, boolean recursive )
        throws ScmException
    {
        if ( getLogger().isInfoEnabled() )
        {
            getLogger().info( "SVN checkout directory: " + fileSet.getBasedir().getAbsolutePath() );
        }

        SvnScmProviderRepository repository = (SvnScmProviderRepository) repo;

        String url = repository.getUrl();

        SVNRevision revision = SVNRevision.HEAD;

        if ( version != null && StringUtils.isNotEmpty( version.getName() ) )
        {
            if ( version instanceof ScmTag )
            {
                url = SvnTagBranchUtils.resolveTagUrl( repository, (ScmTag) version );
            }
            else if ( version instanceof ScmBranch )
            {
                url = SvnTagBranchUtils.resolveBranchUrl( repository, (ScmBranch) version );
            }
            else if ( version instanceof ScmRevision )
            {
                try
                {
                    revision = SVNRevision.create( Long.parseLong( ( (ScmRevision) version ).getName() ) );
                }
                catch ( NumberFormatException exc )
                {
                    return new CheckOutScmResult( SvnJavaScmProvider.COMMAND_LINE,
                                                  "SVN checkout failed. Wrong format of revision number.", null,
                                                  false );
                }
            }
        }

        url = SvnCommandUtils.fixUrl( url, repository.getUser() );

        SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repo;

        ScmFileEventHandler handler = new ScmFileEventHandler( getLogger(), fileSet.getBasedir() );
        SVNUpdateClient updateClient = javaRepo.getClientManager().getUpdateClient();
        updateClient.setEventHandler( handler );

        try
        {
            SvnJavaUtil.checkout( updateClient, SVNURL.parseURIEncoded( url ), revision, fileSet.getBasedir(), true );

            return new CheckOutScmResult( SvnJavaScmProvider.COMMAND_LINE, handler.getFiles() );
        }
        catch ( SVNException e )
        {
            return new CheckOutScmResult( SvnJavaScmProvider.COMMAND_LINE, "SVN checkout failed.", e.getMessage(),
                                          false );
        }
        finally
        {
            javaRepo.getClientManager().getUpdateClient().setEventHandler( null );
        }
    }
}
src/main/java/org/apache/maven/scm/provider/svn/svnjava/command/mkdir/SvnJavaMkdirCommand.java
public class SvnJavaMkdirCommand
    extends AbstractMkdirCommand
    implements SvnCommand
{

    /**
     * @see org.apache.maven.scm.command.mkdir.AbstractMkdirCommand#executeMkdirCommand(ScmProviderRepository, ScmFileSet, String, boolean)
     */
    @Override
    protected MkdirScmResult executeMkdirCommand( ScmProviderRepository repository, ScmFileSet fileSet, String message,
                                                  boolean createInLocal )
        throws ScmException
    {
        SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repository;
        Iterator<File> it = fileSet.getFileList().iterator();
        String dirPath = it.next().getPath();
        // replacing \ with / for windauze
        if ( dirPath != null && Os.isFamily( Os.FAMILY_DOS ) )
        {
            dirPath = StringUtils.replace( dirPath, "\\", "/" );
        }
        String url = javaRepo.getUrl() + "/" + dirPath;
        if ( createInLocal )
        {
            url = dirPath;
        }
        List<SVNURL> svnurls = new ArrayList<SVNURL>( 1 );
        try
        {
            svnurls.add( SVNURL.parseURIEncoded( url ) );

            SVNCommitInfo commitInfo =
                SvnJavaUtil.mkdir( javaRepo.getClientManager(), svnurls.toArray( new SVNURL[svnurls.size()] ),
                                   message );
            ScmResult scmResult = new ScmResult( null, null, null, true );

            return new MkdirScmResult( Long.toString( commitInfo.getNewRevision() ), scmResult );
        }
        catch ( SVNException e )
        {
            throw new ScmException( e.getMessage(), e );
        }
    }

}


Question: package org.apache.maven.scm.provider.svn.svnjava;
import org.apache.maven.scm.CommandParameters;
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.ScmFileSet;
import org.apache.maven.scm.ScmVersion;
import org.apache.maven.scm.command.list.ListScmResult;
import org.apache.maven.scm.command.remoteinfo.RemoteInfoScmResult;
import org.apache.maven.scm.provider.ScmProviderRepository;
import org.apache.maven.scm.provider.svn.AbstractSvnScmProvider;
import org.apache.maven.scm.provider.svn.command.SvnCommand;
import org.apache.maven.scm.provider.svn.svnjava.command.add.SvnJavaAddCommand;
import org.apache.maven.scm.provider.svn.svnjava.command.blame.SvnJavaBlameCommand;
import org.apache.maven.scm.provider.svn.svnjava.command.branch.SvnJavaBranchCommand;
import org.apache.maven.scm.provider.svn.svnjava.command.changelog.SvnJavaChangeLogCommand;
import org.apache.maven.scm.provider.svn.svnjava.command.checkin.SvnJavaCheckInCommand;
import org.apache.maven.scm.provider.svn.svnjava.command.checkout.SvnJavaCheckOutCommand;
import org.apache.maven.scm.provider.svn.svnjava.command.diff.SvnJavaDiffCommand;
import org.apache.maven.scm.provider.svn.svnjava.command.export.SvnJavaExportCommand;
import org.apache.maven.scm.provider.svn.svnjava.command.info.SvnJavaInfoCommand;
import org.apache.maven.scm.provider.svn.svnjava.command.list.SvnJavaListCommand;
import org.apache.maven.scm.provider.svn.svnjava.command.mkdir.SvnJavaMkdirCommand;
import org.apache.maven.scm.provider.svn.svnjava.command.remoteinfo.SvnJavaRemoteInfoCommand;
import org.apache.maven.scm.provider.svn.svnjava.command.remove.SvnJavaRemoveCommand;
import org.apache.maven.scm.provider.svn.svnjava.command.status.SvnJavaStatusCommand;
import org.apache.maven.scm.provider.svn.svnjava.command.tag.SvnTagCommand;
import org.apache.maven.scm.provider.svn.svnjava.command.update.SvnJavaUpdateCommand;
import org.apache.maven.scm.provider.svn.svnjava.repository.SvnJavaScmProviderRepository;
import org.apache.maven.scm.repository.ScmRepository;
import org.apache.maven.scm.repository.ScmRepositoryException;
import org.codehaus.plexus.util.StringUtils;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory;
import org.tmatesoft.svn.core.internal.io.fs.FSRepositoryFactory;
import org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl;
import java.io.File;
import java.net.URI;
import java.util.Collections;

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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:dh-maven@famhq.com">David Hawkins</a>
 * @version $Id: SvnJavaScmProvider.java 439 2010-06-19 17:21:10Z oliver.lamy $
 * @plexus.component role="org.apache.maven.scm.provider.ScmProvider" role-hint="javasvn"
 */
public class SvnJavaScmProvider
    extends AbstractSvnScmProvider
{
    public static final String COMMAND_LINE = "JavaSVN Library";

    private static boolean initialized = false;

    /**
     * {@inheritDoc}
     */
    public ScmProviderRepository makeProviderScmRepository( String scmSpecificUrl, char delimiter )
        throws ScmRepositoryException
    {
        initialize();

        try
        {
            File f;
            if ( scmSpecificUrl.trim().startsWith( "file" ) )
            {
                try
                {
                    f = new File( new URI( scmSpecificUrl ) );
                }
                catch ( Exception e )
                {
                    // nop
                    f = new File( scmSpecificUrl );
                }
            }
            else
            {
                f = new File( scmSpecificUrl );
            }

            SVNURL url;
            if ( f.exists() )
            {
                url = SVNURL.fromFile( f );
            }
            else
            {
                url = SVNURL.parseURIEncoded( scmSpecificUrl );
            }

            // The existing svn provider pattern is to strip the username (if any)
            // from the url.
            String strUrl = url.toString();
            if ( url.getUserInfo() != null )
            {
                strUrl = StringUtils.replace( strUrl, url.getUserInfo() + "@", "" );
            }

            return new SvnJavaScmProviderRepository( url, strUrl );
        }
        catch ( SVNException e )
        {
            throw new ScmRepositoryException( "The scm url is invalid: " + e.getMessage(),
                                              Collections.singletonList( e.getMessage() ) );
        }
    }

    /**
     * {@inheritDoc}
     */
    protected SvnCommand getAddCommand()
    {
        return new SvnJavaAddCommand();
    }

    /**
     * {@inheritDoc}
     */
    protected SvnCommand getChangeLogCommand()
    {
Answer:         return new SvnJavaChangeLogCommand();