Class JGitDiff
java.lang.Object
org.variantsync.diffdetective.variation.diff.construction.JGitDiff
Class which groups functions of parsing variation diffs with JGit.
- Author:
- Paul Bittner
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic VariationDiff<DiffLinesLabel> diff(String linesBefore, String linesAfter, org.eclipse.jgit.diff.DiffAlgorithm.SupportedAlgorithm algorithm, VariationDiffParseOptions options) Creates a variation diff from to line-based text inputs.static StringtextDiff(String linesBefore, String linesAfter, org.eclipse.jgit.diff.DiffAlgorithm.SupportedAlgorithm algorithm) Creates a text-based diff from two line-based text inputs.static StringtextDiff(Path beforeFile, Path afterFile, org.eclipse.jgit.diff.DiffAlgorithm.SupportedAlgorithm algorithm) Creates a text-based diff from two line-based text inputs.
-
Field Details
-
NO_NEWLINE_AT_END_OF_FILE
-
-
Constructor Details
-
JGitDiff
private JGitDiff()
-
-
Method Details
-
textDiff
public static String textDiff(Path beforeFile, Path afterFile, org.eclipse.jgit.diff.DiffAlgorithm.SupportedAlgorithm algorithm) throws IOException Creates a text-based diff from two line-based text inputs. Uses JGit to diff the two files using the specifiedoptions.- Parameters:
beforeFile- Path to text file before the change.afterFile- Path to text file after the change.algorithm- Specification of which algorithm to use for diffing with JGit.- Returns:
- A variation diff comprising the changes.
- Throws:
IOException- when JGit fails in differencing
-
textDiff
public static String textDiff(String linesBefore, String linesAfter, org.eclipse.jgit.diff.DiffAlgorithm.SupportedAlgorithm algorithm) throws IOException Creates a text-based diff from two line-based text inputs. Uses JGit to diff the two files using the specifiedoptions.- Parameters:
linesBefore- State of annotated lines before the change.linesAfter- State of annotated lines after the change.algorithm- Specification of which algorithm to use for diffing with JGit.- Returns:
- A variation diff comprising the changes.
- Throws:
IOException- when JGit fails in differencing
-
diff
public static VariationDiff<DiffLinesLabel> diff(String linesBefore, String linesAfter, org.eclipse.jgit.diff.DiffAlgorithm.SupportedAlgorithm algorithm, VariationDiffParseOptions options) throws IOException, DiffParseException Creates a variation diff from to line-based text inputs. Expects variability to be implemented via C preprocessor in those lines. Uses JGit to diff the two files using the specifiedoptions, and afterwards, creates the variation diff. Creates a variation diff from to line-based text inputs. First creates a line-based diff withtextDiff(String, String, DiffAlgorithm.SupportedAlgorithm)and then parses that diff withVariationDiff.fromDiff(String, VariationDiffParseOptions).- Parameters:
linesBefore- State of annotated lines before the change.linesAfter- State of annotated lines after the change.algorithm- Specification of which algorithm to use for diffing with JGit.options- various options for parsing- Returns:
- A variation diff comprising the changes.
- Throws:
IOException- when JGit fails in differencingDiffParseException- when DiffDetective fails in parsing the JGit diff to a variation diff
-