mirror of
https://github.com/java-diff-utils/java-diff-utils.git
synced 2026-03-13 10:11:17 +08:00
Merge origin/master
This commit is contained in:
@@ -129,7 +129,7 @@ public final class UnifiedDiffUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* generateUnifiedDiff takes a Patch and some other arguments, returning the Unified Diff format
|
* generateUnifiedDiff takes a Patch and some other arguments, returning the Unified Diff format
|
||||||
* text representing the Patch.
|
* text representing the Patch. Author: Bill James (tankerbay@gmail.com).
|
||||||
*
|
*
|
||||||
* @param originalFileName - Filename of the original (unrevised file)
|
* @param originalFileName - Filename of the original (unrevised file)
|
||||||
* @param revisedFileName - Filename of the revised file
|
* @param revisedFileName - Filename of the revised file
|
||||||
@@ -137,7 +137,6 @@ public final class UnifiedDiffUtils {
|
|||||||
* @param patch - Patch created by the diff() function
|
* @param patch - Patch created by the diff() function
|
||||||
* @param contextSize - number of lines of context output around each difference in the file.
|
* @param contextSize - number of lines of context output around each difference in the file.
|
||||||
* @return List of strings representing the Unified Diff representation of the Patch argument.
|
* @return List of strings representing the Unified Diff representation of the Patch argument.
|
||||||
* @author Bill James (tankerbay@gmail.com)
|
|
||||||
*/
|
*/
|
||||||
public static List<String> generateUnifiedDiff(String originalFileName,
|
public static List<String> generateUnifiedDiff(String originalFileName,
|
||||||
String revisedFileName, List<String> originalLines, Patch<String> patch,
|
String revisedFileName, List<String> originalLines, Patch<String> patch,
|
||||||
@@ -200,13 +199,12 @@ public final class UnifiedDiffUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* processDeltas takes a list of Deltas and outputs them together in a single block of
|
* processDeltas takes a list of Deltas and outputs them together in a single block of
|
||||||
* Unified-Diff-format text.
|
* Unified-Diff-format text. Author: Bill James (tankerbay@gmail.com).
|
||||||
*
|
*
|
||||||
* @param origLines - the lines of the original file
|
* @param origLines - the lines of the original file
|
||||||
* @param deltas - the Deltas to be output as a single block
|
* @param deltas - the Deltas to be output as a single block
|
||||||
* @param contextSize - the number of lines of context to place around block
|
* @param contextSize - the number of lines of context to place around block
|
||||||
* @return
|
* @return
|
||||||
* @author Bill James (tankerbay@gmail.com)
|
|
||||||
*/
|
*/
|
||||||
private static List<String> processDeltas(List<String> origLines,
|
private static List<String> processDeltas(List<String> origLines,
|
||||||
List<AbstractDelta<String>> deltas, int contextSize, boolean newFile) {
|
List<AbstractDelta<String>> deltas, int contextSize, boolean newFile) {
|
||||||
@@ -297,11 +295,10 @@ public final class UnifiedDiffUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getDeltaText returns the lines to be added to the Unified Diff text from the Delta parameter
|
* getDeltaText returns the lines to be added to the Unified Diff text from the Delta parameter. Author: Bill James (tankerbay@gmail.com).
|
||||||
*
|
*
|
||||||
* @param delta - the Delta to output
|
* @param delta - the Delta to output
|
||||||
* @return list of String lines of code.
|
* @return list of String lines of code.
|
||||||
* @author Bill James (tankerbay@gmail.com)
|
|
||||||
*/
|
*/
|
||||||
private static List<String> getDeltaText(AbstractDelta<String> delta) {
|
private static List<String> getDeltaText(AbstractDelta<String> delta) {
|
||||||
List<String> buffer = new ArrayList<>();
|
List<String> buffer = new ArrayList<>();
|
||||||
|
|||||||
@@ -554,8 +554,8 @@ public final class DiffRowGenerator {
|
|||||||
* Set the column width of generated lines of original and revised
|
* Set the column width of generated lines of original and revised
|
||||||
* texts.
|
* texts.
|
||||||
*
|
*
|
||||||
* @param width the width to set. Making it < 0 doesn't make any sense.
|
* @param width the width to set. Making it < 0 doesn't make any sense. Default 80.
|
||||||
* Default 80. @return builder with config of column width
|
* @return builder with config of column width
|
||||||
*/
|
*/
|
||||||
public Builder columnWidth(int width) {
|
public Builder columnWidth(int width) {
|
||||||
if (width >= 0) {
|
if (width >= 0) {
|
||||||
|
|||||||
@@ -189,10 +189,10 @@ public class UnifiedDiffWriter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getDeltaText returns the lines to be added to the Unified Diff text from the Delta parameter
|
* getDeltaText returns the lines to be added to the Unified Diff text from the Delta parameter.
|
||||||
*
|
*
|
||||||
* @param delta - the Delta to output
|
* @param writer consumer for the list of String lines of code
|
||||||
* @return list of String lines of code.
|
* @param delta the Delta to output
|
||||||
*/
|
*/
|
||||||
private static void getDeltaText(Consumer<String> writer, AbstractDelta<String> delta) {
|
private static void getDeltaText(Consumer<String> writer, AbstractDelta<String> delta) {
|
||||||
for (String line : delta.getSource().getLines()) {
|
for (String line : delta.getSource().getLines()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user