Package org.eclipse.jgit.merge
Class MergeAlgorithm
- java.lang.Object
-
- org.eclipse.jgit.merge.MergeAlgorithm
-
public final class MergeAlgorithm extends Object
Provides the merge algorithm which does a three-way merge on content provided as RawText. By defaultHistogramDiff
is used as diff algorithm.
-
-
Constructor Summary
Constructors Constructor Description MergeAlgorithm()
Creates a new MergeAlgorithm which usesHistogramDiff
as diff algorithmMergeAlgorithm(DiffAlgorithm diff)
Creates a new MergeAlgorithm
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContentMergeStrategy
getContentMergeStrategy()
Retrieves theContentMergeStrategy
.<S extends Sequence>
MergeResult<S>merge(SequenceComparator<S> cmp, S base, S ours, S theirs)
Does the three way merge between a common base and two sequences.void
setContentMergeStrategy(ContentMergeStrategy strategy)
Sets theContentMergeStrategy
.
-
-
-
Constructor Detail
-
MergeAlgorithm
public MergeAlgorithm()
Creates a new MergeAlgorithm which usesHistogramDiff
as diff algorithm
-
MergeAlgorithm
public MergeAlgorithm(DiffAlgorithm diff)
Creates a new MergeAlgorithm- Parameters:
diff
- the diff algorithm used by this merge
-
-
Method Detail
-
getContentMergeStrategy
@NonNull public ContentMergeStrategy getContentMergeStrategy()
Retrieves theContentMergeStrategy
.- Returns:
- the
ContentMergeStrategy
in effect - Since:
- 5.12
-
setContentMergeStrategy
public void setContentMergeStrategy(ContentMergeStrategy strategy)
Sets theContentMergeStrategy
.- Parameters:
strategy
-ContentMergeStrategy
to set; ifnull
, setContentMergeStrategy.CONFLICT
- Since:
- 5.12
-
merge
public <S extends Sequence> MergeResult<S> merge(SequenceComparator<S> cmp, S base, S ours, S theirs)
Does the three way merge between a common base and two sequences.- Parameters:
cmp
- comparison method for this execution.base
- the common base sequenceours
- the first sequence to be mergedtheirs
- the second sequence to be merged- Returns:
- the resulting content
-
-