Auto-detection of binary files for diff, export, and annotate

Matt Mackall mpm at
Tue Aug 23 22:47:27 CDT 2005

I've incorporated Fuming Wang's suggested approach for handling binary
files for the above three commands.

Diff and export will by default report 'Binary file <foo> differs' if
it detects either version of foo is binary. Annotate will print a
similar message. In all cases, this detection can be overridden with
the -a or --text flags (the same as used by diff(1) for this purpose).

The heuristic is the same one used by diff: if a file contains
a NUL character in the first 1k characters, it's treated as binary.

Mathematics is the supreme nostalgia of our time.

More information about the Mercurial mailing list