Examples of JGitFlow


Examples of com.atlassian.jgitflow.core.JGitFlow

        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();

        flow.hotfixStart("1.0").call();

        //do a commit to the remote develop branch
        remoteGit.checkout().setName(flow.getDevelopBranchName());
        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.hotfixFinish("1.0").setFetch(true).call();

    }
View Full Code Here

Examples of com.atlassian.jgitflow.core.JGitFlow

        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();

        flow.hotfixStart("1.0").call();

        //do a commit to the remote develop branch
        remoteGit.checkout().setName(flow.getMasterBranchName());
        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.hotfixFinish("1.0").setFetch(true).call();

    }
View Full Code Here

Examples of com.atlassian.jgitflow.core.JGitFlow

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

        String masterBranchName = flow.getMasterBranchName();

        RevCommit oldMasterHead = GitHelper.getLatestCommit(git, masterBranchName );

        flow.hotfixStart("1.0").call();

        // Make sure we move away from master on a hotfix branch
        // This is important to validate JGITFFLOW-14

        //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();
        git.commit().setMessage("committing junk file").call();

        flow.hotfixFinish("1.0").setNoTag( false ).call();

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

        // There should be a tag reference
        Ref hotfixTagRef = git.getRepository( ).getTags( ).get( flow.getVersionTagPrefix( ) + "1.0" );

        assertNotNull( hotfixTagRef );

        RevTag hotfixTag = new RevWalk( git.getRepository( ) ).parseTag( hotfixTagRef.getObjectId( ) );
View Full Code Here

Examples of com.atlassian.jgitflow.core.JGitFlow

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

        flow.git().checkout().setName("develop").call();
        assertEquals(flow.getDevelopBranchName(), flow.git().getRepository().getBranch());
       
        File gitDir = git.getRepository().getDirectory();
        File gitConfig = new File(gitDir, "config");

        assertTrue(gitConfig.exists());

        String configText = new String(IO.readFully(gitConfig));

        assertTrue(configText.contains("[gitflow \"branch\"]"));
        assertTrue(configText.contains("[gitflow \"prefix\"]"));

        assertEquals("master", flow.getMasterBranchName());
        assertEquals("develop", flow.getDevelopBranchName());
        assertEquals("feature/", flow.getFeatureBranchPrefix());
        assertEquals("release/", flow.getReleaseBranchPrefix());
        assertEquals("hotfix/", flow.getHotfixBranchPrefix());
        assertEquals("support/", flow.getSupportBranchPrefix());
        assertEquals("", flow.getVersionTagPrefix());

    }
View Full Code Here

Examples of com.atlassian.jgitflow.core.JGitFlow

        InitContext ctx = new InitContext();
        ctx.setMaster("own").setDevelop("you");

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

        flow.git().checkout().setName(flow.getDevelopBranchName()).call();
        assertEquals(flow.getDevelopBranchName(), flow.git().getRepository().getBranch());
       
        File gitDir = git.getRepository().getDirectory();
        File gitConfig = new File(gitDir, "config");

        assertTrue(gitConfig.exists());

        String configText = new String(IO.readFully(gitConfig));

        assertTrue(configText.contains("[gitflow \"branch\"]"));
        assertTrue(configText.contains("[gitflow \"prefix\"]"));


        assertEquals("own", flow.getMasterBranchName());
        assertEquals("you", flow.getDevelopBranchName());
        assertEquals("feature/", flow.getFeatureBranchPrefix());
        assertEquals("release/", flow.getReleaseBranchPrefix());
        assertEquals("hotfix/", flow.getHotfixBranchPrefix());
        assertEquals("support/", flow.getSupportBranchPrefix());
        assertEquals("", flow.getVersionTagPrefix());

    }
View Full Code Here

Examples of com.atlassian.jgitflow.core.JGitFlow

        File workDir = newDir();
        remoteGit = RepoUtil.createRepositoryWithMaster(newDir());
        gfGit = Git.cloneRepository().setDirectory(workDir).setURI("file://" + remoteGit.getRepository().getWorkTree().getPath()).call();
        JGitFlowInitCommand initCommand = new JGitFlowInitCommand();
        JGitFlow flow = initCommand.setDirectory(gfGit.getRepository().getWorkTree()).call();

        flow.git().checkout().setName("develop").call();
        assertEquals(flow.getDevelopBranchName(), flow.git().getRepository().getBranch());
       
        File gitDir = gfGit.getRepository().getDirectory();
        File gitConfig = new File(gitDir, "config");

        assertTrue(gitConfig.exists());

        String configText = new String(IO.readFully(gitConfig));

        assertTrue(configText.contains("[gitflow \"branch\"]"));
        assertTrue(configText.contains("[gitflow \"prefix\"]"));


        assertEquals("master", flow.getMasterBranchName());
        assertEquals("develop", flow.getDevelopBranchName());
        assertEquals("feature/", flow.getFeatureBranchPrefix());
        assertEquals("release/", flow.getReleaseBranchPrefix());
        assertEquals("hotfix/", flow.getHotfixBranchPrefix());
        assertEquals("support/", flow.getSupportBranchPrefix());
        assertEquals("", flow.getVersionTagPrefix());

    }
View Full Code Here

Examples of com.atlassian.jgitflow.core.JGitFlow

        ctx.setMaster("own").setDevelop("you");

        remoteGit = RepoUtil.createRepositoryWithMaster(newDir());
        gfGit = Git.cloneRepository().setDirectory(workDir).setURI("file://" + remoteGit.getRepository().getWorkTree().getPath()).call();
        JGitFlowInitCommand initCommand = new JGitFlowInitCommand();
        JGitFlow flow = initCommand.setDirectory(gfGit.getRepository().getWorkTree()).setInitContext(ctx).call();

        flow.git().checkout().setName(flow.getDevelopBranchName()).call();
        assertEquals(flow.getDevelopBranchName(), flow.git().getRepository().getBranch());
       
        File gitDir = gfGit.getRepository().getDirectory();
        File gitConfig = new File(gitDir, "config");

        assertTrue(gitConfig.exists());

        String configText = new String(IO.readFully(gitConfig));

        assertTrue(configText.contains("[gitflow \"branch\"]"));
        assertTrue(configText.contains("[gitflow \"prefix\"]"));


        assertEquals("own", flow.getMasterBranchName());
        assertEquals("you", flow.getDevelopBranchName());
        assertEquals("feature/", flow.getFeatureBranchPrefix());
        assertEquals("release/", flow.getReleaseBranchPrefix());
        assertEquals("hotfix/", flow.getHotfixBranchPrefix());
        assertEquals("support/", flow.getSupportBranchPrefix());
        assertEquals("", flow.getVersionTagPrefix());

    }
View Full Code Here

Examples of com.atlassian.jgitflow.core.JGitFlow

        ctx.setMaster("own").setDevelop("you");

        remoteGit = RepoUtil.createRepositoryWithBranches(newDir(), "own");
        gfGit = Git.cloneRepository().setDirectory(workDir).setURI("file://" + remoteGit.getRepository().getWorkTree().getPath()).call();
        JGitFlowInitCommand initCommand = new JGitFlowInitCommand();
        JGitFlow flow = initCommand.setDirectory(gfGit.getRepository().getWorkTree()).setInitContext(ctx).call();

        flow.git().checkout().setName(flow.getDevelopBranchName()).call();
        assertEquals(flow.getDevelopBranchName(), flow.git().getRepository().getBranch());
       
        File gitDir = gfGit.getRepository().getDirectory();
        File gitConfig = new File(gitDir, "config");

        assertTrue(gitConfig.exists());

        String configText = new String(IO.readFully(gitConfig));

        assertTrue(configText.contains("[gitflow \"branch\"]"));
        assertTrue(configText.contains("[gitflow \"prefix\"]"));


        assertEquals("own", flow.getMasterBranchName());
        assertEquals("you", flow.getDevelopBranchName());
        assertEquals("feature/", flow.getFeatureBranchPrefix());
        assertEquals("release/", flow.getReleaseBranchPrefix());
        assertEquals("hotfix/", flow.getHotfixBranchPrefix());
        assertEquals("support/", flow.getSupportBranchPrefix());
        assertEquals("", flow.getVersionTagPrefix());

    }
View Full Code Here

Examples of com.atlassian.jgitflow.core.JGitFlow

    {
        Git git = null;

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

        File gitDir = git.getRepository().getDirectory();
        File gitConfig = new File(gitDir, "config");

        assertTrue(gitConfig.exists());

        //try to re-init
        JGitFlowInitCommand initCommand2 = new JGitFlowInitCommand();

        //this should NOT throw
        initCommand2.setDirectory(git.getRepository().getWorkTree()).setForce(true).call();

        String configText = new String(IO.readFully(gitConfig));

        assertTrue(configText.contains("[gitflow \"branch\"]"));
        assertTrue(configText.contains("[gitflow \"prefix\"]"));


        assertEquals("master", flow.getMasterBranchName());
        assertEquals("develop", flow.getDevelopBranchName());
        assertEquals("feature/", flow.getFeatureBranchPrefix());
        assertEquals("release/", flow.getReleaseBranchPrefix());
        assertEquals("hotfix/", flow.getHotfixBranchPrefix());
        assertEquals("support/", flow.getSupportBranchPrefix());
        assertEquals("", flow.getVersionTagPrefix());

    }
View Full Code Here

Examples of com.atlassian.jgitflow.core.JGitFlow

        InitContext ctx = new InitContext();
        ctx.setMaster("own").setDevelop("you");
        git = RepoUtil.createRepositoryWithMaster(newDir());
        JGitFlowInitCommand initCommand = new JGitFlowInitCommand();
        JGitFlow flow = initCommand.setDirectory(git.getRepository().getWorkTree()).call();

        File gitDir = git.getRepository().getDirectory();
        File gitConfig = new File(gitDir, "config");

        assertTrue(gitConfig.exists());

        //try to re-init
        JGitFlowInitCommand initCommand2 = new JGitFlowInitCommand();

        //this should NOT throw
        JGitFlow flow2 = initCommand2.setDirectory(git.getRepository().getWorkTree()).setForce(true).setInitContext(ctx).call();

        String configText = new String(IO.readFully(gitConfig));

        assertTrue(configText.contains("[gitflow \"branch\"]"));
        assertTrue(configText.contains("[gitflow \"prefix\"]"));

        //here we check the new instance
        assertEquals("own", flow2.getMasterBranchName());

        //now let's make sure the old instance also sees the config changes
        assertEquals("you", flow.getDevelopBranchName());
        assertEquals("feature/", flow.getFeatureBranchPrefix());
        assertEquals("release/", flow.getReleaseBranchPrefix());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.