Package org.apache.maven.scm.command.checkout

Examples of org.apache.maven.scm.command.checkout.CheckOutScmResult


    public void testMetadata()
        throws Exception
    {
        FileUtils.deleteDirectory( getWorkingCopy() );

        CheckOutScmResult result = checkOut( getWorkingCopy(), getScmRepository() );

        assertResultIsSuccess( result );

        List<ScmFile> checkedOutFiles = result.getCheckedOutFiles();

        assertEquals( 4, checkedOutFiles.size() );

        // ----------------------------------------------------------------------
        // Assert metadata file
View Full Code Here


        setScmSpecificFilename( "" );
        setAddScmResult( new AddScmResult( "", Collections.<ScmFile>emptyList() ) );
        setBranchScmResult( new BranchScmResult( "", Collections.<ScmFile>emptyList() ) );
        setChangeLogScmResult( new ChangeLogScmResult( "", "", "", true ) );
        setCheckInScmResult( new CheckInScmResult( "", "", "", true ) );
        setCheckOutScmResult( new CheckOutScmResult( "", "", "", true ) );
        setDiffScmResult( new DiffScmResult( "", "", "", true ) );
        setEditScmResult( new EditScmResult( "", "", "", true ) );
        setExportScmResult( new ExportScmResult( "", "", "", true ) );
        setRemoveScmResult( new RemoveScmResult( "", "", "", true ) );
        setStatusScmResult( new StatusScmResult( "", "", "", true ) );
View Full Code Here

        if ( !ScmTestCase.isSystemCmd( "git" ) )
        {
            System.out.println( "skip test which git native executable in path" );
            return;
        }
        CheckOutScmResult result = checkoutRepo();
        assertEquals( 0, result.getCheckedOutFiles().size() );
    }
View Full Code Here

        if ( !ScmTestCase.isSystemCmd( "git" ) )
        {
            System.out.println( "skip test which git native executable in path" );
            return;
        }
        CheckOutScmResult result = checkoutRepo();
        assertEquals( 0, result.getCheckedOutFiles().size() );
        CheckOutScmResult result2 = checkoutRepo();
        assertEquals( 0, result2.getCheckedOutFiles().size() );
    }
View Full Code Here

    }

    protected CheckOutScmResult checkoutRepo()
        throws Exception
    {
        CheckOutScmResult result =
            getScmManager().checkOut( scmRepository, new ScmFileSet( workingDirectory ), (ScmVersion) null );

        assertResultIsSuccess( result );
        return result;
    }
View Full Code Here

        File repo = getTestFile( "target/git_copy" );
        FileUtils.deleteDirectory( repo );
        FileUtils.copyDirectoryStructure( repo_orig, repo );

        ScmRepository scmRepository = getScmManager().makeScmRepository( "scm:git:file:///" + repo.getAbsolutePath() );
        CheckOutScmResult checkOutScmResult = checkoutRepo( scmRepository );
        assertEquals( 0, checkOutScmResult.getCheckedOutFiles().size() );

        File f = new File( workingDirectory.getAbsolutePath() + File.separator + "pom.xml" );
        FileUtils.fileWrite( f.getAbsolutePath(), "toto" );

        ScmFileSet scmFileSet = new ScmFileSet( workingDirectory, new File( "pom.xml" ) );
        AddScmResult addResult = getScmManager().add( scmRepository, scmFileSet );
        assertResultIsSuccess( addResult );

        CheckInScmResult checkInScmResult = getScmManager().checkIn( scmRepository, scmFileSet, "commit" );
        assertResultIsSuccess( checkInScmResult );
        assertEquals( 1, checkInScmResult.getCheckedInFiles().size() );
        assertEquals( "pom.xml", checkInScmResult.getCheckedInFiles().get( 0 ).getPath() );

        checkOutScmResult = checkoutRepo( scmRepository );
        assertResultIsSuccess( checkOutScmResult );
        assertEquals( 1, checkOutScmResult.getCheckedOutFiles().size() );
        assertEquals( "pom.xml", checkOutScmResult.getCheckedOutFiles().get( 0 ).getPath() );
    }
View Full Code Here

    protected CheckOutScmResult checkoutRepo( ScmRepository scmRepository )
        throws Exception
    {
        FileUtils.deleteDirectory( workingDirectory );

        CheckOutScmResult result =
            getScmManager().checkOut( scmRepository, new ScmFileSet( workingDirectory ), (ScmVersion) null );

        assertResultIsSuccess( result );
        return result;
    }
View Full Code Here

    private CheckOutScmResult checkoutRepoInto( File workingCopy, ScmRepository scmRepository )
        throws Exception {
        FileUtils.deleteDirectory( workingCopy );
        workingCopy.mkdir();

        CheckOutScmResult result =
            getScmManager().checkOut( scmRepository, new ScmFileSet( workingCopy ), (ScmVersion) null );

        assertResultIsSuccess( result );
        return result;
    }
View Full Code Here

            Commandline clList = GitListCommand.createCommandLine( repository, fileSet.getBasedir() );

            exitCode = GitCommandLineUtils.execute( clList, listConsumer, stderr, getLogger() );
            if ( exitCode != 0 )
            {
                return new CheckOutScmResult( clList.toString(), "The git-ls-files command failed.",
                                              stderr.getOutput(), false );
            }

            return new TagScmResult( clTag.toString(), listConsumer.getListedFiles() );
        }
View Full Code Here

            Commandline clClone = createCloneCommand( repository, fileSet.getBasedir(), version );

            exitCode = GitCommandLineUtils.execute( clClone, stdout, stderr, getLogger() );
            if ( exitCode != 0 )
            {
                return new CheckOutScmResult( clClone.toString(), "The git-clone command failed.", stderr.getOutput(),
                                              false );
            }
            lastCommandLine = clClone.toString();
        }

        GitRemoteInfoCommand gitRemoteInfoCommand = new GitRemoteInfoCommand();
        gitRemoteInfoCommand.setLogger( getLogger() );
        RemoteInfoScmResult result = gitRemoteInfoCommand.executeRemoteInfoCommand( repository, null, null );

        if ( fileSet.getBasedir().exists() && new File( fileSet.getBasedir(), ".git" ).exists()
            && result.getBranches().size() > 0 )
        {
            // git repo exists, so we must git-pull the changes
            Commandline clPull = createPullCommand( repository, fileSet.getBasedir(), version );

            exitCode = GitCommandLineUtils.execute( clPull, stdout, stderr, getLogger() );
            if ( exitCode != 0 )
            {
                return new CheckOutScmResult( clPull.toString(), "The git-pull command failed.", stderr.getOutput(),
                                              false );
            }
            lastCommandLine = clPull.toString();

            // and now lets do the git-checkout itself
            Commandline clCheckout = createCommandLine( repository, fileSet.getBasedir(), version );

            exitCode = GitCommandLineUtils.execute( clCheckout, stdout, stderr, getLogger() );
            if ( exitCode != 0 )
            {
                return new CheckOutScmResult( clCheckout.toString(), "The git-checkout command failed.",
                                              stderr.getOutput(), false );
            }
            lastCommandLine = clCheckout.toString();
        }

        // and now search for the files
        GitListConsumer listConsumer =
            new GitListConsumer( getLogger(), fileSet.getBasedir(), ScmFileStatus.CHECKED_IN );

        Commandline clList = GitListCommand.createCommandLine( repository, fileSet.getBasedir() );

        exitCode = GitCommandLineUtils.execute( clList, listConsumer, stderr, getLogger() );
        if ( exitCode != 0 )
        {
            return new CheckOutScmResult( clList.toString(), "The git-ls-files command failed.", stderr.getOutput(),
                                          false );
        }

        return new CheckOutScmResult( lastCommandLine, listConsumer.getListedFiles() );
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.scm.command.checkout.CheckOutScmResult

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.