Class ChangeFileContentModification
java.lang.Object
com.google.gerrit.server.edit.tree.ChangeFileContentModification
- All Implemented Interfaces:
TreeModification
A
TreeModification
which changes the content of a file.-
Constructor Summary
ConstructorsConstructorDescriptionChangeFileContentModification
(String filePath, RawInput newContent) ChangeFileContentModification
(String filePath, RawInput newContent, Integer newGitFileMode) -
Method Summary
Modifier and TypeMethodDescriptioncom.google.common.collect.ImmutableSet<String>
Indicates all file paths affected by thisTreeModification
.List<org.eclipse.jgit.dircache.DirCacheEditor.PathEdit>
getPathEdits
(org.eclipse.jgit.lib.Repository repository, org.eclipse.jgit.lib.ObjectId treeId, com.google.common.collect.ImmutableList<? extends org.eclipse.jgit.lib.ObjectId> parents) Returns a list ofPathEdit
s which are necessary in order to achieve the desired modification of the Git tree.
-
Constructor Details
-
ChangeFileContentModification
-
ChangeFileContentModification
-
-
Method Details
-
getPathEdits
public List<org.eclipse.jgit.dircache.DirCacheEditor.PathEdit> getPathEdits(org.eclipse.jgit.lib.Repository repository, org.eclipse.jgit.lib.ObjectId treeId, com.google.common.collect.ImmutableList<? extends org.eclipse.jgit.lib.ObjectId> parents) Description copied from interface:TreeModification
Returns a list ofPathEdit
s which are necessary in order to achieve the desired modification of the Git tree. The order of thePathEdit
s can be crucial and hence shouldn't be changed.- Specified by:
getPathEdits
in interfaceTreeModification
- Parameters:
repository
- the affected Git repositorytreeId
- tree to which the modification is applied. A value ofObjectId.zero()
indicates an empty tree.parents
- parent commits of the commit to whose tree this modification is applied- Returns:
- an ordered list of necessary
PathEdit
s
-
getFilePaths
Description copied from interface:TreeModification
Indicates all file paths affected by thisTreeModification
. If the modification refers to several file paths (e.g. renaming a file), all of them must be returned.- Specified by:
getFilePaths
in interfaceTreeModification
- Returns:
- all affected file paths
-
getNewContent
-