@Override
 public Object execute(ExecutionEvent event) throws ExecutionException {
   final Repository repository = getRepository(true, event);
   if (repository == null) return null;
   BranchOperationUI.rename(repository).start();
   return null;
 }
Exemplo n.º 2
0
  /**
   * @param newRefName
   * @param checkoutNewBranch
   * @param monitor
   * @throws CoreException
   * @throws IOException
   */
  public void createBranch(String newRefName, boolean checkoutNewBranch, IProgressMonitor monitor)
      throws CoreException, IOException {
    monitor.beginTask(UIText.CreateBranchPage_CreatingBranchMessage, IProgressMonitor.UNKNOWN);

    final CreateLocalBranchOperation cbop;

    if (myBaseCommit != null && this.sourceRefName.equals(myBaseCommit.name()))
      cbop = new CreateLocalBranchOperation(myRepository, newRefName, myBaseCommit);
    else
      cbop =
          new CreateLocalBranchOperation(
              myRepository, newRefName, myRepository.getRef(this.sourceRefName), upstreamConfig);

    cbop.execute(monitor);

    if (checkoutNewBranch) {
      if (monitor.isCanceled()) return;
      monitor.beginTask(UIText.CreateBranchPage_CheckingOutMessage, IProgressMonitor.UNKNOWN);
      BranchOperationUI.checkout(myRepository, Constants.R_HEADS + newRefName).run(monitor);
    }
  }
Exemplo n.º 3
0
  private void checkout(RevCommit commit, IProgressMonitor monitor) throws CoreException {
    monitor.setTaskName(UIText.FetchGerritChangePage_CheckingOutTaskName);
    BranchOperationUI.checkout(repository, commit.name()).run(monitor);

    monitor.worked(1);
  }