/** * Requires that a remote branch with the given name exists * * @param branch The name of the branch to test * @throws com.atlassian.jgitflow.core.exception.RemoteBranchMissingException * @throws com.atlassian.jgitflow.core.exception.JGitFlowGitAPIException */ public void requireRemoteBranchExists(String branch) throws RemoteBranchMissingException, JGitFlowGitAPIException { if (!GitHelper.remoteBranchExists(git, branch)) { reporter.errorText(commandName, "requireRemoteBranchExists() failed: '" + branch + "' does not exist"); reporter.flush(); throw new RemoteBranchMissingException("remote branch " + branch + " does not exist"); } }
/** * Requires that a tag with the given name does not yet exist * * @param name The name of the tag to test * @throws com.atlassian.jgitflow.core.exception.TagExistsException * @throws com.atlassian.jgitflow.core.exception.JGitFlowGitAPIException */ public void requireTagAbsent(String name) throws TagExistsException, JGitFlowGitAPIException { if (GitHelper.tagExists(git, name)) { reporter.errorText(commandName, "requireTagAbsent() failed: '" + name + "' already exists"); reporter.flush(); throw new TagExistsException("tag '" + name + "' already exists"); } }
/** * Requires that a local branch with the given name does not yet exist * * @param branch the name of the branch to test * @throws com.atlassian.jgitflow.core.exception.LocalBranchExistsException * @throws com.atlassian.jgitflow.core.exception.JGitFlowGitAPIException */ public void requireLocalBranchAbsent(String branch) throws LocalBranchExistsException, JGitFlowGitAPIException { if (GitHelper.localBranchExists(git, branch)) { reporter.errorText(commandName, "requireLocalBranchAbsent() failed: '" + branch + "' already exists"); reporter.flush(); throw new LocalBranchExistsException("local branch '" + branch + "' already exists"); } }
throw new LocalBranchMissingException("commit " + commitId + " does not exist"); throw new JGitFlowIOException(e);
/** * Requires that the local branch with the given name is not behind a remote brach with the same name * * @param branch The name of the branch to test * @throws com.atlassian.jgitflow.core.exception.BranchOutOfDateException * @throws com.atlassian.jgitflow.core.exception.JGitFlowIOException */ public void requireLocalBranchNotBehindRemote(String branch) throws BranchOutOfDateException, JGitFlowIOException { reporter.debugMethod(commandName, "requireLocalBranchNotBehindRemote"); boolean behind = GitHelper.localBranchBehindRemote(git, branch); if (behind) { reporter.errorText(commandName, "local branch '" + branch + "' is behind the remote branch"); reporter.endMethod(); reporter.flush(); throw new BranchOutOfDateException("local branch '" + branch + "' is behind the remote branch"); } reporter.endMethod(); }
/** * Requires that a remote branch with the given name does not yet exist * * @param branch The name of the branch to test * @throws com.atlassian.jgitflow.core.exception.RemoteBranchExistsException * @throws com.atlassian.jgitflow.core.exception.JGitFlowGitAPIException */ public void requireRemoteBranchAbsent(String branch) throws RemoteBranchExistsException, JGitFlowGitAPIException { if (GitHelper.remoteBranchExists(git, branch)) { reporter.errorText(commandName, "requireRemoteBranchAbsent() failed: '" + branch + "' already exists"); reporter.flush(); throw new RemoteBranchExistsException("remote branch '" + branch + "' already exists"); } }
/** * Requires that a local branch with the given name exists * @param branch The name of the branch to test * @throws LocalBranchMissingException * @throws JGitFlowGitAPIException */ protected void requireLocalBranchExists(String branch) throws LocalBranchMissingException, JGitFlowGitAPIException { if (!GitHelper.localBranchExists(git, branch)) { reporter.errorText(getCommandName(), "localBranchExists() failed: '" + branch + "' does not exist"); reporter.flush(); throw new LocalBranchMissingException("local branch " + branch + " does not exist"); } }
throw new LocalBranchMissingException("commit " + commitId + " does not exist"); throw new JGitFlowIOException(e);
/** * Requires that a local branch with the given name does not yet exist * * @param branch the name of the branch to test * @throws com.atlassian.jgitflow.core.exception.LocalBranchExistsException * @throws com.atlassian.jgitflow.core.exception.JGitFlowGitAPIException */ public void requireLocalBranchAbsent(String branch) throws LocalBranchExistsException, JGitFlowGitAPIException { if (GitHelper.localBranchExists(git, branch)) { reporter.errorText(commandName, "requireLocalBranchAbsent() failed: '" + branch + "' already exists"); reporter.flush(); throw new LocalBranchExistsException("local branch '" + branch + "' already exists"); } }
/** * Requires that the local branch with the given name is not behind a remote brach with the same name * * @param branch The name of the branch to test * @throws com.atlassian.jgitflow.core.exception.BranchOutOfDateException * @throws com.atlassian.jgitflow.core.exception.JGitFlowIOException */ public void requireLocalBranchNotBehindRemote(String branch) throws BranchOutOfDateException, JGitFlowIOException { reporter.debugMethod(commandName, "requireLocalBranchNotBehindRemote"); boolean behind = GitHelper.localBranchBehindRemote(git, branch); if (behind) { reporter.errorText(commandName, "local branch '" + branch + "' is behind the remote branch"); reporter.endMethod(); reporter.flush(); throw new BranchOutOfDateException("local branch '" + branch + "' is behind the remote branch"); } reporter.endMethod(); }
/** * Requires that a remote branch with the given name exists * * @param branch The name of the branch to test * @throws com.atlassian.jgitflow.core.exception.RemoteBranchMissingException * @throws com.atlassian.jgitflow.core.exception.JGitFlowGitAPIException */ public void requireRemoteBranchExists(String branch) throws RemoteBranchMissingException, JGitFlowGitAPIException { if (!GitHelper.remoteBranchExists(git, branch)) { reporter.errorText(commandName, "requireRemoteBranchExists() failed: '" + branch + "' does not exist"); reporter.flush(); throw new RemoteBranchMissingException("remote branch " + branch + " does not exist"); } }
/** * Requires that a tag with the given name does not yet exist * * @param name The name of the tag to test * @throws com.atlassian.jgitflow.core.exception.TagExistsException * @throws com.atlassian.jgitflow.core.exception.JGitFlowGitAPIException */ public void requireTagAbsent(String name) throws TagExistsException, JGitFlowGitAPIException { if (GitHelper.tagExists(git, name)) { reporter.errorText(commandName, "requireTagAbsent() failed: '" + name + "' already exists"); reporter.flush(); throw new TagExistsException("tag '" + name + "' already exists"); } }
/** * Requires that a remote branch with the given name does not yet exist * * @param branch The name of the branch to test * @throws com.atlassian.jgitflow.core.exception.RemoteBranchExistsException * @throws com.atlassian.jgitflow.core.exception.JGitFlowGitAPIException */ public void requireRemoteBranchAbsent(String branch) throws RemoteBranchExistsException, JGitFlowGitAPIException { if (GitHelper.remoteBranchExists(git, branch)) { reporter.errorText(commandName, "requireRemoteBranchAbsent() failed: '" + branch + "' already exists"); reporter.flush(); throw new RemoteBranchExistsException("remote branch '" + branch + "' already exists"); } }
throw new LocalBranchMissingException("commit " + commitId + " does not exist"); throw new JGitFlowIOException(e);
/** * Requires that a local branch with the given name does not yet exist * @param branch the name of the branch to test * @throws LocalBranchExistsException * @throws JGitFlowGitAPIException */ protected void requireLocalBranchAbsent(String branch) throws LocalBranchExistsException, JGitFlowGitAPIException { if (GitHelper.localBranchExists(git, branch)) { reporter.errorText(getCommandName(), "requireLocalBranchAbsent() failed: '" + branch + "' already exists"); reporter.flush(); throw new LocalBranchExistsException("local branch '" + branch + "' already exists"); } }
/** * Requires that a remote branch with the given name exists * @param branch The name of the branch to test * @throws RemoteBranchMissingException * @throws JGitFlowGitAPIException */ protected void requireRemoteBranchExists(String branch) throws RemoteBranchMissingException, JGitFlowGitAPIException { if (!GitHelper.remoteBranchExists(git, branch, reporter)) { reporter.errorText(getCommandName(), "requireRemoteBranchExists() failed: '" + branch + "' does not exist"); reporter.flush(); throw new RemoteBranchMissingException("remote branch " + branch + " does not exist"); } }
/** * Requires that a tag with the given name does not yet exist * @param name The name of the tag to test * @throws TagExistsException * @throws JGitFlowGitAPIException */ protected void requireTagAbsent(String name) throws TagExistsException, JGitFlowGitAPIException { if (GitHelper.tagExists(git, name)) { reporter.errorText(getCommandName(), "requireTagAbsent() failed: '" + name + "' already exists"); reporter.flush(); throw new TagExistsException("tag '" + name + "' already exists"); } }
/** * Requires that a remote branch with the given name does not yet exist * @param branch The name of the branch to test * @throws RemoteBranchExistsException * @throws JGitFlowGitAPIException */ protected void requireRemoteBranchAbsent(String branch) throws RemoteBranchExistsException, JGitFlowGitAPIException { if (GitHelper.remoteBranchExists(git, branch, reporter)) { reporter.errorText(getCommandName(), "requireRemoteBranchAbsent() failed: '" + branch + "' already exists"); reporter.flush(); throw new RemoteBranchExistsException("remote branch '" + branch + "' already exists"); } }
/** * Requires that a local branch contains the given commit * * @param commit the commit to test * @param branch the name of the branch to check */ public void requireCommitOnBranch(RevCommit commit, String branch) throws LocalBranchExistsException, JGitFlowGitAPIException, JGitFlowIOException { if (!GitHelper.isMergedInto(git, commit, branch)) { reporter.errorText(commandName, "requireCommitOnBranch() failed: '" + commit.getName() + "' is not on " + branch); reporter.flush(); throw new LocalBranchExistsException("commit '" + commit.getName() + "' does not exist on " + branch); } } }
/** * Requires that a local branch contains the given commit * * @param commit the commit to test * @param branch the name of the branch to check */ public void requireCommitOnBranch(RevCommit commit, String branch) throws LocalBranchExistsException, JGitFlowGitAPIException, JGitFlowIOException { if (!GitHelper.isMergedInto(git, commit, branch)) { reporter.errorText(commandName, "requireCommitOnBranch() failed: '" + commit.getName() + "' is not on " + branch); reporter.flush(); throw new LocalBranchExistsException("commit '" + commit.getName() + "' does not exist on " + branch); } } }