Support hg export -g
Created originally on Bitbucket by fernandonajera (Fernando Nájera)
We sometimes have to generate patch files. We do so by right-clicking on a revision, then Export, then Export patch.
Unfortunately, if the revision contains binary files, the patch is basically worthless, as it just contains a line saying that the file changed, but not the change itself.
#!diff
diff -r rev1 -r rev2 some/file.png
Binary file some/file.png has changed
Unfortunately it often happens that we don't realize that there are indeed binary files, and we end up having patches lying around that won't work when needed.
Hg already provides option "-g" to generate git extended diff files, that contain the binary diffs. And as far as I can tell, both Hg and THg are happy to import those files too.
#!diff
diff --git a/some/file.png b/some/file.png
index rev1..rev2
GIT binary patch
literal 111
zc$@*U...
The problem is, we need to see that there are binary files involved, and then, we need to use the output log / command line to generate the patch.
So I was wondering, why not...
- ...make use of the option "-g" always by default? (and maybe opt-out via configuration). Is there any reason (bad side-effect) for which this option is not 'on' by default? So far I have only see that it does Good Things (TM).
- ...give the user a way (how?) to choose if he wants the "-g" option everytime he exports (although duplicating menu entries and/or creating an extra dialog is not ideal)
- ...show up a warning dialog if the revision(s) have binary files, and ask him if he wants to use "-g" for this export?
Thanks