I want apply patch in Mercurial:
hg import patch_name.patch
But if I get the error abort: patch failed to apply
, Mercurial creates *.rej
files.
Is there a way show kdiff or vim-diif to correcting conflict.
There isn't a way to do this. The recommended approach is to open the file and the .rej file and manually merge in the rejected hunks.
I would bet that hg returns an error code. Perhaps you can wrap hg import
in a shell script that catches the error code returned and does what you want if there was an error? Something like:
#!/bin/sh
# run the script by typing `hgimp patch_name.patch`
# $1 below will contain patch_name.patch
hg import $1
# if the return code is not equal to 0, run vimdiff or whatever
if [ ! "$?" -eq '0' ]; then
# run your diff/cleanup commands here
fi
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