Package com.atlassian.jgitflow.core.exception

Examples of com.atlassian.jgitflow.core.exception.MergeConflictsNotResolvedException


                    mergeBase.delete();
                }
            }
            else
            {
                throw new MergeConflictsNotResolvedException("Merge conflicts are not resolved");
            }
        }
       
        //not restoring a merge, continue
        requireCleanWorkingTree();
       
        boolean remoteFeatureExists = GitHelper.remoteBranchExists(git,prefixedBranchName);

        //update from remote if needed
        if(remoteFeatureExists && fetchDevelop)
        {
            RefSpec branchSpec = new RefSpec("+" + Constants.R_HEADS + prefixedBranchName + ":" + Constants.R_REMOTES + "origin/" + prefixedBranchName);
            RefSpec developSpec = new RefSpec("+" + Constants.R_HEADS + gfConfig.getDevelop() + ":" + Constants.R_REMOTES + "origin/" + gfConfig.getDevelop());
            git.fetch().setRefSpecs(branchSpec).call();
            git.fetch().setRefSpecs(developSpec).call();
        }
       
        //make sure nothing is behind
        if(remoteFeatureExists)
        {
            requireLocalBranchNotBehindRemote(prefixedBranchName);
        }
       
        if(GitHelper.remoteBranchExists(git,gfConfig.getDevelop()))
        {
            requireLocalBranchNotBehindRemote(gfConfig.getDevelop());
        }
       
        if(rebase)
        {
            FeatureRebaseCommand rebaseCommand = new FeatureRebaseCommand(branchName,git,gfConfig);
            rebaseCommand.call();
        }
       
        //merge into base
        git.checkout().setName(gfConfig.getDevelop()).call();

        Ref featureBranch = GitHelper.getLocalBranch(git, prefixedBranchName);

        RevCommit developCommit = GitHelper.getLatestCommit(git,gfConfig.getDevelop());
        RevCommit featureCommit = GitHelper.getLatestCommit(git, prefixedBranchName);

        List<RevCommit> commitList = ImmutableList.copyOf(git.log().setMaxCount(2).addRange(developCommit,featureCommit).call());
       
        MergeResult mergeResult = null;
               
        if(commitList.size() < 2)
        {
            mergeResult = git.merge().setFastForward(MergeCommand.FastForwardMode.FF).include(featureBranch).call();
        }
        else
        {
            if(squash)
            {
                mergeResult = git.merge().setSquash(true).include(featureBranch).call();
                git.commit().call();
                this.forceDeleteBranch = true;
            }
            else
            {
                mergeResult = git.merge().setFastForward(MergeCommand.FastForwardMode.NO_FF).include(featureBranch).call();
            }
        }
       
        if(null == mergeResult || mergeResult.getMergeStatus().equals(MergeResult.MergeStatus.FAILED) || mergeResult.getMergeStatus().equals(MergeResult.MergeStatus.CONFLICTING))
        {
            Files.createParentDirs(mergeBase);
            Files.touch(mergeBase);
            Files.write(gfConfig.getDevelop(),mergeBase,Charset.forName("UTF-8"));
            throw new MergeConflictsNotResolvedException("merge conflicts exist, please resolve!");
        }

        cleanupBranch(prefixedBranchName);

        return null;
View Full Code Here

TOP

Related Classes of com.atlassian.jgitflow.core.exception.MergeConflictsNotResolvedException

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.