Display diffs in a convenient html page
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
data/test
gradle/wrapper
src normalize file paths Apr 30, 2018
.gitattributes
.gitignore
.travis.yml add Travis CI onfig Feb 27, 2018
LICENSE Initial commit Feb 26, 2018
README.md
build.gradle
cronn-diff-to-html_outputExample1.png Initial commit Feb 26, 2018
cronn-diff-to-html_outputExample1_hiRes.png
cronn-diff-to-html_outputExample2.png
cronn-diff-to-html_outputExample2_hiRes.png
gradlew
gradlew.bat
release.sh

README.md

Build Status Maven Central Apache 2.0

diff-to-html

Displays diffs in a convenient html page.

  • Useful when dealing with large validation text files or directory structures in automated builds, e.g. on Jenkins.
  • Collapsible diff sections for each file make the result easy to read when comparing directories
  • Pure Java solution (optionally, use Linux diff under the hood - might be faster depending on your machine)
Example outputs:

cronn-diff-to-html_outputExample3 cronn-diff-to-html_outputExample2

Usage

Install:

$ ./gradlew installDist

To compare two directories (or files), e.g. dir1 and dir2, use the fat jar

$ java -jar build/libs/diff-to-html-1.1.jar dir1 dir2

or the start script

$ ./build/install/diff-to-html/scripts/diff-to-html dir1 dir2

which will give you something like

Output written to: file:///home/maurice/Git-Projects/openSource/diff-to-html/diff_dir1_dir2.html

Directories differ!

Call without arguments for help

$ java -jar build/libs/cronn-diff-to-html-1.1.jar 
usage: cronn-diff-to-html <input_left> <input_right> [<output_html>]  [-w]
       [-b] [-crlf] [-or] [-od] [-iu] [-de] [-u <arg>]
 -w,--ignorewhitespaces      ignore all white spaces
 -b,--ignorespacechange      ignore changes in the amount of white space
 -crlf,--ignorelineendings   ignore line endings, i.e. normalize CRLF / LF
                             while comparing files
 -or,--onlyreports           always exits with zero
 -od,--osdiff                uses operating system's diff instead of Java
                             implementation and parses the output. Might
                             slightly improve performance, depending on
                             your machine. Try for large diffs in
                             time-critial situations. Windows not
                             supported currently
 -iu,--ignoreunique          ignore unique files
 -de,--detectencoding        tries to determine encoding type
 -u,--unified <arg>          output <arg> (default 3) lines of unified
                             context
Parsing failed. Reason: Input arguments are missing

Generate your tar (or zip) to take wherever you want

$ ./gradlew distTar distZip
$ ls build/distributions/
diff-to-html-1.1.tar  diff-to-html-1.1.zip

Prerequisites

  • Java 8
  • On Unix system (only if you want to use OS diff under the hood)

Related