org.eclipse.jgit.merge

## Class RecursiveMerger

- java.lang.Object
- - org.eclipse.jgit.merge.Merger
  - - org.eclipse.jgit.merge.ThreeWayMerger
    - - org.eclipse.jgit.merge.ResolveMerger
      - - org.eclipse.jgit.merge.RecursiveMerger

    public class RecursiveMerger
    extends ResolveMerger

A three-way merger performing a content-merge if necessary across multiple bases using recursion This merger extends the resolve merger and does several things differently: - allow more than one merge base, up to a maximum - uses "Lists" instead of Arrays for chained types - recursively merges the merge bases together to compute a usable base

Since:
  3.0

### Nested Class Summary

### Nested classes/interfaces inherited from class org.eclipse.jgit.merge.ResolveMerger

`ResolveMerger.MergeFailureReason`

### Field Summary

Fields
`int` `MAX_BASES` The maximum number of merge bases.

### Fields inherited from class org.eclipse.jgit.merge.ResolveMerger

`commitNames, dircache, implicitDirCache, inCore, mergeAlgorithm, resultTree, workingTreeIterator`

### Fields inherited from class org.eclipse.jgit.merge.Merger

`db, reader, sourceCommits, sourceObjects, sourceTrees, walk`

### Constructor Summary

Constructors
`protected` `RecursiveMerger(Repository local)` Normal recursive merge, implies not inCore
`protected` `RecursiveMerger(Repository local, boolean inCore)` Normal recursive merge when you want a choice of DirCache placement inCore

### Method Summary

Methods
`protected RevCommit` `getBaseCommit(RevCommit a, RevCommit b)` Get a single base commit for two given commits.
`protected RevCommit` `getBaseCommit(RevCommit a, RevCommit b, int callDepth)` Get a single base commit for two given commits.

### Methods inherited from class org.eclipse.jgit.merge.ResolveMerger

`failed, getCommitNames, getFailingPaths, getMergeResults, getModifiedFiles, getResultTreeId, getToBeCheckedOut, getUnmergedPaths, mergeImpl, mergeTrees, setCommitNames, setDirCache, setWorkingTreeIterator`

### Methods inherited from class org.eclipse.jgit.merge.ThreeWayMerger

`getBaseCommitId, merge, mergeBase, setBase`

### Methods inherited from class org.eclipse.jgit.merge.Merger

`getBaseCommit, getObjectInserter, getRepository, openTree, setObjectInserter`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### MAX_BASES

    public final int MAX_BASES

The maximum number of merge bases. This merge will stop when the number of merge bases exceeds this value

See Also:
  Constant Field Values

### Constructor Detail

#### RecursiveMerger

    protected RecursiveMerger(Repository local,
                   boolean inCore)

Normal recursive merge when you want a choice of DirCache placement inCore

Parameters:
  `local` -
  `inCore` -

#### RecursiveMerger

    protected RecursiveMerger(Repository local)

Normal recursive merge, implies not inCore

Parameters:
  `local` -

### Method Detail

#### getBaseCommit

    protected RevCommit getBaseCommit(RevCommit a,
                          RevCommit b)
                               throws IncorrectObjectTypeException,
                                      IOException

Get a single base commit for two given commits. If the two source commits have more than one base commit recursively merge the base commits together until you end up with a single base commit.

Overrides:
  `getBaseCommit` in class `Merger`
Parameters:
  `a` - the first commit in `Merger.sourceObjects`.
  `b` - the second commit in `Merger.sourceObjects`.
Returns:
  the merge base of two commits
Throws:
  `IOException`
  `IncorrectObjectTypeException`

#### getBaseCommit

    protected RevCommit getBaseCommit(RevCommit a,
                          RevCommit b,
                          int callDepth)
                               throws IOException

Get a single base commit for two given commits. If the two source commits have more than one base commit recursively merge the base commits together until a virtual common base commit has been found.

Parameters:
  `a` - the first commit to be merged
  `b` - the second commit to be merged
  `callDepth` - the callDepth when this method is called recursively
Returns:
  the merge base of two commits
Throws:
  `IOException`
  `IncorrectObjectTypeException` - one of the input objects is not a commit.
  `NoMergeBaseException` - too many merge bases are found or the computation of a common merge base failed (e.g. because of a conflict).