diffparser

Parse textual diffs with Java.

License

License

GroupId

GroupId

org.wickedsource
ArtifactId

ArtifactId

diffparser
Last Version

Last Version

1.2
Release Date

Release Date

Type

Type

jar
Description

Description

diffparser
Parse textual diffs with Java.
Project URL

Project URL

http://thombergs.github.io/diffparser/
Source Code Management

Source Code Management

https://github.com/thombergs/diffparser

Download diffparser

How to add to project

<!-- https://jarcasting.com/artifacts/org.wickedsource/diffparser/ -->
<dependency>
    <groupId>org.wickedsource</groupId>
    <artifactId>diffparser</artifactId>
    <version>1.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.wickedsource/diffparser/
implementation 'org.wickedsource:diffparser:1.2'
// https://jarcasting.com/artifacts/org.wickedsource/diffparser/
implementation ("org.wickedsource:diffparser:1.2")
'org.wickedsource:diffparser:jar:1.2'
<dependency org="org.wickedsource" name="diffparser" rev="1.2">
  <artifact name="diffparser" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.wickedsource', module='diffparser', version='1.2')
)
libraryDependencies += "org.wickedsource" % "diffparser" % "1.2"
[org.wickedsource/diffparser "1.2"]

Dependencies

compile (2)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.7.5
org.wickedsource : docx-stamper jar 1.0.0

test (2)

Group / Artifact Type Version
org.slf4j : slf4j-log4j12 jar 1.7.5
org.testng : testng jar 6.8.7

Project Modules

There are no modules declared in this project.

diffparser

Build Status

Parse unified diffs with Java.

Code example

DiffParser parser = new UnifiedDiffParser();
InputStream in = new FileInputStream("/path/to/file.diff");
List<Diff> diff = parser.parse(in);

What Diff formats can be parsed?

Currently, the only implementation of the DiffParser interface is UnifiedDiffParser, which supports parsing of diffs like the following:

Modified: trunk/test1.txt
===================================================================
--- /trunk/test1.txt	2013-10-23 19:41:56 UTC (rev 46)
+++ /trunk/test1.txt	2013-10-23 19:44:39 UTC (rev 47)
@@ -1,4 +1,3 @@
 test1
-test1
+test234

-test1
\ No newline at end of file
@@ -5,9 +6,10 @@
-test1
-test1
+aösdhasd
+asdasd

An input stream may contain several sections like the above, delimited by an empty line. Each such section will be parsed into an object of class Diff.

Latest Stable Release

Download

Download

Maven

...
<repositories>
  <repository>
    <id>jcenter</id>
    <url>https://jcenter.bintray.com/</url>
  </repository>
</repositories>

<dependencies>
  <dependency>
    <groupId>io.reflectoring.diffparser</groupId>
    <artifactId>diffparser</artifactId>
    <version>1.4</version>
  </dependency>
</dependencies>
...

Gradle

repositories {
  jcenter()
}

dependencies {
  compile('io.reflectoring.diffparser:diffparser:1.4')
}

Snapshots

You can access the latest snapshot by adding "-SNAPSHOT" to the version number and adding the repository https://oss.jfrog.org/artifactory/oss-snapshot-local to your build.

You can also reference a specific snapshot like 1.4-20171220.195055-1. Here's the list of snapshot versions.

Maven

...
<repositories>
  <repository>
    <id>oss-snapshot-local</id>
    <url>https://oss.jfrog.org/webapp/#/artifacts/browse/tree/General/oss-snapshot-local/io/reflectoring/diffparser/diffparser</url>
  </repository>
</repositories>

<dependencies>
  <dependency>
    <groupId>io.reflectoring.diffparser</groupId>
    <artifactId>diffparser</artifactId>
    <version>1.5-SNAPSHOT</version>
  </dependency>
</dependencies>
...

Gradle

repositories {
  maven { url 'https://oss.jfrog.org/artifactory/oss-snapshot-local' }
}

dependencies {
  compile('io.reflectoring.diffparser:diffparser:1.5-SNAPSHOT')
}

Versions

Version
1.2
1.1
1.0