Package com.google.gerrit.server.patch
Interface GitPositionTransformer.PositionConflictStrategy
- All Known Implementing Classes:
GitPositionTransformer.BestPositionOnConflict,GitPositionTransformer.OmitPositionOnConflict
- Enclosing class:
GitPositionTransformer
public static interface GitPositionTransformer.PositionConflictStrategy
Strategy indicating how to handle
GitPositionTransformer.Positions for which mapping conflicts exist. A
mapping conflict means that a GitPositionTransformer.Position can't be transformed such that it still refers
to exactly the same commit content afterwards.
Example: A GitPositionTransformer.Position refers to file foo.txt and lines 5-6 which contain the text
"Line 5\nLine 6". One of the GitPositionTransformer.Mappings given to GitPositionTransformer.transform(Collection, Set)
indicates that line 5 of foo.txt was modified to "Line five\nLine 5.1\n". We could derive a
transformed GitPositionTransformer.Position (foo.txt, lines 5-7) but that GitPositionTransformer.Position would then refer to
the content "Line five\nLine 5.1\nLine 6". If the modification started already in line 4, we
could even only guess what the transformed GitPositionTransformer.Position would be.
-
Method Summary
Modifier and TypeMethodDescriptiongetOnFileConflict(GitPositionTransformer.Position oldPosition) Determines an alternateGitPositionTransformer.Positionwhen there is no file for the position (= file deletion) in the target tree.getOnRangeConflict(GitPositionTransformer.Position oldPosition) Determines an alternateGitPositionTransformer.Positionwhen the range of the position can't be mapped without a conflict.
-
Method Details
-
getOnRangeConflict
Optional<GitPositionTransformer.Position> getOnRangeConflict(GitPositionTransformer.Position oldPosition) Determines an alternateGitPositionTransformer.Positionwhen the range of the position can't be mapped without a conflict.- Parameters:
oldPosition- position in the source tree- Returns:
- the new
GitPositionTransformer.Positionor an emptyOptionalif the position should be dropped
-
getOnFileConflict
Optional<GitPositionTransformer.Position> getOnFileConflict(GitPositionTransformer.Position oldPosition) Determines an alternateGitPositionTransformer.Positionwhen there is no file for the position (= file deletion) in the target tree.- Parameters:
oldPosition- position in the source tree- Returns:
- the new
GitPositionTransformer.Positionor an emptyOptionalif the position should be * dropped
-