Package org.eclipse.jgit.merge
Class MergeAlgorithm
java.lang.Object
org.eclipse.jgit.merge.MergeAlgorithm
Provides the merge algorithm which does a three-way merge on content provided
as RawText. By default
HistogramDiff
is used as
diff algorithm.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DiffAlgorithm
private static final Edit
private ContentMergeStrategy
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new MergeAlgorithm which usesHistogramDiff
as diff algorithmMergeAlgorithm
(DiffAlgorithm diff) Creates a new MergeAlgorithm -
Method Summary
Modifier and TypeMethodDescriptionRetrieves theContentMergeStrategy
.private static boolean
<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.private static Edit
Helper method which returns the next Edit for an Iterator over Edits.void
setContentMergeStrategy
(ContentMergeStrategy strategy) Sets theContentMergeStrategy
.
-
Field Details
-
diffAlg
-
strategy
-
END_EDIT
-
-
Constructor Details
-
MergeAlgorithm
public MergeAlgorithm()Creates a new MergeAlgorithm which usesHistogramDiff
as diff algorithm -
MergeAlgorithm
Creates a new MergeAlgorithm- Parameters:
diff
- the diff algorithm used by this merge
-
-
Method Details
-
getContentMergeStrategy
Retrieves theContentMergeStrategy
.- Returns:
- the
ContentMergeStrategy
in effect - Since:
- 5.12
-
setContentMergeStrategy
Sets theContentMergeStrategy
.- Parameters:
strategy
-ContentMergeStrategy
to set; ifnull
, setContentMergeStrategy.CONFLICT
- Since:
- 5.12
-
isEndEdit
-
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
-
nextEdit
Helper method which returns the next Edit for an Iterator over Edits. When there are no more edits left this method will return the constant END_EDIT.- Parameters:
it
- the iterator for which the next edit should be returned- Returns:
- the next edit from the iterator or END_EDIT if there no more edits
-