Reputation: 827
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.
Upvotes: 8
Views: 4318
Reputation: 1410
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
Upvotes: 2
Reputation: 40749
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.
Upvotes: 3