Package com.atlassian.jgitflow.core

Examples of com.atlassian.jgitflow.core.JGitFlow


    @Test
    public void startReleaseWithAllowUntrackedFile() throws Exception
    {
        Git git = RepoUtil.createRepositoryWithMasterAndDevelop(newDir());
        JGitFlowInitCommand initCommand = new JGitFlowInitCommand();
        JGitFlow flow = initCommand.setDirectory(git.getRepository().getWorkTree()).call();

        git.checkout().setName("develop").call();
        //we should be on develop branch
        assertEquals(flow.getDevelopBranchName(), git.getRepository().getBranch());

        //create a new commit
        File junkFile = new File(git.getRepository().getWorkTree(), "junk.txt");
        FileUtils.writeStringToFile(junkFile, "I am junk");
        git.add().addFilepattern(junkFile.getName()).call();
        RevCommit commit = git.commit().setMessage("committing junk file").call();

        //make sure develop has our commit
        assertTrue(GitHelper.isMergedInto(git, commit, flow.getDevelopBranchName()));

        //create a new file
        File junk2File = new File(git.getRepository().getWorkTree(), "junk2.txt");
        FileUtils.writeStringToFile(junk2File, "I am junk 2");
       
        flow.releaseStart("1.0").setAllowUntracked(true).call();

    }
View Full Code Here


    @Test
    public void startReleaseFromSpecificCommit() throws Exception
    {
        Git git = RepoUtil.createRepositoryWithMasterAndDevelop(newDir());
        JGitFlowInitCommand initCommand = new JGitFlowInitCommand();
        JGitFlow flow = initCommand.setDirectory(git.getRepository().getWorkTree()).call();

        git.checkout().setName("develop").call();
        //we should be on develop branch
        assertEquals(flow.getDevelopBranchName(), git.getRepository().getBranch());

        //create a new commit
        File junkFile = new File(git.getRepository().getWorkTree(), "junk.txt");
        FileUtils.writeStringToFile(junkFile, "I am junk");
        git.add().addFilepattern(junkFile.getName()).call();
        RevCommit commitOne = git.commit().setMessage("committing junk file").call();

        //make sure develop has our commit
        assertTrue(GitHelper.isMergedInto(git, commitOne, flow.getDevelopBranchName()));

        //create a new commit
        File junkFile2 = new File(git.getRepository().getWorkTree(), "junk2.txt");
        FileUtils.writeStringToFile(junkFile2, "I am junk too");
        git.add().addFilepattern(junkFile2.getName()).call();
        RevCommit commitTwo = git.commit().setMessage("committing junk 2 file").call();

        //make sure develop has our commit
        assertTrue(GitHelper.isMergedInto(git, commitTwo, flow.getDevelopBranchName()));
       
        flow.releaseStart("1.0").setStartCommit(commitOne.getName()).call();

        assertEquals(flow.getReleaseBranchPrefix() + "1.0", git.getRepository().getBranch());

        //the release branch should have our commit
        assertTrue(GitHelper.isMergedInto(git, commitOne, flow.getReleaseBranchPrefix() + "1.0"));

        assertFalse(GitHelper.isMergedInto(git, commitTwo, flow.getReleaseBranchPrefix() + "1.0"));

    }
View Full Code Here

    @Test
    public void startFeature() throws Exception
    {
        Git git = RepoUtil.createRepositoryWithMaster(newDir());
        JGitFlowInitCommand initCommand = new JGitFlowInitCommand();
        JGitFlow flow = initCommand.setDirectory(git.getRepository().getWorkTree()).call();

        flow.git().checkout().setName(flow.getDevelopBranchName()).call();
        assertEquals(flow.getDevelopBranchName(), git.getRepository().getBranch());
       
        flow.featureStart("my-feature").call();

        assertEquals(flow.getFeatureBranchPrefix() + "my-feature", git.getRepository().getBranch());

    }
View Full Code Here

        remoteGit = RepoUtil.createRepositoryWithMasterAndDevelop(newDir());

        git = Git.cloneRepository().setDirectory(newDir()).setURI("file://" + remoteGit.getRepository().getWorkTree().getPath()).call();

        JGitFlowInitCommand initCommand = new JGitFlowInitCommand();
        JGitFlow flow = initCommand.setDirectory(git.getRepository().getWorkTree()).call();
        git.push().setRemote("origin").add("develop").call();

        //do a commit to the remote develop branch
        remoteGit.checkout().setName("develop").call();
        File junkFile = new File(remoteGit.getRepository().getWorkTree(), "junk.txt");
        FileUtils.writeStringToFile(junkFile, "I am junk");
        remoteGit.add().addFilepattern(junkFile.getName()).call();
        remoteGit.commit().setMessage("adding junk file").call();

        //update local
        flow.git().checkout().setName(flow.getDevelopBranchName()).call();
        git.pull().call();
       
        flow.featureStart("my-feature").setFetchDevelop(true).call();

    }
View Full Code Here

        remoteGit = RepoUtil.createRepositoryWithMasterAndDevelop(newDir());

        git = Git.cloneRepository().setDirectory(newDir()).setURI("file://" + remoteGit.getRepository().getWorkTree().getPath()).call();

        JGitFlowInitCommand initCommand = new JGitFlowInitCommand();
        JGitFlow flow = initCommand.setDirectory(git.getRepository().getWorkTree()).call();
        git.push().setRemote("origin").add("develop").call();

        flow.featureStart("myFeature").setFetchDevelop(true).setPush(true).call();

        assertTrue(GitHelper.remoteBranchExists(git, "feature/myFeature",flow.getReporter()));

    }
View Full Code Here

        remoteGit = RepoUtil.createRepositoryWithMasterAndDevelop(newDir());

        git = Git.cloneRepository().setDirectory(newDir()).setURI("file://" + remoteGit.getRepository().getWorkTree().getPath()).call();

        JGitFlowInitCommand initCommand = new JGitFlowInitCommand();
        JGitFlow flow = initCommand.setDirectory(git.getRepository().getWorkTree()).call();
        git.push().setRemote("origin").add("develop").call();
       
        //do a commit to the remote develop branch
        remoteGit.checkout().setName("develop").call();
        File junkFile = new File(remoteGit.getRepository().getWorkTree(), "junk.txt");
        FileUtils.writeStringToFile(junkFile, "I am junk");
        remoteGit.add().addFilepattern(junkFile.getName()).call();
        remoteGit.commit().setMessage("adding junk file").call();

        flow.featureStart("my-feature").setFetchDevelop(true).call();

    }
View Full Code Here

    {
        Git git = null;

        git = RepoUtil.createRepositoryWithMaster(newDir());
        JGitFlowInitCommand initCommand = new JGitFlowInitCommand();
        JGitFlow flow = initCommand.setDirectory(git.getRepository().getWorkTree()).call();

        flow.featureStart("my-feature").setFetchDevelop(true).call();
    }
View Full Code Here

    {
        Git git = null;

        git = RepoUtil.createRepositoryWithMaster(newDir());
        JGitFlowInitCommand initCommand = new JGitFlowInitCommand();
        JGitFlow flow = initCommand.setDirectory(git.getRepository().getWorkTree()).call();
       
        git.branchCreate().setName(flow.getFeatureBranchPrefix() + "my-feature").call();
       
        flow.featureStart("my-feature").call();
    }
View Full Code Here

        remoteGit = RepoUtil.createRepositoryWithMasterAndDevelop(newDir());

        git = Git.cloneRepository().setDirectory(newDir()).setURI("file://" + remoteGit.getRepository().getWorkTree().getPath()).call();

        JGitFlowInitCommand initCommand = new JGitFlowInitCommand();
        JGitFlow flow = initCommand.setDirectory(git.getRepository().getWorkTree()).call();

        //do a commit to the remote develop branch
        remoteGit.checkout().setName("develop").call();
        File junkFile = new File(remoteGit.getRepository().getWorkTree(), "junk.txt");
        FileUtils.writeStringToFile(junkFile, "I am junk");
        remoteGit.add().addFilepattern(junkFile.getName()).call();
        remoteGit.commit().setMessage("adding junk file").call();

        flow.featureStart("my-feature").call();

        assertEquals(flow.getFeatureBranchPrefix() + "my-feature", git.getRepository().getBranch());

    }
View Full Code Here

   
    @Test(expected = NotInitializedException.class)
    public void startFeatureWithoutFlowInit() throws Exception
    {
        Git git = RepoUtil.createRepositoryWithMaster(newDir());
        JGitFlow flow = JGitFlow.get(git.getRepository().getWorkTree());

        flow.featureStart("my-feature").call();
    }
View Full Code Here

TOP

Related Classes of com.atlassian.jgitflow.core.JGitFlow

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.