CPD Results

The following document contains the results of PMD's CPD 3.9.

Duplications

FileProjectLine
org\apache\maven\scm\manager\AbstractScmManager.javaMaven SCM API298
org\apache\maven\scm\manager\ScmManagerStub.javaMaven SCM Test183
    }

    /**
     *
     */
    public AddScmResult add( ScmRepository repository, ScmFileSet fileSet )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).add( repository, fileSet );
    }

    /**
     *
     */
    public AddScmResult add( ScmRepository repository, ScmFileSet fileSet, String message )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).add( repository, fileSet, message );
    }

    /**
     *
     */
    public BranchScmResult branch( ScmRepository repository, ScmFileSet fileSet, String branchName )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).branch( repository, fileSet, branchName );
    }

    /**
     *
     */
    public BranchScmResult branch( ScmRepository repository, ScmFileSet fileSet, String branchName, String message )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).branch( repository, fileSet, branchName, message );
    }

    /**
     *
     */
    public ChangeLogScmResult changeLog( ScmRepository repository, ScmFileSet fileSet, Date startDate, Date endDate,
                                         int numDays, ScmBranch branch )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).changeLog( repository, fileSet, startDate, endDate, numDays,
                                                                     branch );
    }

    /**
     *
     */
    public ChangeLogScmResult changeLog( ScmRepository repository, ScmFileSet fileSet, Date startDate, Date endDate,
                                         int numDays, ScmBranch branch, String datePattern )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).changeLog( repository, fileSet, startDate, endDate, numDays,
                                                                     branch, datePattern );
    }

    /**
     *
     */
    public ChangeLogScmResult changeLog( ScmRepository repository, ScmFileSet fileSet, ScmVersion startVersion,
                                         ScmVersion endVersion )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).changeLog( repository, fileSet, startVersion, endVersion );
    }

    /**
     *
     */
    public ChangeLogScmResult changeLog( ScmRepository repository, ScmFileSet fileSet, ScmVersion startRevision,
                                         ScmVersion endRevision, String datePattern )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).changeLog( repository, fileSet, startRevision, endRevision,
                                                                     datePattern );
    }

    /**
     *
     */
    public CheckInScmResult checkIn( ScmRepository repository, ScmFileSet fileSet, String message )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).checkIn( repository, fileSet, message );
    }

    /**
     *
     */
    public CheckInScmResult checkIn( ScmRepository repository, ScmFileSet fileSet, ScmVersion revision, String message )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).checkIn( repository, fileSet, revision, message );
    }

    /**
     *
     */
    public CheckOutScmResult checkOut( ScmRepository repository, ScmFileSet fileSet )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).checkOut( repository, fileSet );
    }

    /**
     *
     */
    public CheckOutScmResult checkOut( ScmRepository repository, ScmFileSet fileSet, ScmVersion version )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).checkOut( repository, fileSet, version );
    }

    /**
     *
     */
    public CheckOutScmResult checkOut( ScmRepository repository, ScmFileSet fileSet, boolean recursive )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).checkOut( repository, fileSet, recursive );
    }

    /**
     *
     */
    public CheckOutScmResult checkOut( ScmRepository repository, ScmFileSet fileSet, ScmVersion version,
                                       boolean recursive )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).checkOut( repository, fileSet, version, recursive );
    }

    /**
     *
     */
    public DiffScmResult diff( ScmRepository repository, ScmFileSet fileSet, ScmVersion startVersion,
                               ScmVersion endVersion )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).diff( repository, fileSet, startVersion, endVersion );
    }

    /**
     *
     */
    public EditScmResult edit( ScmRepository repository, ScmFileSet fileSet )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).edit( repository, fileSet );
    }

    /**
     *
     */
    public ExportScmResult export( ScmRepository repository, ScmFileSet fileSet )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).export( repository, fileSet );
    }

    /**
     *
     */
    public ExportScmResult export( ScmRepository repository, ScmFileSet fileSet, ScmVersion version )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).export( repository, fileSet, version );
    }

    /**
     *
     */
    public ExportScmResult export( ScmRepository repository, ScmFileSet fileSet, String outputDirectory )
        throws ScmException
    {
        return this.export( repository, fileSet, outputDirectory );

FileProjectLine
org\apache\maven\scm\manager\AbstractScmManager.javaMaven SCM API477
org\apache\maven\scm\manager\ScmManagerStub.javaMaven SCM Test362
        return this.export( repository, fileSet, outputDirectory );
    }

    /**
     *
     */
    public ExportScmResult export( ScmRepository repository, ScmFileSet fileSet, ScmVersion version,
                                   String outputDirectory )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).export( repository, fileSet, version, outputDirectory );
    }

    /**
     *
     */
    public ListScmResult list( ScmRepository repository, ScmFileSet fileSet, boolean recursive, ScmVersion version )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).list( repository, fileSet, recursive, version );
    }

    /**
     *
     */
    public RemoveScmResult remove( ScmRepository repository, ScmFileSet fileSet, String message )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).remove( repository, fileSet, message );
    }

    /**
     *
     */
    public StatusScmResult status( ScmRepository repository, ScmFileSet fileSet )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).status( repository, fileSet );
    }

    /**
     *
     */
    public TagScmResult tag( ScmRepository repository, ScmFileSet fileSet, String tagName )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).tag( repository, fileSet, tagName );
    }

    /**
     *
     */
    public TagScmResult tag( ScmRepository repository, ScmFileSet fileSet, String tagName, String message )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).tag( repository, fileSet, tagName, message );
    }

    /**
     *
     */
    public UnEditScmResult unedit( ScmRepository repository, ScmFileSet fileSet )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).unedit( repository, fileSet );
    }

    /**
     *
     */
    public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).update( repository, fileSet );
    }

    /**
     *
     */
    public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).update( repository, fileSet, version );
    }

    /**
     *
     */
    public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, boolean runChangelog )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).update( repository, fileSet, runChangelog );
    }

    /**
     *
     */
    public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version,
                                   boolean runChangelog )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).update( repository, fileSet, version, runChangelog );
    }

    /**
     *
     */
    public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, String datePattern )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).update( repository, fileSet, (ScmVersion) null, datePattern );
    }

    /**
     *
     */
    public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version,
                                   String datePattern )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).update( repository, fileSet, version, datePattern );
    }

    /**
     *
     */
    public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, Date lastUpdate )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).update( repository, fileSet, (ScmVersion) null, lastUpdate );
    }

    /**
     *
     */
    public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version, Date lastUpdate )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).update( repository, fileSet, version, lastUpdate );
    }

    /**
     *
     */
    public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, Date lastUpdate, String datePattern )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).update( repository, fileSet, (ScmVersion) null, lastUpdate,
                                                                  datePattern );
    }

    /**
     *
     */
    public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, ScmVersion version, Date lastUpdate,
                                   String datePattern )
        throws ScmException
    {
        return this.getProviderByRepository( repository ).update( repository, fileSet, version, lastUpdate,
                                                                  datePattern );
    }
}

FileProjectLine
org\apache\maven\scm\provider\bazaar\repository\BazaarScmProviderRepository.javaMaven SCM Bazaar Provider141
org\apache\maven\scm\provider\hg\repository\HgScmProviderRepository.javaMaven SCM Mercurial (Hg) Provider124
        if ( protocol == FILE )
        {
            return url;
        }

        //Strip protocol
        url = url.substring( protocol.length() );

        url = parseUsernameAndPassword( url );

        url = parseHostAndPort( url );

        url = parsePath( url );

        return url; //is now only the path
    }

    private String parseHostAndPort( String url )
    {
        if ( protocol != FILE )
        {
            String[] split = url.split( ":" );
            if ( split.length == 2 )
            {
                setHost( split[0] );
                url = url.substring( split[0].length() + 1 );
                split = split[1].split( "/" );
                if ( split.length == 2 )
                {
                    url = url.substring( split[0].length() );
                    try
                    {
                        setPort( Integer.valueOf( split[0] ).intValue() );
                    }
                    catch ( NumberFormatException e )
                    {
                        //Ignore - error will manifest itself later.
                    }
                }
            }
            else
            {
                split = url.split( "/" );
                if ( split.length > 1 )
                {
                    url = url.substring( split[0].length() );
                    setHost( split[0] );
                }
            }
        }
        return url;
    }

    private String parseUsernameAndPassword( String url )
    {
        if ( needsAuthentication() )
        {
            String[] split = url.split( "@" );
            if ( split.length == 2 )
            {
                url = split[1]; //Strip away 'username:password@' from url
                split = split[0].split( ":" );
                if ( split.length == 2 )
                { //both username and password
                    setUser( split[0] );
                    setPassword( split[1] );
                }
                else
                { //only username
                    setUser( split[0] );
                }
            }
        }
        return url;
    }

    private String parsePath( String url )
    {
        if ( protocol == FILE )
        {
            //Use OS dependent path separator
            url = StringUtils.replace( url, "/", File.separator );

            //Test first path separator (*nix systems use them to denote root)
            File tmpFile = new File( url ); //most likly a *nix system
            String url2 = url.substring( File.pathSeparator.length() );
            File tmpFile2 = new File( url2 ); //most likly a windows system
            if ( !tmpFile.exists() && !tmpFile2.exists() )
            {
                // This is trouble - Trouble is reported in validateURI()
            }

            url = tmpFile2.exists() ? url2 : url;
        }

        return url;
    }

    private String addUser()
    {
        return ( getUser() == null ) ? "" : getUser();
    }

    private String addPassword()
    {
        return ( getPassword() == null ) ? "" : ":" + getPassword();
    }

    private String addAt()
    {
        return needsAuthentication() ? "@" : "";
    }

    private String addHost()
    {
        return ( getHost() == null ) ? "" : getHost();
    }

    private String addPort()
    {
        return ( getPort() == 0 ) ? "" : ":" + getPort();
    }

    private String addPath()
    {
        return path;
    }

    private boolean needsAuthentication()
    {
        return protocol == SFTP || protocol == FTP || protocol == HTTPS || protocol == AFTP;
    }

    public String toString()
    {
        return "Hg Repository Interpreted from: " + orgUrl + ":\nProtocol: " + protocol + "\nHost: " + getHost() +

FileProjectLine
org\apache\maven\scm\provider\bazaar\command\BazaarConsumer.javaMaven SCM Bazaar Provider78
org\apache\maven\scm\provider\hg\command\HgConsumer.javaMaven SCM Mercurial (Hg) Provider91
    public HgConsumer( ScmLogger logger )
    {
        super( logger );
    }

    public void doConsume( ScmFileStatus status, String trimmedLine )
    {
        //override this
    }

    public void consumeLine( String line )
    {
        getLogger().debug( line );
        String trimmedLine = line.trim();

        String statusStr = processInputForKnownIdentifiers( trimmedLine );

        //If its not a status report - then maybe its a message?
        if ( statusStr == null )
        {
            boolean isMessage = processInputForKnownMessages( trimmedLine );
            //If it is then its already processed and we can ignore futher processing
            if ( isMessage )
            {
                return;
            }
        }
        else
        {
            //Strip away identifier
            trimmedLine = trimmedLine.substring( statusStr.length() );
            trimmedLine = trimmedLine.trim(); //one or more spaces
        }

        ScmFileStatus status = statusStr != null ? ( (ScmFileStatus) identifiers.get( statusStr.intern() ) ) : null;
        doConsume( status, trimmedLine );
    }

    /**
     * Warnings and errors is usually printed out in Std.Err, thus for derived consumers
     * operating on Std.Out this would typically return an empty string.
     *
     * @return Return the last lines interpreted as an warning or an error
     */
    public String getStdErr()
    {
        String str = "";
        for ( Iterator it = stderr.iterator(); it.hasNext(); )
        {
            str += it.next();
        }
        return str;
    }

    private static String processInputForKnownIdentifiers( String line )
    {
        for ( Iterator it = identifiers.keySet().iterator(); it.hasNext(); )
        {
            String id = (String) it.next();
            if ( line.startsWith( id ) )
            {
                return id;
            }
        }
        return null;
    }

    private boolean processInputForKnownMessages( String line )
    {
        for ( Iterator it = messages.keySet().iterator(); it.hasNext(); )
        {
            String prefix = (String) it.next();
            if ( line.startsWith( prefix ) )
            {
                stderr.add( line ); //Add line
                if ( stderr.size() > MAX_STDERR_SIZE )
                {
                    stderr.remove( 0 ); //Rotate list
                }
                String message = line.substring( prefix.length() );
                if ( messages.get( prefix ).equals( "WARNING" ) )
                {
                    getLogger().warn( message );
                }
                else
                {
                    getLogger().error( message );
                }
                return true;
            }
        }
        return false;
    }
}

FileProjectLine
org\apache\maven\scm\provider\hg\command\diff\HgDiffConsumer.javaMaven SCM Mercurial (Hg) Provider93
org\apache\maven\scm\provider\svn\command\diff\SvnDiffConsumer.javaMaven SCM Subversion Provider - Common library95
            currentFile = line.substring( INDEX_TOKEN.length() );

            changedFiles.add( new ScmFile( currentFile, ScmFileStatus.MODIFIED ) );

            currentDifference = new StringBuffer();

            differences.put( currentFile, currentDifference );

            patch.append( line ).append( "\n" );

            return;
        }

        if ( currentFile == null )
        {
            logger.warn( "Unparseable line: '" + line + "'" );
            patch.append( line ).append( "\n" );
            return;
        }

        if ( line.startsWith( FILE_SEPARATOR_TOKEN ) )
        {
            // skip
            patch.append( line ).append( "\n" );
        }
        else if ( line.startsWith( START_REVISION_TOKEN ) )
        {
            // skip, though could parse to verify filename, start revision
            patch.append( line ).append( "\n" );
        }
        else if ( line.startsWith( END_REVISION_TOKEN ) )
        {
            // skip, though could parse to verify filename, end revision
            patch.append( line ).append( "\n" );
        }
        else if ( line.startsWith( ADDED_LINE_TOKEN ) || line.startsWith( REMOVED_LINE_TOKEN ) ||
            line.startsWith( UNCHANGED_LINE_TOKEN ) || line.startsWith( CHANGE_SEPARATOR_TOKEN ) ||
            line.equals( NO_NEWLINE_TOKEN ) )
        {
            // add to buffer
            currentDifference.append( line ).append( "\n" );
            patch.append( line ).append( "\n" );
        }
        else
        {
            // TODO: handle property differences

            logger.warn( "Unparseable line: '" + line + "'" );
            patch.append( line ).append( "\n" );
            // skip to next file
            currentFile = null;
            currentDifference = null;
        }
    }

    public List getChangedFiles()
    {
        return changedFiles;
    }

    public Map getDifferences()
    {
        return differences;
    }

    public String getPatch()
    {
        return patch.toString();
    }

}

FileProjectLine
org\apache\maven\scm\provider\clearcase\command\add\ClearCaseAddCommand.javaMaven SCM Clearcase Provider50
org\apache\maven\scm\provider\clearcase\command\remove\ClearCaseRemoveCommand.javaMaven SCM Clearcase Provider51
        ClearCaseRemoveConsumer consumer = new ClearCaseRemoveConsumer( getLogger() );

        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();

        int exitCode;
        try
        {
            // First we need to 'check out' the current directory
            Commandline checkoutCurrentDirCommandLine =
                ClearCaseEditCommand.createCheckoutCurrentDirCommandLine( scmFileSet );
            getLogger().debug( "Executing: " + checkoutCurrentDirCommandLine.getWorkingDirectory().getAbsolutePath() +
                ">>" + checkoutCurrentDirCommandLine.toString() );
            exitCode = CommandLineUtils.executeCommandLine( checkoutCurrentDirCommandLine,
                                                            new CommandLineUtils.StringStreamConsumer(), stderr );

            if ( exitCode == 0 )
            {
                // Then we add the file
                getLogger().debug( "Executing: " + cl.getWorkingDirectory().getAbsolutePath() + ">>" + cl.toString() );
                exitCode = CommandLineUtils.executeCommandLine( cl, consumer, stderr );

                if ( exitCode == 0 )
                {
                    // Then we check in the current directory again.
                    Commandline checkinCurrentDirCommandLine =
                        ClearCaseEditCommand.createCheckinCurrentDirCommandLine( scmFileSet );
                    getLogger().debug( "Executing: " +
                        checkinCurrentDirCommandLine.getWorkingDirectory().getAbsolutePath() + ">>" +
                        checkinCurrentDirCommandLine.toString() );
                    exitCode = CommandLineUtils.executeCommandLine( checkinCurrentDirCommandLine,
                                                                    new CommandLineUtils.StringStreamConsumer(),
                                                                    stderr );
                }
            }
        }
        catch ( CommandLineException ex )
        {
            throw new ScmException( "Error while executing clearcase command.", ex );
        }

        if ( exitCode != 0 )
        {
            return new StatusScmResult( cl.toString(), "The cleartool command failed.", stderr.getOutput(), false );
        }

        return new StatusScmResult( cl.toString(), consumer.getRemovedFiles() );

FileProjectLine
org\apache\maven\scm\provider\vss\commands\checkout\VssCheckOutCommand.javaMaven SCM Visual Source Safe Provider75
org\apache\maven\scm\provider\vss\commands\update\VssUpdateCommand.javaMaven SCM Visual Source Safe Provider78
        return new UpdateScmResult( cl.toString(), consumer.getUpdatedFiles() );
    }

    public Commandline buildCmdLine( VssScmProviderRepository repo, ScmFileSet fileSet, ScmVersion version )
        throws ScmException
    {

        Commandline command = new Commandline();

        command.setWorkingDirectory( fileSet.getBasedir().getAbsolutePath() );

        try
        {
            command.addSystemEnvironment();
        }
        catch ( Exception e )
        {
            throw new ScmException( "Can't add system environment.", e );
        }

        command.addEnvironment( "SSDIR", repo.getVssdir() );

        String ssDir = VssCommandLineUtils.getSsDir();

        command.setExecutable( ssDir + VssConstants.SS_EXE );

        command.createArgument().setValue( VssConstants.COMMAND_GET );

        command.createArgument().setValue( VssConstants.PROJECT_PREFIX + repo.getProject() );

        //User identification to get access to vss repository
        if ( repo.getUserPassword() != null )
        {
            command.createArgument().setValue( VssConstants.FLAG_LOGIN + repo.getUserPassword() );
        }

        //Display the history of an entire project list
        command.createArgument().setValue( VssConstants.FLAG_RECURSION );

        //Ignore: Do not ask for input under any circumstances.
        command.createArgument().setValue( VssConstants.FLAG_AUTORESPONSE_DEF );

        // FIXME Update command only works if there is no file checked out 
        // or no file is dirty locally. It's better than overwriting 
        // checked out files 
        //Ignore: Do not touch local writable files.
        command.createArgument().setValue( VssConstants.FLAG_SKIP_WRITABLE );

FileProjectLine
org\apache\maven\scm\provider\synergy\command\remove\SynergyRemoveCommand.javaMaven SCM Synergy Provider46
org\apache\maven\scm\provider\synergy\command\unedit\SynergyUnEditCommand.javaMaven SCM Synergy Provider48
        getLogger().debug( "executing unedit command..." );

        SynergyScmProviderRepository repo = (SynergyScmProviderRepository) repository;
        getLogger().debug( "basedir: " + fileSet.getBasedir() );

        String CCM_ADDR = SynergyUtil.start( getLogger(), repo.getUser(), repo.getPassword(), null );

        try
        {
            String project_spec =
                SynergyUtil.getWorkingProject( getLogger(), repo.getProjectSpec(), repo.getUser(), CCM_ADDR );
            if ( project_spec == null )
            {
                throw new ScmException( "You should checkout project first" );
            }
            File WAPath = SynergyUtil.getWorkArea( getLogger(), project_spec, CCM_ADDR );
            File destPath = new File( WAPath, repo.getProjectName() );
            for ( Iterator i = fileSet.getFileList().iterator(); i.hasNext(); )
            {
                ScmFile f = (ScmFile) i.next();
                File source = new File( fileSet.getBasedir(), f.getPath() );
                File dest = new File( destPath, f.getPath() );
                SynergyUtil.delete( getLogger(), dest, CCM_ADDR, true );

FileProjectLine
org\apache\maven\scm\provider\starteam\command\changelog\StarteamChangeLogConsumer.javaMaven SCM Starteam Provider342
org\apache\maven\scm\provider\cvslib\command\changelog\CvsChangeLogConsumer.javaMaven SCM CVS Provider - Common library274
            setStatus( GET_COMMENT );
        }
    }

    /**
     * Process the current input line in the Get Comment state.
     *
     * @param line a line of text from the cvs log output
     */
    private void processGetComment( String line )
    {
        if ( line.startsWith( START_REVISION ) )
        {
            // add entry, and set state to get revision
            addEntry( getCurrentChange(), getCurrentFile() );
            // new change log entry
            setCurrentChange( new ChangeSet() );
            // same file name, but different rev
            setCurrentFile( new ChangeFile( getCurrentFile().getName() ) );
            setStatus( GET_REVISION );
        }
        else if ( line.startsWith( END_FILE ) )
        {
            addEntry( getCurrentChange(), getCurrentFile() );
            setStatus( GET_FILE );
        }
        else
        {
            // keep gathering comments
            getCurrentChange().setComment( getCurrentChange().getComment() + line + "\n" );
        }
    }

    /**
     * Getter for property currentFile.
     *
     * @return Value of property currentFile.
     */
    private ChangeFile getCurrentFile()
    {
        return currentFile;
    }

    /**
     * Setter for property currentFile.
     *
     * @param currentFile New value of property currentFile.
     */
    private void setCurrentFile( ChangeFile currentFile )
    {
        this.currentFile = currentFile;
    }

    /**
     * Getter for property currentChange.
     *
     * @return Value of property currentChange.
     */
    private ChangeSet getCurrentChange()
    {
        return currentChange;
    }

    /**
     * Setter for property currentChange.
     *
     * @param currentChange New value of property currentChange.
     */
    private void setCurrentChange( ChangeSet currentChange )
    {
        this.currentChange = currentChange;
    }

    /**
     * Getter for property status.
     *
     * @return Value of property status.
     */
    private int getStatus()
    {
        return status;
    }

    /**
     * Setter for property status.
     *
     * @param status New value of property status.
     */
    private void setStatus( int status )
    {
        this.status = status;
    }
}

FileProjectLine
org\apache\maven\scm\provider\vss\commands\checkout\VssCheckOutConsumer.javaMaven SCM Visual Source Safe Provider126
org\apache\maven\scm\provider\vss\commands\update\VssUpdateConsumer.javaMaven SCM Visual Source Safe Provider127
                break;
            case SET_WORKING_FOLDER:
                // to trash
                break;
            default:
                break;
        }
    }

    /**
     * Process the current input line in the Get File state.
     *
     * @param line a line of text from the VSS log output
     */
    private void processGetFile( String line )
    {
        String[] fileLine = line.split( " " );
        updatedFiles.add( new ScmFile( currentPath + "/" + fileLine[1], ScmFileStatus.UPDATED ) );
        getLogger().info( fileLine[0] + ": " + currentPath + "/" + fileLine[1] );

    }

    /**
     * Process the current input line in the Replace File state.
     *
     * @param line a line of text from the VSS log output
     */
    private void processReplaceFile( String line )
    {

        updatedFiles.add(
            new ScmFile( currentPath + "/" + line.substring( START_REPLACING.length() ), ScmFileStatus.UPDATED ) );
        getLogger().info( START_REPLACING + currentPath + "/" + line.substring( START_REPLACING.length() ) );


    }

    /**
     * Process the current input line in the Get File Path state.
     *
     * @param line a line of text from the VSS log output
     */
    private void processGetFilePath( String line )
    {
        currentPath = line.substring( ( VssConstants.PROJECT_PREFIX + repo.getProject() ).length(), line.length() - 1 );
    }

    /**
     * Process the current input line in the writable File state.
     *
     * @param line a line of text from the VSS log output
     */
    private void processWritableFile( String line )

FileProjectLine
org\apache\maven\scm\provider\cvslib\command\diff\CvsDiffConsumer.javaMaven SCM CVS Provider - Common library104
org\apache\maven\scm\provider\svn\command\diff\SvnDiffConsumer.javaMaven SCM Subversion Provider - Common library92
        if ( line.startsWith( INDEX_TOKEN ) )
        {
            // start a new file
            currentFile = line.substring( INDEX_TOKEN.length() );

            changedFiles.add( new ScmFile( currentFile, ScmFileStatus.MODIFIED ) );

            currentDifference = new StringBuffer();

            differences.put( currentFile, currentDifference );

            patch.append( line ).append( "\n" );

            return;
        }

        if ( currentFile == null )
        {
            logger.warn( "Unparseable line: '" + line + "'" );
            patch.append( line ).append( "\n" );
            return;
        }

        if ( line.startsWith( FILE_SEPARATOR_TOKEN ) )
        {
            // skip
            patch.append( line ).append( "\n" );
        }
        else if ( line.startsWith( START_REVISION_TOKEN ) )
        {
            // skip, though could parse to verify filename, start revision
            patch.append( line ).append( "\n" );
        }
        else if ( line.startsWith( END_REVISION_TOKEN ) )
        {
            // skip, though could parse to verify filename, end revision
            patch.append( line ).append( "\n" );
        }
        else if ( line.startsWith( ADDED_LINE_TOKEN ) || line.startsWith( REMOVED_LINE_TOKEN ) ||

FileProjectLine
org\apache\maven\scm\provider\bazaar\command\checkin\BazaarCheckInCommand.javaMaven SCM Bazaar Provider66
org\apache\maven\scm\provider\hg\command\checkin\HgCheckInCommand.javaMaven SCM Mercurial (Hg) Provider65
            HgStatusCommand statusCmd = new HgStatusCommand();
            statusCmd.setLogger( getLogger() );
            StatusScmResult status = statusCmd.executeStatusCommand( repo, fileSet );
            List statusFiles = status.getChangedFiles();
            for ( Iterator it = statusFiles.iterator(); it.hasNext(); )
            {
                ScmFile file = (ScmFile) it.next();
                if ( file.getStatus() == ScmFileStatus.ADDED || file.getStatus() == ScmFileStatus.DELETED ||
                    file.getStatus() == ScmFileStatus.MODIFIED )
                {
                    commitedFiles.add( new ScmFile( file.getPath(), ScmFileStatus.CHECKED_IN ) );
                }
            }

        }
        else
        { //Or commit spesific files
            for ( int i = 0; i < files.length; i++ )
            {
                commitedFiles.add( new ScmFile( files[i].getPath(), ScmFileStatus.CHECKED_IN ) );
            }
        }

        // Commit to local branch
        String[] commitCmd = new String[]{HgCommand.COMMIT_CMD, HgCommand.MESSAGE_OPTION, message};

FileProjectLine
org\apache\maven\scm\tck\command\branch\BranchCommandTckTest.javaMaven SCM Test53
org\apache\maven\scm\tck\command\tag\TagCommandTckTest.javaMaven SCM Test53
        assertEquals( "check all 4 files tagged", 4, tagResult.getTaggedFiles().size() );

        File readmeTxt = new File( getWorkingCopy(), "readme.txt" );

        assertEquals( "check readme.txt contents", "/readme.txt", FileUtils.fileRead( readmeTxt ) );

        changeReadmeTxt( readmeTxt );

        CheckInScmResult checkinResult =
            getScmManager().checkIn( getScmRepository(), new ScmFileSet( getWorkingCopy() ), "commit message" );

        assertResultIsSuccess( checkinResult );

        CheckOutScmResult checkoutResult =
            getScmManager().checkOut( getScmRepository(), new ScmFileSet( getAssertionCopy() ) );

        assertResultIsSuccess( checkoutResult );

        readmeTxt = new File( getAssertionCopy(), "readme.txt" );

        assertEquals( "check readme.txt contents", "changed file", FileUtils.fileRead( readmeTxt ) );

        FileUtils.deleteDirectory( getAssertionCopy() );

        assertFalse( "check previous assertion copy deleted", getAssertionCopy().exists() );

        checkoutResult = getScmManager().getProviderByUrl( getScmUrl() )
            .checkOut( getScmRepository(), new ScmFileSet( getAssertionCopy() ), new ScmTag( tag ) );

FileProjectLine
org\apache\maven\scm\provider\bazaar\command\changelog\BazaarChangeLogCommand.javaMaven SCM Bazaar Provider53
org\apache\maven\scm\provider\hg\command\changelog\HgChangeLogCommand.javaMaven SCM Mercurial (Hg) Provider54
        ScmResult result = HgUtils.execute( consumer, getLogger(), fileSet.getBasedir(), cmd );

        List logEntries = consumer.getModifications();
        List inRangeAndValid = new ArrayList();
        startDate = startDate == null ? new Date( 0 ) : startDate;//From 1. Jan 1970
        endDate = endDate == null ? new Date() : endDate;//Upto now

        for ( Iterator it = logEntries.iterator(); it.hasNext(); )
        {
            ChangeSet change = (ChangeSet) it.next();
            if ( change.getFiles().size() > 0 )
            {
                if ( !change.getDate().before( startDate ) && !change.getDate().after( endDate ) )
                {
                    inRangeAndValid.add( change );
                }
            }
        }

        ChangeLogSet changeLogSet = new ChangeLogSet( inRangeAndValid, startDate, endDate );
        return new ChangeLogScmResult( changeLogSet, result );
    }
}

FileProjectLine
org\apache\maven\scm\provider\clearcase\repository\ClearCaseScmProviderRepository.javaMaven SCM Clearcase Provider112
org\apache\maven\scm\provider\synergy\repository\SynergyScmProviderRepository.javaMaven SCM Synergy Provider57
        try
        {
            parseUrl( url );
        }
        catch ( MalformedURLException e )
        {
            throw new ScmRepositoryException( "Illegal URL: " + url + "(" + e.getMessage() + ")" );
        }
        catch ( URISyntaxException e )
        {
            throw new ScmRepositoryException( "Illegal URL: " + url + "(" + e.getMessage() + ")" );
        }
        catch ( UnknownHostException e )
        {
            throw new ScmRepositoryException( "Illegal URL: " + url + "(" + e.getMessage() + ")" );
        }
    }

    private void parseUrl( String url )
        throws MalformedURLException, URISyntaxException, UnknownHostException
    {
        if ( url.indexOf( '|' ) != -1 )
        {
            StringTokenizer tokenizer = new StringTokenizer( url, "|" );
            fillInProperties( tokenizer );
        }
        else
        {
            StringTokenizer tokenizer = new StringTokenizer( url, ":" );
            fillInProperties( tokenizer );
        }
    }

    private void fillInProperties( StringTokenizer tokenizer )
        throws UnknownHostException, URISyntaxException, MalformedURLException
    {

FileProjectLine
org\apache\maven\scm\provider\starteam\StarteamScmProvider.javaMaven SCM Starteam Provider318
org\apache\maven\scm\provider\cvslib\AbstractCvsScmProvider.javaMaven SCM CVS Provider - Common library668
        return (ListScmResult) executeCommand( getListCommand(), repository, fileSet, parameters );
    }

    /**
     * CVS provider requires that all files in ScmFileSet must be relative to basedir
     * This function ensures and converts all absolute paths to relative paths
     *
     * @param currentFileSet
     * @return
     * @throws ScmException
     */
    private static ScmFileSet fixUpScmFileSetAbsoluteFilePath( ScmFileSet currentFileSet )
        throws ScmException
    {
        ScmFileSet newFileSet = null;

        try
        {
            File basedir = getAbsoluteFilePath( currentFileSet.getBasedir() );

            File[] files = currentFileSet.getFiles();

            for ( int i = 0; i < files.length; ++i )
            {
                if ( files[i].isAbsolute() )
                {
                    files[i] = new File( getRelativePath( basedir, files[i] ) );
                }
            }

            newFileSet = new ScmFileSet( basedir, files );
        }
        catch ( IOException e )
        {
            throw new ScmException( "Invalid file set.", e );
        }

        return newFileSet;
    }

    public static String getRelativePath( File basedir, File f )
        throws ScmException, IOException
    {
        File fileOrDir = getAbsoluteFilePath( f );

        if ( !fileOrDir.getPath().startsWith( basedir.getPath() ) )

FileProjectLine
org\apache\maven\scm\provider\hg\command\diff\HgDiffConsumer.javaMaven SCM Mercurial (Hg) Provider93
org\apache\maven\scm\provider\cvslib\command\diff\CvsDiffConsumer.javaMaven SCM CVS Provider - Common library107
            currentFile = line.substring( INDEX_TOKEN.length() );

            changedFiles.add( new ScmFile( currentFile, ScmFileStatus.MODIFIED ) );

            currentDifference = new StringBuffer();

            differences.put( currentFile, currentDifference );

            patch.append( line ).append( "\n" );

            return;
        }

        if ( currentFile == null )
        {
            logger.warn( "Unparseable line: '" + line + "'" );
            patch.append( line ).append( "\n" );
            return;
        }

        if ( line.startsWith( FILE_SEPARATOR_TOKEN ) )
        {
            // skip
            patch.append( line ).append( "\n" );
        }
        else if ( line.startsWith( START_REVISION_TOKEN ) )
        {
            // skip, though could parse to verify filename, start revision
            patch.append( line ).append( "\n" );
        }
        else if ( line.startsWith( END_REVISION_TOKEN ) )
        {
            // skip, though could parse to verify filename, end revision
            patch.append( line ).append( "\n" );
        }
        else if ( line.startsWith( RCS_TOKEN ) )

FileProjectLine
org\apache\maven\scm\provider\hg\command\diff\HgDiffConsumer.javaMaven SCM Mercurial (Hg) Provider127
org\apache\maven\scm\provider\cvslib\command\diff\CvsDiffConsumer.javaMaven SCM CVS Provider - Common library153
        }
        else if ( line.startsWith( ADDED_LINE_TOKEN ) || line.startsWith( REMOVED_LINE_TOKEN ) ||
            line.startsWith( UNCHANGED_LINE_TOKEN ) || line.startsWith( CHANGE_SEPARATOR_TOKEN ) ||
            line.equals( NO_NEWLINE_TOKEN ) )
        {
            // add to buffer
            currentDifference.append( line ).append( "\n" );
            patch.append( line ).append( "\n" );
        }
        else
        {
            logger.warn( "Unparseable line: '" + line + "'" );
            patch.append( line ).append( "\n" );
            // skip to next file
            currentFile = null;
            currentDifference = null;
        }
    }

    public List getChangedFiles()
    {
        return changedFiles;
    }

    public Map getDifferences()
    {
        return differences;
    }

    public String getPatch()
    {
        return patch.toString();
    }

}

FileProjectLine
org\apache\maven\scm\provider\svn\SvnScmTestUtils.javaMaven SCM Subversion Provider TCK Tests98
org\apache\maven\scm\ScmTestCase.javaMaven SCM Test228
        if ( debugExecute || exitValue != 0 )
        {
            System.err.println( "-----------------------------------------" );
            System.err.println( "Command line: " + cl );
            System.err.println( "Working directory: " + cl.getWorkingDirectory() );
            System.err.println( "-----------------------------------------" );
            System.err.println( "Standard output: " );
            System.err.println( "-----------------------------------------" );
            System.err.println( stdout.getOutput() );
            System.err.println( "-----------------------------------------" );

            System.err.println( "Standard error: " );
            System.err.println( "-----------------------------------------" );
            System.err.println( stderr.getOutput() );
            System.err.println( "-----------------------------------------" );
        }

        if ( exitValue != 0 )
        {

FileProjectLine
org\apache\maven\scm\provider\svn\svnexe\command\branch\SvnBranchCommand.javaMaven SCM Subversion Provider - SVN Executable Impl.85
org\apache\maven\scm\provider\svn\svnexe\command\tag\SvnTagCommand.javaMaven SCM Subversion Provider - SVN Executable Impl.85
        Commandline cl = createCommandLine( repository, fileSet.getBasedir(), tag, messageFile );

        CommandLineUtils.StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer();

        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();

        getLogger().info( "Executing: " + SvnCommandLineUtils.cryptPassword( cl ) );
        getLogger().info( "Working directory: " + cl.getWorkingDirectory().getAbsolutePath() );

        int exitCode;

        try
        {
            exitCode = SvnCommandLineUtils.execute( cl, stdout, stderr, getLogger() );
        }
        catch ( CommandLineException ex )
        {
            throw new ScmException( "Error while executing command.", ex );
        }
        finally
        {
            try
            {
                FileUtils.forceDelete( messageFile );
            }
            catch ( IOException ex )
            {
                // ignore
            }
        }

        if ( exitCode != 0 )
        {
            // TODO: Improve this error message
            return new TagScmResult( cl.toString(), "The svn tag command failed.", stderr.getOutput(), false );

FileProjectLine
org\apache\maven\scm\provider\local\command\checkin\LocalCheckInCommand.javaMaven SCM Local Provider56
org\apache\maven\scm\provider\local\command\update\LocalUpdateCommand.javaMaven SCM Local Provider57
        if ( version != null )
        {
            throw new ScmException( "The local scm doesn't support tags." );
        }

        File root = new File( repository.getRoot() );

        String module = repository.getModule();

        File source = new File( root, module );

        File baseDestination = fileSet.getBasedir();

        if ( !baseDestination.exists() )
        {
            throw new ScmException(
                "The working directory doesn't exist (" + baseDestination.getAbsolutePath() + ")." );
        }

        if ( !root.exists() )
        {
            throw new ScmException( "The base directory doesn't exist (" + root.getAbsolutePath() + ")." );
        }

        if ( !source.exists() )
        {
            throw new ScmException( "The module directory doesn't exist (" + source.getAbsolutePath() + ")." );
        }

FileProjectLine
org\apache\maven\scm\provider\bazaar\command\remove\BazaarRemoveConsumer.javaMaven SCM Bazaar Provider41
org\apache\maven\scm\provider\hg\command\remove\HgRemoveConsumer.javaMaven SCM Mercurial (Hg) Provider41
    public HgRemoveConsumer( ScmLogger logger, File workingDir )
    {
        super( logger );
        this.workingDir = workingDir;
    }

    public void doConsume( ScmFileStatus status, String trimmedLine )
    {
        if ( status != null && status == ScmFileStatus.DELETED )
        {
            //Only include real files (not directories)
            File tmpFile = new File( workingDir, trimmedLine );
            if ( !tmpFile.exists() )
            {
                getLogger().warn( "Not a file: " + tmpFile + ". Ignored" );
            }
            else
            {
                ScmFile scmFile = new ScmFile( trimmedLine, ScmFileStatus.DELETED );
                getLogger().info( scmFile.toString() );
                removedFiles.add( scmFile );
            }
        }
    }

    public List getRemovedFiles()
    {
        return removedFiles;
    }
}

FileProjectLine
org\apache\maven\scm\provider\bazaar\command\add\BazaarAddConsumer.javaMaven SCM Bazaar Provider41
org\apache\maven\scm\provider\hg\command\add\HgAddConsumer.javaMaven SCM Mercurial (Hg) Provider41
    public HgAddConsumer( ScmLogger logger, File workingDir )
    {
        super( logger );
        this.workingDir = workingDir;
    }

    public void doConsume( ScmFileStatus status, String trimmedLine )
    {
        if ( status != null && status == ScmFileStatus.ADDED )
        {
            //Only include real files (not directories)
            File tmpFile = new File( workingDir, trimmedLine );
            if ( !tmpFile.exists() )
            {
                getLogger().warn( "Not a file: " + tmpFile + ". Ignored" );
            }
            else
            {
                ScmFile scmFile = new ScmFile( trimmedLine, ScmFileStatus.ADDED );
                getLogger().info( scmFile.toString() );
                addedFiles.add( scmFile );
            }
        }
    }

    public List getAddedFiles()
    {
        return addedFiles;
    }
}

FileProjectLine
org\apache\maven\scm\provider\vss\commands\add\VssAddConsumer.javaMaven SCM Visual Source Safe Provider45
org\apache\maven\scm\provider\svn\svnexe\command\add\SvnAddConsumer.javaMaven SCM Subversion Provider - SVN Executable Impl.45
    public SvnAddConsumer( ScmLogger logger )
    {
        this.logger = logger;
    }

    // ----------------------------------------------------------------------
    // StreamConsumer Implementation
    // ----------------------------------------------------------------------

    public void consumeLine( String line )
    {
        if ( line.length() <= 3 )
        {
            logger.warn( "Unexpected input, the line must be at least three characters long. Line: '" + line + "'." );

            return;
        }

        String statusString = line.substring( 0, 1 );

        String file = line.substring( 3 );

        ScmFileStatus status;

        if ( statusString.equals( "A" ) )
        {
            status = ScmFileStatus.ADDED;
        }
        else
        {
            logger.info( "Unknown file status: '" + statusString + "'." );

            return;
        }

        addedFiles.add( new ScmFile( file, status ) );
    }

    public List getAddedFiles()
    {
        return addedFiles;
    }

}

FileProjectLine
org\apache\maven\scm\provider\starteam\StarteamScmProvider.javaMaven SCM Starteam Provider362
org\apache\maven\scm\provider\cvslib\AbstractCvsScmProvider.javaMaven SCM CVS Provider - Common library713
        if ( !fileOrDir.getPath().startsWith( basedir.getPath() ) )
        {
            throw new ScmException( fileOrDir.getPath() + " was not contained in " + basedir.getPath() );
        }

        return fileOrDir.getPath().substring( basedir.getPath().length() + 1, fileOrDir.getPath().length() );
    }

    private static File getAbsoluteFilePath( File fileOrDir )
        throws IOException
    {
        String javaPathString = fileOrDir.getCanonicalPath().replace( '\\', '/' );

        if ( javaPathString.endsWith( "/" ) )
        {
            javaPathString = javaPathString.substring( 0, javaPathString.length() - 1 );
        }

        return new File( javaPathString );
    }
}

FileProjectLine
org\apache\maven\scm\provider\clearcase\command\status\ClearCaseStatusCommand.javaMaven SCM Clearcase Provider47
org\apache\maven\scm\provider\clearcase\command\unedit\ClearCaseUnEditCommand.javaMaven SCM Clearcase Provider49
        ClearCaseUnEditConsumer consumer = new ClearCaseUnEditConsumer( getLogger() );

        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();

        int exitCode;

        try
        {
            getLogger().debug( "Executing: " + cl.getWorkingDirectory().getAbsolutePath() + ">>" + cl.toString() );
            exitCode = CommandLineUtils.executeCommandLine( cl, consumer, stderr );
        }
        catch ( CommandLineException ex )
        {
            throw new ScmException( "Error while executing clearcase command.", ex );
        }

        if ( exitCode != 0 )
        {
            return new StatusScmResult( cl.toString(), "The cleartool command failed.", stderr.getOutput(), false );
        }

        return new StatusScmResult( cl.toString(), consumer.getUnEditFiles() );

FileProjectLine
org\apache\maven\scm\provider\vss\commands\edit\VssEditCommand.javaMaven SCM Visual Source Safe Provider76
org\apache\maven\scm\provider\vss\commands\status\VssStatusCommand.javaMaven SCM Visual Source Safe Provider73
        return new StatusScmResult( cl.toString(), consumer.getUpdatedFiles() );
    }

    public Commandline buildCmdLine( VssScmProviderRepository repo, ScmFileSet fileSet )
        throws ScmException
    {

        Commandline command = new Commandline();

        command.setWorkingDirectory( fileSet.getBasedir().getAbsolutePath() );

        try
        {
            command.addSystemEnvironment();
        }
        catch ( Exception e )
        {
            throw new ScmException( "Can't add system environment.", e );
        }

        command.addEnvironment( "SSDIR", repo.getVssdir() );

        String ssDir = VssCommandLineUtils.getSsDir();

        command.setExecutable( ssDir + VssConstants.SS_EXE );

        command.createArgument().setValue( VssConstants.COMMAND_DIFF );

FileProjectLine
org\apache\maven\scm\provider\bazaar\repository\BazaarScmProviderRepository.javaMaven SCM Bazaar Provider79
org\apache\maven\scm\provider\hg\repository\HgScmProviderRepository.javaMaven SCM Mercurial (Hg) Provider73
        if ( needsAuthentication() )
        {
            if ( getUser() == null )
            {
                msg = "Username is missing for protocol " + protocol;
            }
            else if ( getPassword() == null )
            {
                msg = "Password is missing for protocol " + protocol;
            }
            else if ( getHost() == null )
            {
                msg = "Host (eg. www.myhost.com) is missing for protocol " + protocol;
            }
        }

        else if ( getPort() != 0 && getHost() == null )
        {
            msg = "Got port information without any host for protocol " + protocol;
        }

        if ( msg != null )
        {
            msg = "Something could be wrong about the repository URL: " + orgUrl + "\nReason: " + msg +
                "\nCheck http://maven.apache.org/scm for usage and hints.";
        }
        return msg;
    }

    private String getProtocol( String url )
    {
        // Assume we have a file unless we find a URL based syntax
        String prot = FILE;

FileProjectLine
org\apache\maven\scm\provider\vss\commands\checkout\VssCheckOutCommand.javaMaven SCM Visual Source Safe Provider52
org\apache\maven\scm\provider\vss\commands\edit\VssEditCommand.javaMaven SCM Visual Source Safe Provider53
        VssUpdateConsumer consumer = new VssUpdateConsumer( repo, getLogger() );

        // TODO handle deleted files from VSS
        // TODO identify local files
        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();

        int exitCode;

        getLogger().debug( "Executing: " + cl.getWorkingDirectory().getAbsolutePath() + ">>" + cl.toString() );

        exitCode = VssCommandLineUtils.executeCommandline( cl, consumer, stderr, getLogger() );

        if ( exitCode != 0 )
        {
            String error = stderr.getOutput();
            getLogger().debug( "VSS returns error: [" + error + "] return code: [" + exitCode + "]" );
            if ( error.indexOf( "A writable copy of" ) < 0 )
            {
                return new UpdateScmResult( cl.toString(), "The vss command failed.", error, false );

FileProjectLine
org\apache\maven\scm\provider\svn\svnexe\command\export\SvnExeExportCommand.javaMaven SCM Subversion Provider - SVN Executable Impl.77
org\apache\maven\scm\provider\svn\svnexe\command\update\SvnUpdateCommand.javaMaven SCM Subversion Provider - SVN Executable Impl.55
        Commandline cl = createCommandLine( (SvnScmProviderRepository) repo, fileSet.getBasedir(), version );

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

        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();

        getLogger().info( "Executing: " + SvnCommandLineUtils.cryptPassword( cl ) );
        getLogger().info( "Working directory: " + cl.getWorkingDirectory().getAbsolutePath() );

        int exitCode;

        try
        {
            exitCode = SvnCommandLineUtils.execute( cl, consumer, stderr, getLogger() );
        }
        catch ( CommandLineException ex )
        {
            throw new ScmException( "Error while executing command.", ex );
        }

        if ( exitCode != 0 )
        {
            return new UpdateScmResult( cl.toString(), "The svn command failed.", stderr.getOutput(), false );

FileProjectLine
org\apache\maven\scm\provider\svn\svnexe\command\branch\SvnBranchCommand.javaMaven SCM Subversion Provider - SVN Executable Impl.118
org\apache\maven\scm\provider\svn\svnexe\command\tag\SvnTagCommand.javaMaven SCM Subversion Provider - SVN Executable Impl.119
            return new TagScmResult( cl.toString(), "The svn tag command failed.", stderr.getOutput(), false );
        }

        List fileList = new ArrayList();

        List files = null;

        try
        {
            files = FileUtils.getFiles( fileSet.getBasedir(), "**", "**/.svn/**", false );
        }
        catch ( IOException e )
        {
            throw new ScmException( "Error while executing command.", e );
        }

        for ( Iterator i = files.iterator(); i.hasNext(); )
        {
            File f = (File) i.next();

            fileList.add( new ScmFile( f.getPath(), ScmFileStatus.TAGGED ) );
        }

        return new TagScmResult( cl.toString(), fileList );

FileProjectLine
org\apache\maven\scm\provider\starteam\command\add\StarteamAddConsumer.javaMaven SCM Starteam Provider96
org\apache\maven\scm\provider\starteam\command\checkout\StarteamCheckOutConsumer.javaMaven SCM Starteam Provider97
    public List getRemovedFiles()
    {
        return files;
    }

    private void processDirectory( String line, int pos )
    {
        String dirPath = line.substring( pos + DIR_MARKER.length(), line.length() - 1 ).replace( '\\', '/' );

        try
        {
            this.currentDir = StarteamCommandLineUtils.getRelativeChildDirectory( this.workingDirectory, dirPath );
        }
        catch ( IllegalStateException e )
        {
            String error = "Working and checkout directories are not on the same tree";

            logger.error( error );

            logger.error( "Working directory: " + workingDirectory );

            logger.error( "Checked out directory: " + dirPath );

            throw new IllegalStateException( error );
        }
    }

    private void processRemovedFile( String line, int pos )

FileProjectLine
org\apache\maven\scm\provider\bazaar\command\changelog\BazaarChangeLogConsumer.javaMaven SCM Bazaar Provider113
org\apache\maven\scm\provider\hg\command\changelog\HgChangeLogConsumer.javaMaven SCM Mercurial (Hg) Provider150
        }
        else if ( line.startsWith( MERGED_TOKEN ) )
        {
            //This is part of lastChange and is not a separate log entry
            isMergeEntry = true;
            logEntries.remove( currentChange );
            if ( logEntries.size() > 0 )
            {
                lastChange = (ChangeSet) logEntries.get( logEntries.size() - 1 );
            }
            else
            {
                getLogger().warn( "First entry was unexpectedly a merged entry" );
                lastChange = null;
            }
        }
        else if ( line.startsWith( REVNO_TAG ) )
        {
            tmpLine = line.substring( REVNO_TAG.length() );
            tmpLine = tmpLine.trim();
            currentRevision = tmpLine;
        }
        else if ( line.startsWith( TAG_TAG ) )

FileProjectLine
org\apache\maven\scm\provider\local\command\changelog\LocalChangeLogCommand.javaMaven SCM Local Provider89
org\apache\maven\scm\provider\local\command\checkin\LocalCheckInCommand.javaMaven SCM Local Provider90
            File repoRoot = new File( repository.getRoot(), repository.getModule() );

            List files = Arrays.asList( fileSet.getFiles() );

            if ( files.isEmpty() )
            {
                files = FileUtils.getFiles( baseDestination, "**", null, false );
            }

            Iterator it = files.iterator();

            while ( it.hasNext() )
            {
                File file = (File) it.next();

                String path = file.getPath().replace( '\\', '/' );
                File repoFile = new File( repoRoot, path );
                file = new File( baseDestination, path );

FileProjectLine
org\apache\maven\scm\provider\vss\commands\checkout\VssCheckOutConsumer.javaMaven SCM Visual Source Safe Provider167
org\apache\maven\scm\provider\vss\commands\update\VssUpdateConsumer.javaMaven SCM Visual Source Safe Provider186
    }

    /**
     * Identify the status of a vss get line
     *
     * @param line The line to process
     * @return status
     */
    private int getLineStatus( String line )
    {
        int argument = GET_UNKNOWN;
        if ( line.startsWith( START_FILE_PATH ) )
        {
            argument = GET_FILE_PATH;
        }
        else if ( line.startsWith( START_GETTING ) )
        {
            argument = GET_FILE;
        }
        else if ( line.startsWith( START_REPLACING ) )
        {
            argument = REPLACE_FILE;
        }
        else if ( line.startsWith( START_WRITABLE_COPY ) )
        {
            argument = IS_WRITABLE_COPY;
        }
        else if ( line.indexOf( CONTAINS_SET_DEFAULT_WORKING_FOLDER ) != -1 )
        {
            argument = SET_WORKING_FOLDER;
        }

        return argument;
    }

    public List getUpdatedFiles()
    {
        return updatedFiles;
    }

}

FileProjectLine
org\apache\maven\scm\tck\command\diff\DiffCommandTckTest.javaMaven SCM Test50
org\apache\maven\scm\tck\command\update\UpdateCommandTckTest.javaMaven SCM Test82
        checkOut( getUpdatingCopy(), repository );

        // ----------------------------------------------------------------------
        // Change the files
        // ----------------------------------------------------------------------

        /*
         * readme.txt is changed (changed file in the root directory)
         * project.xml is added (added file in the root directory)
         * src/test/resources is untouched (a empty directory is left untouched)
         * src/test/java is untouched (a non empty directory is left untouched)
         * src/test/java/org (a empty directory is added)
         * src/main/java/org/Foo.java (a non empty directory is added)
         */

        // /readme.txt
        ScmTestCase.makeFile( getWorkingCopy(), "/readme.txt", "changed readme.txt" );

        // /project.xml
        ScmTestCase.makeFile( getWorkingCopy(), "/project.xml", "changed project.xml" );

        addToWorkingTree( getWorkingCopy(), new File( "project.xml" ), repository );

        // /src/test/java/org
        ScmTestCase.makeDirectory( getWorkingCopy(), "/src/test/java/org" );

        addToWorkingTree( getWorkingCopy(), new File( "src/test/java/org" ), repository );

        // /src/main/java/org/Foo.java
        ScmTestCase.makeFile( getWorkingCopy(), "/src/main/java/org/Foo.java" );

        addToWorkingTree( getWorkingCopy(), new File( "src/main/java/org" ), repository );

        // src/main/java/org/Foo.java
        addToWorkingTree( getWorkingCopy(), new File( "src/main/java/org/Foo.java" ), repository );

FileProjectLine
org\apache\maven\scm\provider\vss\commands\edit\VssEditCommand.javaMaven SCM Visual Source Safe Provider102
org\apache\maven\scm\provider\vss\commands\status\VssStatusCommand.javaMaven SCM Visual Source Safe Provider99
        command.createArgument().setValue( VssConstants.COMMAND_DIFF );

        command.createArgument().setValue( VssConstants.PROJECT_PREFIX + repo.getProject() );

        //User identification to get access to vss repository
        if ( repo.getUserPassword() != null )
        {
            command.createArgument().setValue( VssConstants.FLAG_LOGIN + repo.getUserPassword() );
        }

        //Display the history of an entire project list
        command.createArgument().setValue( VssConstants.FLAG_RECURSION );

        //Ignore: Do not ask for input under any circumstances.
        command.createArgument().setValue( VssConstants.FLAG_AUTORESPONSE_DEF );

        // TODO: Get Labled Version
        // command.createArgument().setValue( VssConstants.FLAG_VERSION_LABEL );

        return command;
    }

    /**
     * @see org.apache.maven.scm.command.update.AbstractUpdateCommand#getChangeLogCommand()
     */
    protected ChangeLogCommand getChangeLogCommand()
    {
        VssHistoryCommand command = new VssHistoryCommand();

        command.setLogger( getLogger() );

        return command;
    }

}

FileProjectLine
org\apache\maven\scm\provider\vss\commands\add\VssAddCommand.javaMaven SCM Visual Source Safe Provider69
org\apache\maven\scm\provider\vss\commands\edit\VssEditCommand.javaMaven SCM Visual Source Safe Provider76
        return new EditScmResult( cl.toString(), consumer.getUpdatedFiles() );
    }

    public Commandline buildCmdLine( VssScmProviderRepository repo, ScmFileSet fileSet )
        throws ScmException
    {

        Commandline command = new Commandline();

        command.setWorkingDirectory( fileSet.getBasedir().getAbsolutePath() );

        try
        {
            command.addSystemEnvironment();
        }
        catch ( Exception e )
        {
            throw new ScmException( "Can't add system environment.", e );
        }

        command.addEnvironment( "SSDIR", repo.getVssdir() );

        String ssDir = VssCommandLineUtils.getSsDir();

        command.setExecutable( ssDir + VssConstants.SS_EXE );

        command.createArgument().setValue( VssConstants.COMMAND_CHECKOUT );

FileProjectLine
org\apache\maven\scm\provider\svn\svnexe\command\diff\SvnDiffCommand.javaMaven SCM Subversion Provider - SVN Executable Impl.54
org\apache\maven\scm\provider\svn\svnexe\command\export\SvnExeExportCommand.javaMaven SCM Subversion Provider - SVN Executable Impl.79
        SvnStatusConsumer consumer = new SvnStatusConsumer( getLogger(), fileSet.getBasedir() );

        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();

        getLogger().info( "Executing: " + SvnCommandLineUtils.cryptPassword( cl ) );
        getLogger().info( "Working directory: " + cl.getWorkingDirectory().getAbsolutePath() );

        int exitCode;

        try
        {
            exitCode = SvnCommandLineUtils.execute( cl, consumer, stderr, getLogger() );
        }
        catch ( CommandLineException ex )
        {
            throw new ScmException( "Error while executing command.", ex );
        }

        if ( exitCode != 0 )
        {
            return new StatusScmResult( cl.toString(), "The svn command failed.", stderr.getOutput(), false );

FileProjectLine
org\apache\maven\scm\provider\svn\svnexe\command\checkout\SvnCheckOutCommand.javaMaven SCM Subversion Provider - SVN Executable Impl.52
org\apache\maven\scm\provider\svn\svnexe\command\export\SvnExeExportCommand.javaMaven SCM Subversion Provider - SVN Executable Impl.55
                                                    String outputDirectory )
        throws ScmException
    {
        SvnScmProviderRepository repository = (SvnScmProviderRepository) repo;

        String url = repository.getUrl();

        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 );
            }
        }

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

        Commandline cl =
            createCommandLine( (SvnScmProviderRepository) repo, fileSet.getBasedir(), version, url, outputDirectory );

FileProjectLine
org\apache\maven\scm\provider\clearcase\command\changelog\ClearCaseChangeLogConsumer.javaMaven SCM Clearcase Provider184
org\apache\maven\scm\provider\cvslib\command\changelog\CvsChangeLogConsumer.javaMaven SCM CVS Provider - Common library297
            addEntry( getCurrentChange(), getCurrentFile() );

            setStatus( GET_FILE );
        }
        else
        {
            // keep gathering comments
            getCurrentChange().setComment( getCurrentChange().getComment() + line + "\n" );
        }
    }

    /**
     * Getter for property currentFile.
     *
     * @return Value of property currentFile.
     */
    private ChangeFile getCurrentFile()
    {
        return currentFile;
    }

    /**
     * Setter for property currentFile.
     *
     * @param currentFile New value of property currentFile.
     */
    private void setCurrentFile( ChangeFile currentFile )
    {
        this.currentFile = currentFile;
    }

    /**
     * Getter for property currentChange.
     *
     * @return Value of property currentChange.
     */
    private ChangeSet getCurrentChange()
    {
        return currentChange;
    }

    /**
     * Setter for property currentChange.
     *
     * @param currentChange New value of property currentChange.
     */
    private void setCurrentChange( ChangeSet currentChange )
    {
        this.currentChange = currentChange;
    }

    /**
     * Getter for property status.
     *
     * @return Value of property status.
     */
    private int getStatus()
    {
        return status;
    }

    /**
     * Setter for property status.
     *
     * @param status New value of property status.
     */
    private void setStatus( int status )
    {
        this.status = status;
    }
}