|
|
@ -8,7 +8,7 @@ import org.apache.commons.codec.digest.DigestUtils
|
|
|
|
|
|
|
|
|
|
|
|
public class TreeDiff {
|
|
|
|
public class TreeDiff {
|
|
|
|
|
|
|
|
|
|
|
|
public static final String VERSION = "1.2"
|
|
|
|
public static final String VERSION = "1.3"
|
|
|
|
|
|
|
|
|
|
|
|
private ObjectMapper objectMapper = new ObjectMapper()
|
|
|
|
private ObjectMapper objectMapper = new ObjectMapper()
|
|
|
|
private PrintStream stdout
|
|
|
|
private PrintStream stdout
|
|
|
@ -54,7 +54,7 @@ public class TreeDiff {
|
|
|
|
|
|
|
|
|
|
|
|
def opts = LightOptionParser.parseOptions(cliDef, args)
|
|
|
|
def opts = LightOptionParser.parseOptions(cliDef, args)
|
|
|
|
|
|
|
|
|
|
|
|
if (opts.h) { /* TODO */ return }
|
|
|
|
if (opts.h) { println this.usage; return }
|
|
|
|
|
|
|
|
|
|
|
|
if (opts.V) {
|
|
|
|
if (opts.V) {
|
|
|
|
stdout.println "JDB Labs TreeDiff v${VERSION}"
|
|
|
|
stdout.println "JDB Labs TreeDiff v${VERSION}"
|
|
|
@ -280,4 +280,103 @@ public class TreeDiff {
|
|
|
|
|
|
|
|
|
|
|
|
private void verboseErr(String msg) { if (verbose) stderr.println msg }
|
|
|
|
private void verboseErr(String msg) { if (verbose) stderr.println msg }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getUsage() {
|
|
|
|
|
|
|
|
return """\
|
|
|
|
|
|
|
|
JDB Labs TreeDiff v${VERSION}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gather and display information about the differences between two file trees,
|
|
|
|
|
|
|
|
including files found in only one side and not the other, files that match on
|
|
|
|
|
|
|
|
both sides, files which share the same contents but reside in differing paths
|
|
|
|
|
|
|
|
on each side, and files that reside at the same location on both sides but
|
|
|
|
|
|
|
|
whose contents differ.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
usage: treediff [options] <left-direction> <right-directory>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
where options are:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-h, --help Output this usage information.
|
|
|
|
|
|
|
|
-v, --verbose Enable verbose output.
|
|
|
|
|
|
|
|
-V, --version Output the version information for the utility.
|
|
|
|
|
|
|
|
-g, --gui Launch the graphical interface (not yet implemented).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-s, --same
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Output information about files that are the same on both sides.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-S, --exclude-same
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Do not output information about files that are the same on both sides.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-c, --content-mismatch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Output information about files that have the same relative path on both
|
|
|
|
|
|
|
|
side but whose contents differ.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-c, --exclude-content-mismatch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Do not output information about files that have the same relative path
|
|
|
|
|
|
|
|
on both side but whose contents differ.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-p, --path-mismatch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Output information about files that have the same content but reside at
|
|
|
|
|
|
|
|
different relative paths on each side.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-P, --exclude-path-mismatch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Do not output information about files that have the same content but
|
|
|
|
|
|
|
|
reside at different relative paths on each side.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-l, --left-only
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Output information about files found on only the left side (missing
|
|
|
|
|
|
|
|
from the right entirely).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-L, --exclude-left-only
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Do not output information about files found on the left side only
|
|
|
|
|
|
|
|
(missing from the right entirely).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-r, --right-only
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Output information about files found on only the right side (missing
|
|
|
|
|
|
|
|
from the left entirely).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-R, --exclude-right-only
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Do not output information about files found on the right side only
|
|
|
|
|
|
|
|
(missing from the left entirely).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-q, --quiet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Suppress all output and error messages except for the progress
|
|
|
|
|
|
|
|
indicator.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-Q, --very-quiet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Suppress all output and error messages including the progress
|
|
|
|
|
|
|
|
indicator.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-rd, --direction <directory-path>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Use <directory-path> as the root for all relative file paths (input
|
|
|
|
|
|
|
|
directories to scan for example).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-i, --analysis-in <left-dir-analysis> <right-dir-analysis>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Use pre-calculated directory analysis in place of reading local
|
|
|
|
|
|
|
|
directories. This is useful if you wish to do diffs between two
|
|
|
|
|
|
|
|
directory trees that are not on the same filesystem, or if you wish to
|
|
|
|
|
|
|
|
display different output about a diff without re-scanning the
|
|
|
|
|
|
|
|
filesystem.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-o, --analysis-out <file-name-root>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
In addition to the requested output on STDOUT, write the analysis for
|
|
|
|
|
|
|
|
each of the scanned directories to files named <file-name-root>.left
|
|
|
|
|
|
|
|
and <file-name-root>.right. These analysis files are formatted so that
|
|
|
|
|
|
|
|
they can be used as inputs to the --analysis-in option.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
""";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|