Codota Logo
DeleteBranchCommand
Code IndexAdd Codota to your IDE (free)

How to use
DeleteBranchCommand
in
org.eclipse.jgit.api

Best Java code snippets using org.eclipse.jgit.api.DeleteBranchCommand (Showing top 20 results out of 315)

  • Common ways to obtain DeleteBranchCommand
private void myMethod () {
DeleteBranchCommand d =
  • Codota IconRepository repo;new DeleteBranchCommand(repo)
  • Codota IconGit git;git.branchDelete()
  • Smart code suggestions by Codota
}
origin: gocd/gocd

void deleteBranch(String branchName) throws GitAPIException {
  try {
    git.branchDelete().setBranchNames(branchName).setForce(true).call();
  } catch (GitAPIException e) {
    LOGGER.error("[CONFIG_MERGE] Failed to delete branch {}", branchName, e);
    throw e;
  }
}
origin: org.eclipse.jgit/org.eclipse.jgit

/**
 * Return a command object used to delete branches
 *
 * @return a {@link org.eclipse.jgit.api.DeleteBranchCommand}
 */
public DeleteBranchCommand branchDelete() {
  return new DeleteBranchCommand(repo);
}
origin: org.eclipse.jgit/org.eclipse.jgit

  /**
   * Set whether to forcefully delete branches
   *
   * @param force
   *            <code>true</code> corresponds to the -D option,
   *            <code>false</code> to the -d option (default) <br>
   *            if <code>false</code> a check will be performed whether the
   *            branch to be deleted is already merged into the current branch
   *            and deletion will be refused in this case
   * @return this instance
   */
  public DeleteBranchCommand setForce(boolean force) {
    checkCallable();
    this.force = force;
    return this;
  }
}
origin: jphp-group/jphp

@Signature
public List<String> branchDelete(String[] names, boolean force) throws GitAPIException {
  DeleteBranchCommand command = getWrappedObject().branchDelete();
  command.setBranchNames(names);
  return command.call();
}
origin: org.eclipse.jgit/org.eclipse.jgit

public List<String> call() throws GitAPIException,
    NotMergedException, CannotDeleteCurrentBranchException {
  checkCallable();
  List<String> result = new ArrayList<>();
  if (branchNames.isEmpty())
    setCallable(false);
    for (String branchName : branchNames) {
      if (branchName == null)
origin: org.apache.camel/camel-git

protected void doDeleteBranch(Exchange exchange, String operation) throws Exception {
  if (ObjectHelper.isEmpty(endpoint.getBranchName())) {
    throw new IllegalArgumentException("Branch Name must be specified to execute " + operation);
  }
  try {
    git.branchDelete().setBranchNames(endpoint.getBranchName()).call();
  } catch (Exception e) {
    LOG.error("There was an error in Git {} operation", operation);
    throw e;
  }
}
origin: sonia.jgit/org.eclipse.jgit

checkCallable();
List<String> result = new ArrayList<String>();
if (branchNames.isEmpty())
  setCallable(false);
  for (String branchName : branchNames) {
    if (branchName == null)
origin: spring-cloud/spring-cloud-config

private List<String> deleteBranches(Git git, Collection<String> branchesToDelete) throws GitAPIException {
  DeleteBranchCommand deleteBranchCommand = git.branchDelete()
      .setBranchNames(branchesToDelete.toArray(new String[0]))
      //local branch can contain data which is not merged to HEAD - force delete it anyway, since local copy should be R/O
      .setForce(true);
  List<String> resultList = deleteBranchCommand.call();
  logger.info(format("Deleted %s branches from %s branches to delete.", resultList, branchesToDelete));
  return resultList;
}
origin: org.hudsonci.plugins/git

public void deleteBranch(String name) throws GitException {
  verifyGitRepository();
  try {
    jGitDelegate.branchDelete().setBranchNames(name).call();
  } catch (GitAPIException e) {
    throw new GitException(Messages.GitAPI_Branch_DeleteErrorMsg(name), e);
  }
}
origin: berlam/github-bucket

public List<String> call() throws GitAPIException,
    NotMergedException, CannotDeleteCurrentBranchException {
  checkCallable();
  List<String> result = new ArrayList<>();
  if (branchNames.isEmpty())
    setCallable(false);
    for (String branchName : branchNames) {
      if (branchName == null)
origin: org.eclipse.jgit/org.eclipse.jgit

/**
 * Set the names of the branches to delete
 *
 * @param branchnames
 *            the names of the branches to delete; if not set, this will do
 *            nothing; invalid branch names will simply be ignored
 * @return this instance
 */
public DeleteBranchCommand setBranchNames(String... branchnames) {
  checkCallable();
  this.branchNames.clear();
  for (String branch : branchnames)
    this.branchNames.add(branch);
  return this;
}
origin: sonia.jgit/org.eclipse.jgit

/**
 * Returns a command object used to delete branches
 *
 * @return a {@link DeleteBranchCommand}
 */
public DeleteBranchCommand branchDelete() {
  return new DeleteBranchCommand(repo);
}
origin: centic9/jgit-cookbook

System.out.println("Removing branch before");
git.branchDelete()
.setBranchNames("testbranch")
.setForce(true)
.call();
.setBranchNames("testbranch")
.call();
origin: sonia.jgit/org.eclipse.jgit

  /**
   * @param force
   *            <code>true</code> corresponds to the -D option,
   *            <code>false</code> to the -d option (default) <br>
   *            if <code>false</code> a check will be performed whether the
   *            branch to be deleted is already merged into the current branch
   *            and deletion will be refused in this case
   * @return this instance
   */
  public DeleteBranchCommand setForce(boolean force) {
    checkCallable();
    this.force = force;
    return this;
  }
}
origin: berlam/github-bucket

/**
 * Return a command object used to delete branches
 *
 * @return a {@link org.eclipse.jgit.api.DeleteBranchCommand}
 */
public DeleteBranchCommand branchDelete() {
  return new DeleteBranchCommand(repo);
}
origin: centic9/jgit-cookbook

System.out.println("Removing branch before");
git.branchDelete()
.setBranchNames("testbranch")
.setForce(true)
.call();
.setBranchNames("testbranch")
.call();
origin: berlam/github-bucket

  /**
   * Set whether to forcefully delete branches
   *
   * @param force
   *            <code>true</code> corresponds to the -D option,
   *            <code>false</code> to the -d option (default) <br>
   *            if <code>false</code> a check will be performed whether the
   *            branch to be deleted is already merged into the current branch
   *            and deletion will be refused in this case
   * @return this instance
   */
  public DeleteBranchCommand setForce(boolean force) {
    checkCallable();
    this.force = force;
    return this;
  }
}
origin: com.meltmedia.cadmium/cadmium-core

public void deleteLocalBranch(String branchName) throws Exception {
 git.branchDelete().setForce(true).setBranchNames(branchName).call();
}

origin: sonia.jgit/org.eclipse.jgit

/**
 * @param branchnames
 *            the names of the branches to delete; if not set, this will do
 *            nothing; invalid branch names will simply be ignored
 * @return this instance
 */
public DeleteBranchCommand setBranchNames(String... branchnames) {
  checkCallable();
  this.branchNames.clear();
  for (String branch : branchnames)
    this.branchNames.add(branch);
  return this;
}
origin: org.openmrs.maven.plugins/openmrs-sdk-maven-plugin

/**
 * Delete branch
 * @param git
 * @throws GitAPIException
 */
private void deleteTempBranch(Git git, String branchName) throws Exception {
  try {
    git.branchDelete()
        .setForce(true)
        .setBranchNames(branchName)
        .call();
  } catch (GitAPIException e) {
    throw new Exception(DELETING_BRANCH_REASON, e);
  }
}
org.eclipse.jgit.apiDeleteBranchCommand

Javadoc

Used to delete one or several branches. The result of #call() is a list with the (full) names of the deleted branches. Note that we don't have a setter corresponding to the -r option; remote tracking branches are simply deleted just like local branches.

Most used methods

  • call
  • setBranchNames
    Set the names of the branches to delete
  • setForce
    Set whether to forcefully delete branches
  • <init>
    Constructor for DeleteBranchCommand
  • checkCallable
  • setCallable

Popular in Java

  • Running tasks concurrently on multiple threads
  • addToBackStack (FragmentTransaction)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • requestLocationUpdates (LocationManager)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Runner (org.openjdk.jmh.runner)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now