Beispiel #1
0
  /** {@inheritDoc} */
  @Override
  public void onCheckoutClicked() {
    String name = selectedBranch.getDisplayName();

    if (name == null) {
      return;
    }

    final CheckoutRequest checkoutRequest = dtoFactory.createDto(CheckoutRequest.class);
    if (selectedBranch.isRemote()) {
      checkoutRequest.setTrackBranch(selectedBranch.getDisplayName());
    } else {
      checkoutRequest.setName(selectedBranch.getDisplayName());
    }

    final ProjectConfigDto root = project.getRootProject();
    final String path = root.getPath();
    final String projectType = root.getType();

    service.checkout(
        workspaceId,
        root,
        checkoutRequest,
        new AsyncRequestCallback<String>() {
          @Override
          protected void onSuccess(String result) {
            getBranches();
            // In this case we can have unconfigured state of the project,
            // so we must repeat the logic which is performed when we open a project
            projectService.getProject(
                workspaceId,
                path,
                new AsyncRequestCallback<ProjectConfigDto>(
                    dtoUnmarshallerFactory.newUnmarshaller(ProjectConfigDto.class)) {
                  @Override
                  protected void onSuccess(ProjectConfigDto result) {
                    result.setType(projectType);
                    updateProject(result);
                  }

                  @Override
                  protected void onFailure(Throwable exception) {
                    notificationManager.notify(
                        exception.getLocalizedMessage(), FAIL, true, project.getProjectConfig());
                  }
                });
          }

          @Override
          protected void onFailure(Throwable exception) {
            final GitOutputConsole console =
                gitOutputConsoleFactory.create(BRANCH_CHECKOUT_COMMAND_NAME);
            printGitMessage(exception.getMessage(), console);
            consolesPanelPresenter.addCommandOutput(appContext.getDevMachineId(), console);
          }
        });
  }
 @Override
 public void checkout(CheckoutRequest request) throws GitException {
   ensureExistenceRepoRootInWorkingDirectory();
   nativeGit
       .createCheckoutCommand()
       .setBranchName(request.getName())
       .setStartPoint(request.getStartPoint())
       .setCreateNew(request.isCreateNew())
       .setTrackBranch(request.getTrackBranch())
       .setFilePaths(request.getFiles())
       .execute();
 }
Beispiel #3
0
 @Override
 public void checkout(CheckoutRequest request) throws GitException {
   nativeGit
       .createCheckoutCommand()
       .setBranchName(request.getName())
       .setStartPoint(request.getStartPoint())
       .setCreateNew(request.isCreateNew())
       .setTrackBranch(request.getTrackBranch())
       .setFilePaths(request.getFiles())
       .setNoTrack(request.isNoTrack())
       .execute();
 }