mirror of
https://github.com/java-diff-utils/java-diff-utils.git
synced 2026-03-13 10:11:17 +08:00
80 lines
3.0 KiB
Markdown
80 lines
3.0 KiB
Markdown
# java-diff-utils
|
|
|
|
## Status ##
|
|
[](https://travis-ci.org/wumpz/java-diff-utils) [](https://www.codacy.com/app/wumpz/java-diff-utils?utm_source=github.com&utm_medium=referral&utm_content=wumpz/java-diff-utils&utm_campaign=Badge_Grade)
|
|
|
|
## Intro ##
|
|
Diff Utils library is an OpenSource library for performing the comparison operations between texts: computing diffs, applying patches, generating unified diffs or parsing them, generating diff output for easy future displaying (like side-by-side view) and so on.
|
|
|
|
Main reason to build this library was the lack of easy-to-use libraries with all the usual stuff you need while working with diff files. Originally it was inspired by JRCS library and it's nice design of diff module.
|
|
|
|
**This is originally a fork of java-diff-utils from Google Code Archive.**
|
|
|
|
## Examples ##
|
|
|
|
Look [here](https://github.com/wumpz/java-diff-utils/wiki) to find more helpful informations and examples.
|
|
|
|
These two outputs are generated using this java-diff-utils. The source code can also be found at the *Examples* page:
|
|
|
|
**Producing a one liner including all difference information.**
|
|
|
|
This is a test ~senctence~**for diffutils**.
|
|
|
|
|
|
**Producing a side by side view of computed differences.**
|
|
|
|
|original|new|
|
|
|--------|---|
|
|
|This is a test ~senctence~.|This is a test **for diffutils**.|
|
|
|This is the second line.|This is the second line.|
|
|
|~And here is the finish.~||
|
|
|
|
|
|
## Main Features ##
|
|
|
|
* computing the difference between two texts.
|
|
* capable to hand more than plain ascci. Arrays or List of any type that implements hashCode() and equals() correctly can be subject to differencing using this library
|
|
* patch and unpatch the text with the given patch
|
|
* parsing the unified diff format
|
|
* producing human-readable differences
|
|
* inline difference construction
|
|
* Algorithms:
|
|
* Myer
|
|
* HistogramDiff using JGit Library
|
|
|
|
### Algoritms ###
|
|
|
|
* Myer'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.
|
|
|
|
### Changelog ###
|
|
* Version 1.4
|
|
* switch to maven and removed other artifacts
|
|
* changed groupid to **com.github.java-diff-utils** due to different forks at github
|
|
* updated maven plugins
|
|
* JDK 1.8 compatibility
|
|
* support for inline merge
|
|
* restructured packages
|
|
* changed API
|
|
* changed Algorithm to provide only cursor positions
|
|
* integrated JGit (Eclipse Licensed) to provide HistogramDiff to gain speed for large datasets
|
|
* Version 1.2
|
|
* JDK 1.5 compatibility
|
|
* Ant build script
|
|
* Generate output in unified diff format (thanks for Bill James)
|
|
|
|
### To Install ###
|
|
|
|
**This jar is not yet to get at maven central.**
|
|
|
|
Just add the code below to your maven dependencies:
|
|
```
|
|
<dependency>
|
|
<groupId>com.github.java-diff-utils</groupId>
|
|
<artifactId>diffutils</artifactId>
|
|
<version>1.2.1</version>
|
|
</dependency>
|
|
```
|