Package com.google.gerrit.server.patch
Class GitPositionTransformer.FileMapping
java.lang.Object
com.google.gerrit.server.patch.GitPositionTransformer.FileMapping
- Enclosing class:
GitPositionTransformer
A mapping of attributes from a file in one Git tree (source) to a file in another Git tree
(target).
At the moment, only the file path is considered. Other attributes like file mode would be imaginable too but are currently not supported.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionforAddedFile(String filePath) Creates aGitPositionTransformer.FileMappingfor a file addition.forDeletedFile(String filePath) Creates aGitPositionTransformer.FileMappingfor a file deletion.Creates aGitPositionTransformer.FileMappingusing the old and new paths.forModifiedFile(String filePath) Creates aGitPositionTransformer.FileMappingfor a file modification.forRenamedFile(String oldPath, String newPath) Creates aGitPositionTransformer.FileMappingfor a file renaming.newPath()File path in the target tree.oldPath()File path in the source tree.
-
Constructor Details
-
FileMapping
public FileMapping()
-
-
Method Details
-
oldPath
File path in the source tree. For file additions, this is an emptyOptional. -
newPath
-
forAddedFile
Creates aGitPositionTransformer.FileMappingfor a file addition.In the context of
GitPositionTransformer, file additions are irrelevant as no given position in the source tree can refer to such a new file in the target tree. We still provide this factory method so that code outside ofGitPositionTransformerdoesn't have to care about such details and can simply createGitPositionTransformer.FileMappings for any modifications between the trees. -
forDeletedFile
Creates aGitPositionTransformer.FileMappingfor a file deletion. -
forModifiedFile
Creates aGitPositionTransformer.FileMappingfor a file modification. -
forRenamedFile
Creates aGitPositionTransformer.FileMappingfor a file renaming. -
forFile
public static GitPositionTransformer.FileMapping forFile(Optional<String> oldPath, Optional<String> newPath) Creates aGitPositionTransformer.FileMappingusing the old and new paths.
-