Package org.apache.maven.scm.provider.accurev

Examples of org.apache.maven.scm.provider.accurev.FileDifference


    protected void startTag( List<String> tagPath, Map<String, String> attributes )
    {
        String tagName = getTagName( tagPath );
        if ( "Element".equals( tagName ) )
        {
            currentDifference = new FileDifference();
        }
        else if ( "Stream2".equals( tagName ) && attributes.get( "Name" ) != null)
        {
            currentDifference.setElementId( Long.parseLong( attributes.get( "eid" ) ) );
            currentDifference.setNewVersion( attributes.get( "Name" ), attributes.get( "Version" ) );
View Full Code Here


        when( accurev.showStream( "myStream" ) ).thenReturn( basisStream );

        when( accurev.history( "myStream", "2009/01/12 13:00:00", null, 1, true, true ) ).thenReturn( endTransaction );

        // now we call diff between the tran ids - 35 to 42
        FileDifference promoted = new FileDifference( 10L, "/promoted/file", "4/2", "/promoted/file", "6/1" );
        FileDifference removed = new FileDifference( 20L, null, null, "/removed/file", "6/1" );
        FileDifference created = new FileDifference( 30L, "/created/file", "6/1", null, null );
        FileDifference moved = new FileDifference( 40L, "/moved/to", "4/2", "/moved/from", "6/1" );

        when( accurev.diff( "myStream", "35", "42" ) ).thenReturn( Arrays.asList( promoted, removed, created, moved ) );

        // and we call hist for tranid + 1 to end trand id
View Full Code Here

        Stream basisStream = new Stream( "stream4", 4, "myDepot", 1, "myDepot", getDate( 2008, 1, 1 ), "normal" );
        when( accurev.showStream( "stream4" ) ).thenReturn( basisStream );

        // now we call diff between the tran ids - 35 to 42
        FileDifference diffWS3toS2 = new FileDifference( 32L, "/promoted/WS3toS2", "3/2", "/promoted/WS3toS2", "6/1" );
        FileDifference diffWS5toS4 = new FileDifference( 54L, "/promoted/WS5toS4", "5/3", "/promoted/WS5toS4", "8/1" );
        FileDifference diffWS7toS4 = new FileDifference( 74L, "/promoted/WS7toS4", "7/12", "/promoted/WS7toS4", "3/13" );

        when( accurev.diff( "stream4", "35", "42" ) )
            .thenReturn( Arrays.asList( diffWS3toS2, diffWS5toS4, diffWS7toS4 ) );

        // and we call hist for tranid + 1 to end trand ii
View Full Code Here

        List<FileDifference> differences = new ArrayList<FileDifference>();
        XppStreamConsumer consumer = new DiffConsumer( new DefaultLog(), differences );
        AccuRevJUnitUtil.consume( "/diff-vvt.xml", consumer );

        assertThat( differences.size(), is( 3 ) );
        assertThat( differences, hasItem( new FileDifference( 8L, "/tcktests/src/main/java/Application.java", "2/3",
                                                              null, null ) ) );
        assertThat( differences, hasItem( new FileDifference( 9L, "/tcktests/hello-world.txt", "2/4",
                                                              "/tcktests/hello.world", "6/1" ) ) );

    }
View Full Code Here

            for ( Version v : versions )
            {

                // Remove diff representing this promote
                FileDifference difference = differencesMap.get( v.getElementId() );
                // TODO: how are defuncts shown in the version history?
                if ( difference != null )
                {
                    String newVersionSpec = difference.getNewVersionSpec();
                    if ( newVersionSpec != null && newVersionSpec.equals( v.getRealSpec() ) )
                    {
                        if ( getLogger().isDebugEnabled() )
                        {
                            getLogger().debug( "Removing difference for " + v );
                        }
                        differencesMap.remove( v.getElementId() );
                    }
                }

                // Add this file, unless the virtual version indicates this is the basis stream, and the real
                // version came from our workspace stream (ie, this transaction is a promote from the workspace
                // to its basis stream, and is therefore NOT a change
                if ( v.getRealSpec().startsWith( streamPrefix ) && !v.getVirtualSpec().startsWith( streamPrefix ) )
                {
                    if ( getLogger().isDebugEnabled() )
                    {
                        getLogger().debug( "Skipping workspace to basis stream promote " + v );
                    }
                }
                else
                {
                    ChangeFile f =
                        new ChangeFile( v.getElementName(), v.getVirtualSpec() + " (" + v.getRealSpec() + ")" );
                    files.add( f );
                }

            }

            if ( versions.isEmpty() || !files.isEmpty() )
            {
                ChangeSet changeSet = new ChangeSet( t.getWhen(), t.getComment(), t.getAuthor(), files );

                entries.add( changeSet );
            }
            else
            {
                if ( getLogger().isDebugEnabled() )
                {
                    getLogger().debug( "All versions removed for " + t );
                }
            }

        }

        // Anything left in the differencesMap represents a change from a higher stream
        // We don't have details on who or where these came from, but it is important to
        // detect these for CI tools like Continuum
        if ( !differencesMap.isEmpty() )
        {
            List<ChangeFile> upstreamFiles = new ArrayList<ChangeFile>();
            for ( FileDifference difference : differencesMap.values() )
            {
                if ( difference.getNewVersionSpec() != null )
                {
                    upstreamFiles.add( new ChangeFile( difference.getNewFile().getPath(),
                                                       difference.getNewVersionSpec() ) );
                }
                else
                {
                    // difference is a deletion
                    upstreamFiles.add( new ChangeFile( difference.getOldFile().getPath(), null ) );
                }
            }
            entries.add( new ChangeSet( endDate, "Upstream changes", "various", upstreamFiles ) );
        }
View Full Code Here

    protected void startTag( List<String> tagPath, Map<String, String> attributes )
    {
        String tagName = getTagName( tagPath );
        if ( "Element".equals( tagName ) )
        {
            currentDifference = new FileDifference();
        }
        else if ( "Stream2".equals( tagName ) && attributes.get( "Name" ) != null )
        {
            currentDifference.setElementId( Long.parseLong( attributes.get( "eid" ) ) );
            currentDifference.setNewVersion( attributes.get( "Name" ), attributes.get( "Version" ) );
View Full Code Here

            for ( Version v : versions )
            {

                // Remove diff representing this promote
                FileDifference difference = differencesMap.get( v.getElementId() );
                // TODO: how are defuncts shown in the version history?
                if ( difference != null )
                {
                    String newVersionSpec = difference.getNewVersionSpec();
                    if ( newVersionSpec != null && newVersionSpec.equals( v.getRealSpec() ) )
                    {
                        if ( getLogger().isDebugEnabled() )
                        {
                            getLogger().debug( "Removing difference for " + v );
                        }
                        differencesMap.remove( v.getElementId() );
                    }
                }

                // Add this file, unless the virtual version indicates this is the basis stream, and the real
                // version came from our workspace stream (ie, this transaction is a promote from the workspace
                // to its basis stream, and is therefore NOT a change
                if ( v.getRealSpec().startsWith( streamPrefix ) && !v.getVirtualSpec().startsWith( streamPrefix ) )
                {
                    if ( getLogger().isDebugEnabled() )
                    {
                        getLogger().debug( "Skipping workspace to basis stream promote " + v );
                    }
                }
                else
                {
                    ChangeFile f =
                        new ChangeFile( v.getElementName(), v.getVirtualSpec() + " (" + v.getRealSpec() + ")" );
                    files.add( f );
                }

            }

            if ( versions.isEmpty() || !files.isEmpty() )
            {
                ChangeSet changeSet = new ChangeSet( t.getWhen(), t.getComment(), t.getAuthor(), files );

                entries.add( changeSet );
            }
            else
            {
                if ( getLogger().isDebugEnabled() )
                {
                    getLogger().debug( "All versions removed for " + t );
                }
            }

        }

        // Anything left in the differencesMap represents a change from a higher stream
        // We don't have details on who or where these came from, but it is important to
        // detect these for CI tools like Continuum
        if ( !differencesMap.isEmpty() )
        {
            List<ChangeFile> upstreamFiles = new ArrayList<ChangeFile>();
            for ( FileDifference difference : differencesMap.values() )
            {
                if ( difference.getNewVersionSpec() != null )
                {
                    upstreamFiles.add( new ChangeFile( difference.getNewFile().getPath(),
                                                       difference.getNewVersionSpec() ) );
                }
                else
                {
                    // difference is a deletion
                    upstreamFiles.add( new ChangeFile( difference.getOldFile().getPath(), null ) );
                }
            }
            entries.add( new ChangeSet( endDate, "Upstream changes", "various", upstreamFiles ) );
        }
View Full Code Here

            for ( Version v : versions )
            {

                // Remove diff representing this promote
                FileDifference difference = differencesMap.get( v.getElementId() );
                // TODO: how are defuncts shown in the version history?
                if ( difference != null )
                {
                    String newVersionSpec = difference.getNewVersionSpec();
                    if ( newVersionSpec != null && newVersionSpec.equals( v.getRealSpec() ) )
                    {
                        if ( getLogger().isDebugEnabled() )
                        {
                            getLogger().debug( "Removing difference for " + v );
                        }
                        differencesMap.remove( v.getElementId() );
                    }
                }

                // Add this file, unless the virtual version indicates this is the basis stream, and the real
                // version came from our workspace stream (ie, this transaction is a promote from the workspace
                // to its basis stream, and is therefore NOT a change
                if ( v.getRealSpec().startsWith( streamPrefix ) && !v.getVirtualSpec().startsWith( streamPrefix ) )
                {
                    if ( getLogger().isDebugEnabled() )
                    {
                        getLogger().debug( "Skipping workspace to basis stream promote " + v );
                    }
                }
                else
                {
                    ChangeFile f =
                        new ChangeFile( v.getElementName(), v.getVirtualSpec() + " (" + v.getRealSpec() + ")" );
                    files.add( f );
                }

            }

            if ( versions.isEmpty() || !files.isEmpty() )
            {
                ChangeSet changeSet = new ChangeSet( t.getWhen(), t.getComment(), t.getAuthor(), files );

                entries.add( changeSet );
            }
            else
            {
                if ( getLogger().isDebugEnabled() )
                {
                    getLogger().debug( "All versions removed for " + t );
                }
            }

        }

        // Anything left in the differencesMap represents a change from a higher stream
        // We don't have details on who or where these came from, but it is important to
        // detect these for CI tools like Continuum
        if ( !differencesMap.isEmpty() )
        {
            List<ChangeFile> upstreamFiles = new ArrayList<ChangeFile>();
            for ( FileDifference difference : differencesMap.values() )
            {
                if ( difference.getNewVersionSpec() != null )
                {
                    upstreamFiles.add( new ChangeFile( difference.getNewFile().getPath(),
                                                       difference.getNewVersionSpec() ) );
                }
                else
                {
                    // difference is a deletion
                    upstreamFiles.add( new ChangeFile( difference.getOldFile().getPath(), null ) );
                }
            }
            entries.add( new ChangeSet( endDate, "Upstream changes", "various", upstreamFiles ) );
        }
View Full Code Here

TOP

Related Classes of org.apache.maven.scm.provider.accurev.FileDifference

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.