Right now when I hg import
a patch, and it fails to apply cleanly, hg partially applies the patch (the hunks that could apply cleanly) and saves the rejected hunks to a .rej
file.
I find this really annoying to work with. Is there a way to get hg to use internal:merge
instead when this happens?
Obviosuly the import
command does not have such an option and it seems to ignore any other merge tool configurations. I can think of 2 work-arounds:
Use hg import --exact
and then merge the import commit with your main head. This only works for patches created with the hg export
command, i.e. patches with revision information. Then you can make a regular merge of your main head and the new head created by the import.
$ hg import --exact foo.patch
$ hg merge
... fix conflicts if needed ...
$ hg commit -m 'apply patch foo'
Use good old patch command:
$ patch -p1 --merge < foo.patch`
... fix conflicts if needed ...
$ hg commit -m 'apply patch foo'
This creates in-file markers similar to internal:merge
.
If these multiple-step solutions are no options for you, think about requesting a feature to add a --merge
option to the import command. Alternatively you might glue these commands together in a script so you have your own one-shot import command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With