Package org.apache.maven.scm.command.changelog

Examples of org.apache.maven.scm.command.changelog.ChangeLogScmResult


        // TODO: probably need to base this from a working directory in the main configuration
        File workingDirectory = configuration.getWorkingDirectory();

        ScmRepository repository = getScmRepository( configuration );

        ChangeLogScmResult result;

        ScmFileSet fileSet = new ScmFileSet( workingDirectory );

        if ( scmVersion == null || StringUtils.isBlank( scmVersion.getName() ) )
        {
View Full Code Here


        {
            File workingDirectory = buildAgentConfigurationService.getWorkingDirectory( project.getId() );
            ContinuumScmConfiguration config = createScmConfiguration( project, workingDirectory );
            config.setLatestUpdateDate( ContinuumBuildAgentUtil.getLatestUpdateDate( context ) );
            getLogger().info( "Getting changeLog of project: " + project.getName() );
            ChangeLogScmResult changeLogResult = scm.changeLog( config );

            if ( !changeLogResult.isSuccess() )
            {
                getLogger().warn( "Error getting change log of project " + project.getName() );

                getLogger().warn( "Command Output: " + changeLogResult.getCommandOutput() );

                getLogger().warn( "Provider Message: " + changeLogResult.getProviderMessage() );
            }

            context.put( ContinuumBuildAgentUtil.KEY_LATEST_UPDATE_DATE, getLatestUpdateDate( changeLogResult ) );
        }
        catch ( ScmException e )
View Full Code Here

            ScmRepository repository = getScmRepository();

            ScmProvider provider = manager.getProviderByRepository( repository );

            ChangeLogScmResult result;

            if ( "range".equals( type ) )
            {
                result = provider.changeLog( repository, new ScmFileSet( basedir ), null, null, range, (ScmBranch) null,
                                             dateFormat );

                checkResult( result );

                changeSets.add( result.getChangeLog() );
            }
            else if ( "tag".equals( type ) )
            {
                if ( repository.getProvider().equals( "svn" ) )
                {
                    throw new MavenReportException( "The type '" + type + "' isn't supported for svn." );
                }

                Iterator<String> tagsIter = tags.iterator();

                String startTag = tagsIter.next();
                String endTag = null;

                if ( tagsIter.hasNext() )
                {
                    while ( tagsIter.hasNext() )
                    {
                        endTag = tagsIter.next();

                        result = provider.changeLog( repository, new ScmFileSet( basedir ), new ScmRevision( startTag ),
                                                     new ScmRevision( endTag ) );

                        checkResult( result );

                        changeSets.add( result.getChangeLog() );

                        startTag = endTag;
                    }
                }
                else
                {
                    result = provider.changeLog( repository, new ScmFileSet( basedir ), new ScmRevision( startTag ),
                                                 new ScmRevision( endTag ) );

                    checkResult( result );

                    changeSets.add( result.getChangeLog() );
                }
            }
            else if ( "date".equals( type ) )
            {
                Iterator<String> dateIter = dates.iterator();

                String startDate = dateIter.next();
                String endDate = null;

                if ( dateIter.hasNext() )
                {
                    while ( dateIter.hasNext() )
                    {
                        endDate = dateIter.next();

                        result = provider.changeLog( repository, new ScmFileSet( basedir ), parseDate( startDate ),
                                                     parseDate( endDate ), 0, (ScmBranch) null );

                        checkResult( result );

                        changeSets.add( result.getChangeLog() );

                        startDate = endDate;
                    }
                }
                else
                {
                    result = provider.changeLog( repository, new ScmFileSet( basedir ), parseDate( startDate ),
                                                 parseDate( endDate ), 0, (ScmBranch) null );

                    checkResult( result );

                    changeSets.add( result.getChangeLog() );
                }
            }
            else
            {
                throw new MavenReportException( "The type '" + type + "' isn't supported." );
View Full Code Here

        ScmResult result =
            HgUtils.execute( consumer, getLogger(), fileSet.getBasedir(), cmd.toArray( new String[cmd.size()] ) );

        List<ChangeSet> logEntries = consumer.getModifications();
        ChangeLogSet changeLogSet = new ChangeLogSet( logEntries, startDate, endDate );
        return new ChangeLogScmResult( changeLogSet, result );
    }
View Full Code Here

            endDate = logEntries.get( logEntries.size() - 1 ).getDate();
        }
        ChangeLogSet changeLogSet = new ChangeLogSet( logEntries, startDate, endDate );
        changeLogSet.setStartVersion( startVersion );
        changeLogSet.setEndVersion( endVersion );
        return new ChangeLogScmResult( changeLogSet, result );
    }
View Full Code Here

    {
        Thread.sleep( 1000 );
        ScmProvider provider = getScmManager().getProviderByRepository( getScmRepository() );
        ScmFileSet fileSet = new ScmFileSet( getWorkingCopy() );

        ChangeLogScmResult firstResult =
            provider.changeLog( getScmRepository(), fileSet, null, null, 0, (ScmBranch) null, null );
        assertTrue( firstResult.getProviderMessage() + ": " + firstResult.getCommandLine() + "\n" + firstResult.getCommandOutput(),
                    firstResult.isSuccess() );

        //for svn, cvs, git, the repo get recreated for each test and therefore initial changelog size is 1
        // for SCM like perforce, it is not possible to recreate the repo, therefor the size will be greater then 1
        int firstLogSize = firstResult.getChangeLog().getChangeSets().size();
        assertTrue( "Unexpected initial log size", firstLogSize >= 1 );

        //Make a timestamp that we know are after initial revision but before the second
        Date timeBeforeSecond = new Date(); //Current time

        // pause a couple seconds... [SCM-244]
        Thread.sleep( 2000 );

        //Make a change to the readme.txt and commit the change
        this.edit( getWorkingCopy(), "readme.txt", null, getScmRepository() );
        ScmTestCase.makeFile( getWorkingCopy(), "/readme.txt", "changed readme.txt" );
        CheckInScmResult checkInResult = provider.checkIn( getScmRepository(), fileSet, COMMIT_MSG );
        assertTrue( "Unable to checkin changes to the repository", checkInResult.isSuccess() );

        ChangeLogScmResult secondResult = provider.changeLog( getScmRepository(), fileSet, (ScmVersion) null, null );
        assertTrue( secondResult.getProviderMessage(), secondResult.isSuccess() );
        assertEquals( firstLogSize + 1, secondResult.getChangeLog().getChangeSets().size() );

        //Now only retrieve the changelog after timeBeforeSecondChangeLog
        Date currentTime = new Date();
        ChangeLogScmResult thirdResult = provider
            .changeLog( getScmRepository(), fileSet, timeBeforeSecond, currentTime, 0, new ScmBranch( "" ) );

        //Thorough assert of the last result
        assertTrue( thirdResult.getProviderMessage(), thirdResult.isSuccess() );
        assertEquals( 1, thirdResult.getChangeLog().getChangeSets().size() );
        ChangeSet changeset = thirdResult.getChangeLog().getChangeSets().get( 0 );
        assertTrue( changeset.getDate().after( timeBeforeSecond ) );


        assertEquals( COMMIT_MSG, changeset.getComment() );
    }
View Full Code Here

                               startScmVersion );
            ScmVersion endRev =
                getScmVersion( StringUtils.isEmpty( endScmVersionType ) ? "revision" : endScmVersionType,
                               endScmVersion );

            ChangeLogScmResult result;
            if ( startRev != null || endRev != null )
            {
                result = provider.changeLog( repository, getFileSet(), startRev, endRev, dateFormat );
            }
            else
            {
                result = provider.changeLog( repository, getFileSet(), this.parseDate( localFormat, this.startDate ),
                                             this.parseDate( localFormat, this.endDate ), 0,
                                             (ScmBranch) getScmVersion( scmVersionType, scmVersion ), dateFormat );
            }
            checkResult( result );

            ChangeLogSet changeLogSet = result.getChangeLog();

            for ( ChangeSet changeSet : changeLogSet.getChangeSets() )
            {
                getLog().info( changeSet.toString() );
            }
View Full Code Here

            ChangeLogSet changeLogSet = new ChangeLogSet( modifications, startDate, endDate );
            changeLogSet.setStartVersion( startVersion );
            changeLogSet.setEndVersion( endVersion );

            return new ChangeLogScmResult( "JGit changelog", changeLogSet );
        }
        catch ( Exception e )
        {
            throw new ScmException( "JGit changelog failure!", e );
        }
View Full Code Here

        try
        {
            File workingDirectory = buildAgentConfigurationService.getWorkingDirectory( project.getId() );
            ContinuumScmConfiguration config = createScmConfiguration( project, workingDirectory );
            getLogger().info( "Getting changeLog of project: " + project.getName() );
            ChangeLogScmResult changeLogResult = scm.changeLog( config );

            if ( !changeLogResult.isSuccess() )
            {
                getLogger().warn( "Error getting change log of project " + project.getName() );

                getLogger().warn( "Command Output: " + changeLogResult.getCommandOutput() );

                getLogger().warn( "Provider Message: " + changeLogResult.getProviderMessage() );
            }

            context.put( ContinuumBuildAgentUtil.KEY_LATEST_UPDATE_DATE, getLatestUpdateDate( changeLogResult ) );
        }
        catch ( ScmException e )
View Full Code Here

        // TODO: probably need to base this from a working directory in the main configuration
        File workingDirectory = configuration.getWorkingDirectory();

        ScmRepository repository = getScmRepository( configuration );

        ChangeLogScmResult result;

        ScmFileSet fileSet = new ScmFileSet( workingDirectory );

        result = scmManager.changeLog( repository, fileSet, scmVersion, scmVersion );
View Full Code Here

TOP

Related Classes of org.apache.maven.scm.command.changelog.ChangeLogScmResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.