Search code examples
mercurialdiffbinaryfiles

In mercurial is there a way to tell hg log and diff to skip binary diffs?


If I'm combing through diffs using hg log -p or hg diff, it would be nice to see something like "binary file differs", rather than having to scroll through screenfulls of gibberish to get to the next file. Is there a configuration trick to do that?

(On preview, if there's no simple hg option to set, then there might be some hints in the right direction in this question. I would still need more help to get what I'm asking, though.)


Solution

  • With @arhak's help, I see the problem was this in my .hgrc

    [diff]
    git = True
    

    I'd forgotten that I'd added that after reading this advice that git-style diffs are more readable than the patch-style diffs that are Mercurial's default. I can't find a description of the differences, but looking at a few diffs now, --git (-g) seems to leave out dates in the filename headers, and apparently, it also forces the full uuencode-style diff for binary files. I think I'll keep it as default, but turn it off if for the unusual situations where I'm looking at patches with lots of binary file changes.

    To override at the commandline without editing .hgrc, add --config diff.git=False

    I'd be curious if there's a way to skip the binaries, but keep git formatting for the regular text files in the diff.