Package org.xwiki.diff
Interface DiffManager
-
@Role public interface DiffManager
Various diff/merge tools.- Version:
- $Id: 47ce477a9e693eeae85268f7ac9a00039e75edc7 $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <E> DiffResult<E>
diff(List<E> previous, List<E> next, DiffConfiguration<E> configuration)
Produce a diff between the two provided versions.<E> MergeResult<E>
merge(List<E> commonAncestor, List<E> next, List<E> current, MergeConfiguration<E> configuration)
Execute a 3-way merge on provided versions.
-
-
-
Method Detail
-
diff
<E> DiffResult<E> diff(List<E> previous, List<E> next, DiffConfiguration<E> configuration) throws DiffException
Produce a diff between the two provided versions.- Type Parameters:
E
- the type of compared elements- Parameters:
previous
- the previous version of the content to comparenext
- the next version of the content to compareconfiguration
- the configuration of the diff behavior- Returns:
- the result of the diff
- Throws:
DiffException
- error when executing the diff
-
merge
<E> MergeResult<E> merge(List<E> commonAncestor, List<E> next, List<E> current, MergeConfiguration<E> configuration) throws MergeException
Execute a 3-way merge on provided versions. If a conflict is detected during the merge, no error is triggered and the returnedMergeResult
object always has a result (seeMergeResult.getMerged()
): the conflict is automatically fixed with a fallback defined by theMergeConfiguration
. If theMergeConfiguration
instance contains someConflictDecision
(seeMergeConfiguration.setConflictDecisionList(List)
), then those decisions are taken into account to solve the conflict. The decision linked to the conflict is retrieved and applied, unless the decision state is stillConflictDecision.DecisionType.UNDECIDED
. When a decision is used to solve a conflict, the conflict is not recorded in theMergeResult
. If the decision isConflictDecision.DecisionType.UNDECIDED
, or if no decision is available for this conflict, then the fallback version defined in theMergeConfiguration
(seeMergeConfiguration.setFallbackOnConflict(MergeConfiguration.Version)
) is used to fix the conflict, but in that case the conflict is recorded in the returnedMergeResult
. Finally the configuration parameter accepts a null value: in that case, the fallback version is always the current version.- Type Parameters:
E
- the type of compared elements- Parameters:
commonAncestor
- the common ancestor of the two versions of the content to comparenext
- the next version of the content to comparecurrent
- the current version of the content to compareconfiguration
- the configuration of the merge behavior- Returns:
- the result of the merge
- Throws:
MergeException
- error when executing the merge
-
-