Class PatchDiff
java.lang.Object
org.variantsync.diffdetective.diff.git.PatchDiff
- All Implemented Interfaces:
GitPatch,TextBasedDiff,VariationDiffSource
Data class containing information about a single patch (i.e., the differences in a single file).
Contains a VariationDiff of the patch.
- Author:
- Sören Viegener, Paul Bittner
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.variantsync.diffdetective.diff.git.GitPatch
GitPatch.SimpleGitPatch -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.eclipse.jgit.diff.DiffEntry.ChangeTypeThe general change type of a single file.private final CommitDiffThe commit the patch belongs to.private final Stringprivate final StringPath of the file after modification.private final StringPath of the file before modification.private final VariationDiff<DiffLinesLabel> Fields inherited from interface org.variantsync.diffdetective.variation.diff.source.VariationDiffSource
Unknown -
Constructor Summary
ConstructorsConstructorDescriptionPatchDiff(CommitDiff commitDiff, org.eclipse.jgit.diff.DiffEntry diffEntry, String fullDiff, VariationDiff<DiffLinesLabel> variationDiff) Creates a new PatchDiff. -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.jgit.diff.DiffEntry.ChangeTypeReturns the change type of this patch (e.g., file insertion or modification).Returns the corresponding CommitDiff, which this patch is part of.Returns the hash of the commit introducing the change.getDiff()Returns this diff as plain text.getFileExtension(Time time) Returns the extension of the file this patch is modifying.getFileName(Time time) Returns the name of the patched file at the given time.Returns the hash of the parent commit regarding which the diff was created.Returns the VariationDiff for this patch.booleanisValid()Returns whether this PatchDiff is a valid patch.Creates a shallow clone.toString()
-
Field Details
-
fullDiff
-
variationDiff
-
commitDiff
The commit the patch belongs to. -
changeType
private final org.eclipse.jgit.diff.DiffEntry.ChangeType changeTypeThe general change type of a single file. SeeType. -
oldPath
Path of the file before modification. -
newPath
Path of the file after modification.
-
-
Constructor Details
-
PatchDiff
public PatchDiff(CommitDiff commitDiff, org.eclipse.jgit.diff.DiffEntry diffEntry, String fullDiff, VariationDiff<DiffLinesLabel> variationDiff) Creates a new PatchDiff.- Parameters:
commitDiff- The changes of a commit this patch belongs to.diffEntry- The diff entry from jgit from which this PatchDiff was produced.fullDiff- The diff of this patch as text. Might be empty.variationDiff- TheVariationDiffthat describes this patch.
-
-
Method Details
-
getCommitDiff
Returns the corresponding CommitDiff, which this patch is part of. -
getFileExtension
Returns the extension of the file this patch is modifying. -
getChangeType
public org.eclipse.jgit.diff.DiffEntry.ChangeType getChangeType()Description copied from interface:GitPatchReturns the change type of this patch (e.g., file insertion or modification).- Specified by:
getChangeTypein interfaceGitPatch
-
getFileName
Description copied from interface:GitPatchReturns the name of the patched file at the given time.- Specified by:
getFileNamein interfaceGitPatch
-
getCommitHash
Description copied from interface:GitPatchReturns the hash of the commit introducing the change.- Specified by:
getCommitHashin interfaceGitPatch
-
getParentCommitHash
Description copied from interface:GitPatchReturns the hash of the parent commit regarding which the diff was created.- Specified by:
getParentCommitHashin interfaceGitPatch
-
getDiff
Description copied from interface:TextBasedDiffReturns this diff as plain text.- Specified by:
getDiffin interfaceTextBasedDiff
-
getVariationDiff
Returns the VariationDiff for this patch. -
isValid
public boolean isValid()Returns whether this PatchDiff is a valid patch. A patch is valid if it has a VariationDiff. -
toString
-
shallowClone
Description copied from interface:GitPatchCreates a shallow clone. A shallow clone should return the very same values for the methods of this interface. Other behaviour is unspecified.- Specified by:
shallowClonein interfaceGitPatch- Returns:
- A clone that acts equal with respect to this interface.
-