Last Updated: February 25, 2016
·
298
· charlesarmitage

Remember to use --git when patching in Mercurial

When patching in Mercurial the standard export produces standard diff outputs that do not include binary files.

When importing these patches they will successfully import leaving your CI to tell you that you missed some binaries.

To patch across binary files use the Git extended diff format that includes binary files. Run hg export with the --git (or -g) option. E.g.

hg export --git > mypatch.txt

You can set the option in TortoiseHg as well:

Picture

Mercurial's help has more details including why it is not the default option: http://mercurial.selenic.com/wiki/GitExtendedDiffFormat