Package com.atlassian.maven.plugins.jgitflow.exception

Examples of com.atlassian.maven.plugins.jgitflow.exception.MavenJGitFlowException


        {
            flow = jGitFlowProvider.gitFlow();
        }
        catch (JGitFlowException e)
        {
            throw new MavenJGitFlowException(e);
        }

        ReleaseContext ctx = contextProvider.getContext();

        String featureName = StringUtils.defaultString(ctx.getDefaultFeatureName());

        if (StringUtils.isBlank(featureName))
        {
            String currentBranch = null;

            try
            {
                currentBranch = flow.git().getRepository().getBranch();
                getLogger().debug("Current Branch is: " + currentBranch);
            }
            catch (IOException e)
            {
                throw new MavenJGitFlowException(e);
            }

            getLogger().debug("Feature Prefix is: " + flow.getFeatureBranchPrefix());
            getLogger().debug("Branch starts with feature prefix?: " + currentBranch.startsWith(flow.getFeatureBranchPrefix()));
            if (currentBranch.startsWith(flow.getFeatureBranchPrefix()))
            {
                featureName = currentBranch.replaceFirst(flow.getFeatureBranchPrefix(), "");
            }
        }

        if (ctx.isInteractive())
        {
            List<String> possibleValues = new ArrayList<String>();
            if (null == featureName)
            {
                featureName = "";
            }

            try
            {
                String rheadPrefix = Constants.R_HEADS + flow.getFeatureBranchPrefix();
                String rOriginPrefix = JGitFlowConstants.R_REMOTE_ORIGIN + flow.getFeatureBranchPrefix();
               
                List<Ref> branches = GitHelper.listBranchesWithPrefix(flow.git(), flow.getFeatureBranchPrefix(), flow.getReporter());

                for (Ref branch : branches)
                {
                    String simpleName = "";
                   
                    if(branch.getName().contains(rheadPrefix))
                    {
                        simpleName = branch.getName().substring(branch.getName().indexOf(rheadPrefix) + rheadPrefix.length());
                    }

                    if(branch.getName().contains(rOriginPrefix))
                    {
                        simpleName = branch.getName().substring(branch.getName().indexOf(rOriginPrefix) + rOriginPrefix.length());
                    }
                   
                    if(!Strings.isNullOrEmpty(simpleName) && !possibleValues.contains(simpleName))
                    {
                        possibleValues.add(simpleName);
                    }
                }

                featureName = promptForExistingFeatureName(flow.getFeatureBranchPrefix(), featureName, possibleValues);
            }
            catch (JGitFlowGitAPIException e)
            {
                throw new MavenJGitFlowException("Unable to determine feature names", e);
            }
        }
        else
        {
            if (StringUtils.isBlank(featureName))
            {
                throw new MavenJGitFlowException("Missing featureName mojo option.");
            }
        }

        return featureName;
    }
View Full Code Here


                case HOTFIX:
                    branchPrefix = flow.getHotfixBranchPrefix();
                    break;

                default:
                    throw new MavenJGitFlowException("Unsupported branch type '" + branchType.name() + "' while trying to get the current production branch label");
            }

            List<Ref> productionBranches = GitHelper.listBranchesWithPrefix(flow.git(), branchPrefix, flow.getReporter());

            if (productionBranches.isEmpty())
            {
                throw new MavenJGitFlowException("Could not find current production branch of type " + branchType.name());
            }
           
            String rheadPrefix = Constants.R_HEADS + branchPrefix;
            String rOriginPrefix = JGitFlowConstants.R_REMOTE_ORIGIN + branchPrefix;
            Ref productionBranch = productionBranches.get(0);
           
            if(productionBranch.getName().contains(rheadPrefix))
            {
                return productionBranch.getName().substring(productionBranch.getName().indexOf(rheadPrefix) + rheadPrefix.length());
            }

            if(productionBranch.getName().contains(rOriginPrefix))
            {
                return productionBranch.getName().substring(productionBranch.getName().indexOf(rOriginPrefix) + rOriginPrefix.length());
            }
           
            throw new JGitFlowException(productionBranch.getName() + " does not match " + rheadPrefix + " or " + rOriginPrefix);
        }
        catch (JGitFlowException e)
        {
            throw new MavenJGitFlowException("Error looking up current production branch label:" + e.getMessage(), e);
        }
    }
View Full Code Here

        {
            name = prompter.promptNotBlank(message, defaultFeatureName);
        }
        catch (PrompterException e)
        {
            throw new MavenJGitFlowException("Error reading feature name from command line " + e.getMessage(), e);
        }

        return name;
    }
View Full Code Here

        {
            name = prompter.promptNumberedList(message, featureBranches, defaultFeatureName);
        }
        catch (PrompterException e)
        {
            throw new MavenJGitFlowException("Error reading feature name from command line " + e.getMessage(), e);
        }

        return name;
    }
View Full Code Here

                .setExtension(startExtension)
                .call();
        }
        catch (JGitFlowException e)
        {
            throw new MavenJGitFlowException("Error starting release: " + e.getMessage(), e);
        }
        finally
        {
            if (null != flow)
            {
View Full Code Here

                    getLogger().error("Error merging into " + flow.getDevelopBranchName() + ":");
                    getLogger().error(mergeResult.getDevelopResult().toString());
                    getLogger().error("see .git/jgitflow.log for more info");
                }

                throw new MavenJGitFlowException("Error while merging release!");
            }
           
        }
        catch (JGitFlowException e)
        {
            throw new MavenJGitFlowException("Error finishing release: " + e.getMessage(), e);
        }
        finally
        {
            if (null != flow)
            {
View Full Code Here

           
            return branchSession.getSortedProjects();
        }
        catch (Exception e)
        {
            throw new MavenJGitFlowException("Error checking out branch and loading projects", e);
        }
    }
View Full Code Here

           
            return new SessionAndProjects(branchSession,branchSession.getSortedProjects());
        }
        catch (Exception e)
        {
            throw new MavenJGitFlowException("Error checking out branch and loading projects", e);
        }
    }
View Full Code Here

                }
            }
        }
        catch (Exception e)
        {
            throw new MavenJGitFlowException("Error verifying initial version state in poms: " + e.getMessage(), e);
        }
    }
View Full Code Here

            JGitFlow flow = jGitFlowProvider.gitFlow();
            return flow.git().getRepository().getBranch();
        }
        catch (Exception e)
        {
            throw new MavenJGitFlowException("Error looking up current branch name", e);
        }
    }
View Full Code Here

TOP

Related Classes of com.atlassian.maven.plugins.jgitflow.exception.MavenJGitFlowException

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.