7 Commits

Author SHA1 Message Date
Tobias Warneke
ab1e38c57b [maven-release-plugin] prepare release java-diff-utils-parent-4.11 2021-09-08 12:28:13 +02:00
Tobias Warneke
286e807232 Merge origin/master 2021-09-08 12:25:34 +02:00
Jerry James
c85296b63d Javadoc warning fixes (#109)
Co-authored-by: Tobias <t.warneke@gmx.net>
2021-09-08 12:21:50 +02:00
Tobias Warneke
4c457b39dc 2021-09-08 12:19:53 +02:00
Tobias Warneke
7dea4e2298 2021-09-08 12:16:50 +02:00
Tobias Warneke
2b02951e89 Merge introduce-optimized-meyers-algorithm 2021-09-08 12:11:12 +02:00
Ilari Suhonen
89ce301123 Fix typo in UnifiedDiff#spplyPatchTo(Predicate<String>, List<String>) (#127)
* Fix typo in UnifiedDiff.java

Changes UnifiedDiff#spplyPatchTo to UnifiedDiff#applyPatchTo

* Fix typo in test

Fixes the method invocation in the UnifiedDiff roundtrip test to account for the typo fix in UnifiedDiff
2021-07-07 07:15:55 +02:00
10 changed files with 23 additions and 19 deletions

View File

@@ -13,6 +13,12 @@ This project uses a custom versioning scheme (and not [Semantic Versioning](http
### Changed
* bugfixing new UnifiedDiff reader
* header for each file
* skip empty lines
* introduction of Meyers Diff Algorithm with Linear Space improvment (until matured this will not be the default diff algorithm)
* introduction of DiffAlgorithmFactory to set the default diff algorithm DiffUtils use (`DiffUtils.withDefaultDiffAlgorithmFactory(MeyersDiffWithLinearSpace.factory());`)
## [4.10]
### Changed

View File

@@ -49,12 +49,13 @@ This is a test ~senctence~**for diffutils**.
* producing human-readable differences
* inline difference construction
* Algorithms:
* Myer
* Meyers Standard Algorithm
* Meyers with linear space improvement
* HistogramDiff using JGit Library
### Algorithms
* Myer's diff
* Meyer's diff
* HistogramDiff
But it can easily replaced by any other which is better for handing your texts. I have plan to add implementation of some in future.

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>io.github.java-diff-utils</groupId>
<artifactId>java-diff-utils-parent</artifactId>
<version>4.11-SNAPSHOT</version>
<version>4.11</version>
</parent>
<artifactId>java-diff-utils-jgit</artifactId>
<name>java-diff-utils-jgit</name>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>io.github.java-diff-utils</groupId>
<artifactId>java-diff-utils-parent</artifactId>
<version>4.11-SNAPSHOT</version>
<version>4.11</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

View File

@@ -129,7 +129,7 @@ public final class UnifiedDiffUtils {
/**
* 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 revisedFileName - Filename of the revised file
@@ -137,7 +137,6 @@ public final class UnifiedDiffUtils {
* @param patch - Patch created by the diff() function
* @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.
* @author Bill James (tankerbay@gmail.com)
*/
public static List<String> generateUnifiedDiff(String originalFileName,
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
* Unified-Diff-format text.
* Unified-Diff-format text. Author: Bill James (tankerbay@gmail.com).
*
* @param origLines - the lines of the original file
* @param deltas - the Deltas to be output as a single block
* @param contextSize - the number of lines of context to place around block
* @return
* @author Bill James (tankerbay@gmail.com)
*/
private static List<String> processDeltas(List<String> origLines,
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
* @return list of String lines of code.
* @author Bill James (tankerbay@gmail.com)
*/
private static List<String> getDeltaText(AbstractDelta<String> delta) {
List<String> buffer = new ArrayList<>();

View File

@@ -554,8 +554,8 @@ public final class DiffRowGenerator {
* Set the column width of generated lines of original and revised
* texts.
*
* @param width the width to set. Making it < 0 doesn't make any sense.
* Default 80. @return builder with config of column width
* @param width the width to set. Making it &lt; 0 doesn't make any sense. Default 80.
* @return builder with config of column width
*/
public Builder columnWidth(int width) {
if (width >= 0) {

View File

@@ -55,7 +55,7 @@ public final class UnifiedDiff {
return tail;
}
public List<String> spplyPatchTo(Predicate<String> findFile, List<String> originalLines) throws PatchFailedException {
public List<String> applyPatchTo(Predicate<String> findFile, List<String> originalLines) throws PatchFailedException {
UnifiedDiffFile file = files.stream()
.filter(diff -> findFile.test(diff.getFromFile()))
.findFirst().orElse(null);

View File

@@ -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
* @return list of String lines of code.
* @param writer consumer for the list of String lines of code
* @param delta the Delta to output
*/
private static void getDeltaText(Consumer<String> writer, AbstractDelta<String> delta) {
for (String line : delta.getSource().getLines()) {

View File

@@ -150,7 +150,7 @@ public class UnifiedDiffRoundTripTest {
// Patch<String> fromUnifiedPatch = unifiedDiff.getFiles().get(0).getPatch();
// patchedLines = fromUnifiedPatch.applyTo(origLines);
// }
patchedLines = unifiedDiff.spplyPatchTo(file -> originalFile.equals(file), origLines);
patchedLines = unifiedDiff.applyPatchTo(file -> originalFile.equals(file), origLines);
assertEquals(revLines.size(), patchedLines.size());
for (int i = 0; i < revLines.size(); i++) {
String l1 = revLines.get(i);

View File

@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.java-diff-utils</groupId>
<artifactId>java-diff-utils-parent</artifactId>
<version>4.11-SNAPSHOT</version>
<version>4.11</version>
<name>java-diff-utils-parent</name>
<packaging>pom</packaging>
<modules>
@@ -29,7 +29,7 @@
<connection>scm:git:https://github.com/java-diff-utils/java-diff-utils.git</connection>
<developerConnection>scm:git:ssh://git@github.com:java-diff-utils/java-diff-utils.git</developerConnection>
<url>https://github.com/java-diff-utils/java-diff-utils.git</url>
<tag>HEAD</tag>
<tag>java-diff-utils-parent-4.11</tag>
</scm>
<issueManagement>
<system>GitHub Issues</system>