Search code examples
mercurialstring-comparisonfile-type

Mercurial performing binary comparison for certain file types


Possible Duplicate:
Why does Mercurial think my SQL files are binary?

I've recently started using Mercurial and when I reverted one of my .SQL files, Mercurial performed a binary comparison. This obviously limits the visibility of the changes that were made, as there is no diff.

Is there an option to set file types to do a string compare?

I'm using Tortioise Hg 0.8.1 with Mercurial 1.3.1.


Solution

  • Mercurial doesn't actually handle text and binaries at all differently with respect to actual storage. It does however try to guess "would visually showing this diff be meaningful" when asked to show a diff to a user with hg diff, hg log -p, or when viewing a changeset in the web interface. When it's trying to make the "should I show this as if it's text" decision the test applied is "Is there a NUL byte (0x00) within the first 1000 bytes of a file.

    So your file isn't being treated any differently except in how it's displayed to user output, but if you can find a NUL byte in there you can probably get that to stop too.

    Alternately, the extdiff extension can be used to take total control of how diffs are displayed.