protected void makeVcsRootPreliminaryMerge()

in teamcity-premerge-agent/src/main/java/jetbrains/buildServer/premerge/PremergeBuildProcess.java [99:127]


  protected void makeVcsRootPreliminaryMerge(VcsRoot root, String repoRelativePath) throws VcsException {
    PremergeBranchSupport branchSupport = createPremergeBranchSupport(root, repoRelativePath);

    String premergeBranch = branchSupport.constructBranchName();
    getBuild().getBuildLogger().message("> " + root.getName());

    String rootBranch = getBuild().getSharedConfigParameters().get(GitUtils.getGitRootBranchParamName(root));
    if (PremergeBranchSupport.cutRefsHeads(rootBranch).equals(targetBranch)) {
      getBuild().getBuildLogger().warning("Current branch is the same as the target branch. Skipping VcsRoot.");
    }
    else {
      try {
        branchSupport.fetch(targetBranch);
      } catch (VcsException e) {
        unsuccessfulFetchesCount++;
        return;
      }

      try {
        branchSupport.createBranch(premergeBranch);
        branchSupport.checkout(premergeBranch);
        branchSupport.merge(targetBranch);
        targetSHAs.put(root.getExternalId(), branchSupport.getParameter(targetBranch));
      } catch (VcsException ex) {
        setUnsuccess();
        throw ex;
      }
    }
  }