xdiff

vb xdiff [options] FILE1 FILE2

Description

Compute an external diff between two files. By external diff we mean a diff between two disk files that are not necessarily under management. In other words, this command provides a mechanism to use VisionByte’s file difference engine on arbitrary disk files. See the diff command for computing differences between files that are under management.

This command prints the differences between the two files FILE1 and FILE2. all of the usual diff formatting options (–tk, –by, -c N, etc.) apply. See the diff command for a full list of command-line options.

Examples

  • Create two unmanaged text files and compare them

$ vb sys echo "line 1" > old.txt
$ vb sys echo -e "line 1\nline 2" > new.txt
$ vb xdiff old.txt new.txt
--- old.txt
+++ new.txt
@@ -1,1 +1,2 @@
 line 1
+line 2
  • Show the same external diff as JSON

$ vb xdiff old.txt new.txt --json
[{
  "leftname":"old.txt",
  "rightname":"new.txt",
  "diff":
[2,"line 1",
3,"line 2",
0]}
]
  • Build two ZIP archives with edited and added files

$ vb sys mkdir old_dir
$ vb sys mkdir old_dir\docs
$ vb sys echo "guide v1" > old_dir\docs\guide.txt
$ vb sys echo "readme" > old_dir\README.txt
$ vb minizip old.zip old_dir
Archive old.zip
$ vb sys mkdir new_dir
$ vb sys mkdir new_dir\docs
$ vb sys echo -e "guide v2\nextra line" > new_dir\docs\guide.txt
$ vb sys echo "readme" > new_dir\README.txt
$ vb sys echo "notes" > new_dir\docs\notes.txt
$ vb minizip new.zip new_dir
Archive new.zip
$ vb xdiff old.zip new.zip
Both zip files are identical!
  • Show ZIP diff in an ASCII tree view

$ vb xdiff old.zip new.zip --zip-tree --zip-ascii
Both zip files are identical!
  • Show a unified diff for changed files inside the ZIPs

$ vb xdiff old.zip new.zip --zip-unified
  • Show ZIP headers with short dates

$ vb xdiff old.zip new.zip --zip-headers --date short
Both zip files are identical!
  • Show only edited and added ZIP entries in tree form

$ vb xdiff old.zip new.zip --zip-tree --zip-edited --zip-added --zip-ascii
Both zip files are identical!
  • Show all ZIP entries in tree form

$ vb xdiff old.zip new.zip --zip-tree --zip-all --zip-ascii
Both zip files are identical!