Question

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.

Was it helpful?

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.

OTHER TIPS

I don't know about the graphical part of TortoiseHg, but if you use the command line, then the --text flag to hg diff should do the trick: it makes Mercurial treat all files as text.

You should try adding these lines to ~/.hgrc:

[diff]
git=1

The git diff format works for binary files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top