Package org.eclipse.jgit.errors

Examples of org.eclipse.jgit.errors.NoMergeBaseException


    final RevCommit base = walk.next();
    if (base == null)
      return null;
    final RevCommit base2 = walk.next();
    if (base2 != null) {
      throw new NoMergeBaseException(
          MergeBaseFailureReason.MULTIPLE_MERGE_BASES_NOT_SUPPORTED,
          MessageFormat.format(
          JGitText.get().multipleMergeBasesFor, a.name(), b.name(),
          base.name(), base2.name()));
    }
View Full Code Here


    if (baseCommits.isEmpty())
      return null;
    if (baseCommits.size() == 1)
      return baseCommits.get(0);
    if (baseCommits.size() >= MAX_BASES)
      throw new NoMergeBaseException(NoMergeBaseException.MergeBaseFailureReason.TOO_MANY_MERGE_BASES, MessageFormat.format(
          JGitText.get().mergeRecursiveTooManyMergeBasesFor,
          Integer.valueOf(MAX_BASES), a.name(), b.name(),
              Integer.valueOf(baseCommits.size())));

    // We know we have more than one base commit. We have to do merges now
    // to determine a single base commit. We don't want to spoil the current
    // dircache and working tree with the results of this intermediate
    // merges. Therefore set the dircache to a new in-memory dircache and
    // disable that we update the working-tree. We set this back to the
    // original values once a single base commit is created.
    RevCommit currentBase = baseCommits.get(0);
    DirCache oldDircache = dircache;
    boolean oldIncore = inCore;
    WorkingTreeIterator oldWTreeIt = workingTreeIterator;
    workingTreeIterator = null;
    try {
      dircache = dircacheFromTree(currentBase.getTree());
      inCore = true;

      List<RevCommit> parents = new ArrayList<RevCommit>();
      parents.add(currentBase);
      for (int commitIdx = 1; commitIdx < baseCommits.size(); commitIdx++) {
        RevCommit nextBase = baseCommits.get(commitIdx);
        if (commitIdx >= MAX_BASES)
          throw new NoMergeBaseException(
              NoMergeBaseException.MergeBaseFailureReason.TOO_MANY_MERGE_BASES,
              MessageFormat.format(
              JGitText.get().mergeRecursiveTooManyMergeBasesFor,
              Integer.valueOf(MAX_BASES), a.name(), b.name(),
                  Integer.valueOf(baseCommits.size())));
        parents.add(nextBase);
        if (mergeTrees(
            openTree(getBaseCommit(currentBase, nextBase,
                callDepth + 1).getTree()),
            currentBase.getTree(), nextBase.getTree(), true))
          currentBase = createCommitForTree(resultTree, parents);
        else
          throw new NoMergeBaseException(
              NoMergeBaseException.MergeBaseFailureReason.CONFLICTS_DURING_MERGE_BASE_CALCULATION,
              MessageFormat.format(
                  JGitText.get().mergeRecursiveConflictsWhenMergingCommonAncestors,
                  currentBase.getName(), nextBase.getName()));
      }
View Full Code Here

    if (baseCommits.isEmpty())
      return null;
    if (baseCommits.size() == 1)
      return baseCommits.get(0);
    if (baseCommits.size() >= MAX_BASES)
      throw new NoMergeBaseException(NoMergeBaseException.MergeBaseFailureReason.TOO_MANY_MERGE_BASES, MessageFormat.format(
          JGitText.get().mergeRecursiveTooManyMergeBasesFor,
          Integer.valueOf(MAX_BASES), a.name(), b.name(),
              Integer.valueOf(baseCommits.size())));

    // We know we have more than one base commit. We have to do merges now
    // to determine a single base commit. We don't want to spoil the current
    // dircache and working tree with the results of this intermediate
    // merges. Therefore set the dircache to a new in-memory dircache and
    // disable that we update the working-tree. We set this back to the
    // original values once a single base commit is created.
    RevCommit currentBase = baseCommits.get(0);
    DirCache oldDircache = dircache;
    boolean oldIncore = inCore;
    WorkingTreeIterator oldWTreeIt = workingTreeIterator;
    workingTreeIterator = null;
    try {
      dircache = dircacheFromTree(currentBase.getTree());
      inCore = true;

      List<RevCommit> parents = new ArrayList<RevCommit>();
      parents.add(currentBase);
      for (int commitIdx = 1; commitIdx < baseCommits.size(); commitIdx++) {
        RevCommit nextBase = baseCommits.get(commitIdx);
        if (commitIdx >= MAX_BASES)
          throw new NoMergeBaseException(
              NoMergeBaseException.MergeBaseFailureReason.TOO_MANY_MERGE_BASES,
              MessageFormat.format(
              JGitText.get().mergeRecursiveTooManyMergeBasesFor,
              Integer.valueOf(MAX_BASES), a.name(), b.name(),
                  Integer.valueOf(baseCommits.size())));
        parents.add(nextBase);
        if (mergeTrees(
            openTree(getBaseCommit(currentBase, nextBase,
                callDepth + 1).getTree()),
            currentBase.getTree(),
            nextBase.getTree()))
          currentBase = createCommitForTree(resultTree, parents);
        else
          throw new NoMergeBaseException(
              NoMergeBaseException.MergeBaseFailureReason.CONFLICTS_DURING_MERGE_BASE_CALCULATION,
              MessageFormat.format(
                  JGitText.get().mergeRecursiveTooManyMergeBasesFor,
                  Integer.valueOf(MAX_BASES), a.name(),
                  b.name(),
View Full Code Here

    final RevCommit base = walk.next();
    if (base == null)
      return null;
    final RevCommit base2 = walk.next();
    if (base2 != null) {
      throw new NoMergeBaseException(
          MergeBaseFailureReason.MULTIPLE_MERGE_BASES_NOT_SUPPORTED,
          MessageFormat.format(
          JGitText.get().multipleMergeBasesFor, a.name(), b.name(),
          base.name(), base2.name()));
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.errors.NoMergeBaseException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.