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

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


        for ( Iterator sets = changelogList.iterator(); sets.hasNext(); )
        {
            changelogXml.append( "\n  " );

            ChangeLogSet changelogSet = (ChangeLogSet) sets.next();
            String changeset = changelogSet.toXML( outputEncoding );

            //remove xml header
            if ( changeset.startsWith( "<?xml" ) )
            {
                int idx = changeset.indexOf( "?>" ) + 2;
View Full Code Here


        // Summary section
        doSummarySection( changeLogSets, bundle, sink );

        for ( Iterator sets = changeLogSets.iterator(); sets.hasNext(); )
        {
            ChangeLogSet changeLogSet = (ChangeLogSet) sets.next();

            doChangedSet( changeLogSet, bundle, sink );
        }

        sink.section1_();
View Full Code Here

        HgChangeLogConsumer consumer = new HgChangeLogConsumer( getLogger(), datePattern );
        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

        if ( !logEntries.isEmpty() )
        {
            startDate = logEntries.get( 0 ).getDate();
            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

     */
    public ChangeLogSet getChangeLog( Date startDate, Date endDate )
        throws APIException
    {
        // Initialize our return object
        ChangeLogSet changeLog = new ChangeLogSet( startDate, endDate );
        // By default we're going to group-by change package
        // Non change package changes will be lumped into one big Change Set
        Hashtable<String, ChangeSet> changeSetHash = new Hashtable<String, ChangeSet>();

        // Lets prepare our si rlog command for execution
        Command siRlog = new Command( Command.SI, "rlog" );
        siRlog.addOption( new Option( "recurse" ) );
        MultiValue rFilter = new MultiValue( ":" );
        rFilter.add( "daterange" );
        rFilter.add( "'" + RLOG_DATEFORMAT.format( startDate ) + "'-'" + RLOG_DATEFORMAT.format( endDate ) + "'" );
        siRlog.addOption( new Option( "rfilter", rFilter ) );
        siRlog.addOption( new Option( "cwd", sandboxDir ) );
        // Execute the si rlog command
        Response response = api.runCommand( siRlog );
        for ( WorkItemIterator wit = response.getWorkItems(); wit.hasNext(); )
        {
            WorkItem wi = wit.next();
            String memberName = wi.getContext();
            // We're going to have to do a little dance to get the correct server file name
            memberName = memberName.substring( 0, memberName.lastIndexOf( '/' ) );
            memberName = memberName + '/' + wi.getId();
            memberName = memberName.replace( '\\', '/' );
            // Now lets get the revisions for this file
            Field revisionsFld = wi.getField( "revisions" );
            if ( null != revisionsFld && revisionsFld.getDataType().equals( Field.ITEM_LIST_TYPE )
                && null != revisionsFld.getList() )
            {
                @SuppressWarnings( "unchecked" ) List<Item> revList = revisionsFld.getList();
                for ( Iterator<Item> lit = revList.iterator(); lit.hasNext(); )
                {
                    Item revisionItem = lit.next();
                    String revision = revisionItem.getId();
                    String author = revisionItem.getField( "author" ).getItem().getId();
                    // Attempt to get the full name, if available
                    try
                    {
                        author = revisionItem.getField( "author" ).getItem().getField( "fullname" ).getValueAsString();
                    }
                    catch ( NullPointerException npe )
                    { /* ignore */ }
                    String cpid = ":none";
                    // Attempt to get the cpid for this revision
                    try
                    {
                        cpid = revisionItem.getField( "cpid" ).getItem().getId();
                    }
                    catch ( NullPointerException npe )
                    { /* ignore */ }
                    // Get the Change Package summary for this revision
                    String comment = cpid + ": " + revisionItem.getField( "cpsummary" ).getValueAsString();
                    // Get the date associated with this revision
                    Date date = revisionItem.getField( "date" ).getDateTime();

                    // Lets create our ChangeFile based on the information we've gathered so far
                    ChangeFile changeFile = new ChangeFile( memberName, revision );

                    // Check to see if we already have a ChangeSet grouping for this revision
                    ChangeSet changeSet = changeSetHash.get( cpid );
                    if ( null != changeSet )
                    {
                        // Set the date of the ChangeSet to the oldest entry
                        if ( changeSet.getDate().after( date ) )
                        {
                            changeSet.setDate( date );
                        }
                        // Add the new ChangeFile
                        changeSet.addFile( changeFile );
                        // Update the changeSetHash
                        changeSetHash.put( cpid, changeSet );
                    }
                    else // Create a new ChangeSet grouping and add the ChangeFile
                    {
                        List<ChangeFile> changeFileList = new ArrayList<ChangeFile>();
                        changeFileList.add( changeFile );
                        changeSet = new ChangeSet( date, comment, author, changeFileList );
                        // Update the changeSetHash with an initial entry for the cpid
                        changeSetHash.put( cpid, changeSet );
                    }
                }
            }

        }

        // Update the Change Log with the Change Sets
        List<ChangeSet> changeSetList = new ArrayList<ChangeSet>();
        changeSetList.addAll( changeSetHash.values() );
        changeLog.setChangeSets( changeSetList );

        return changeLog;
    }
View Full Code Here

        commandParameters.setScmVersion( CommandParameter.START_SCM_VERSION, new ScmRevision( "workspace5/35" ) );
        commandParameters.setScmVersion( CommandParameter.END_SCM_VERSION, new ScmRevision( "workspace5/42" ) );
        ChangeLogScmResult result = command.changelog( repo, testFileSet, commandParameters );

        assertThat( result.isSuccess(), is( true ) );
        ChangeLogSet changelog = result.getChangeLog();
        assertThat( changelog.getStartVersion().getName(), is( "workspace5/35" ) );
        assertThat( changelog.getEndVersion().getName(), is( "workspace5/42" ) );
        List<ChangeSet> changesets = changelog.getChangeSets();
        assertThat( changesets.size(), is( 3 ) );

        for ( ChangeSet changeSet : changesets )
        {
            assertThat( changeSet.getComment(), isOneOf( "Upstream changes", "WS7toS4", "keepWS5" ) );
View Full Code Here

        if ( exitCode != 0 )
        {
            return new ChangeLogScmResult( cl.toString(), "The svn command failed.", stderr.getOutput(), false );
        }
        ChangeLogSet changeLogSet = new ChangeLogSet( consumer.getModifications(), startDate, endDate );
        changeLogSet.setStartVersion( startVersion );
        changeLogSet.setEndVersion( endVersion );

        return new ChangeLogScmResult( cl.toString(), changeLogSet );
    }
View Full Code Here

        {
            return new ChangeLogScmResult( cl.toString(), "The vss command failed.", stderr.getOutput(), false );
        }

        return new ChangeLogScmResult( cl.toString(),
                                       new ChangeLogSet( consumer.getModifications(), startDate, endDate ) );
    }
View Full Code Here

        if ( !changeLogResult.isSuccess() )
        {
            fail( changeLogResult.getProviderMessage() + "\n" + changeLogResult.getCommandOutput() );
        }

        ChangeLogSet changeLogSet = changeLogResult.getChangeLog();

        assertNotNull( changeLogSet );

        assertEquals( changeLogSize, changeLogSet.getChangeSets().size() );
    }
View Full Code Here

        catch ( IOException ex )
        {
            throw new ScmException( "Error while getting change logs.", ex );
        }

        return new ChangeLogScmResult( null, new ChangeLogSet( changeLogList, startDate, endDate ) );
    }
View Full Code Here

TOP

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

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.