How to apply a patch in mercurial and show the diff tool, if failed to apply

I want to apply the patch in Mercurial:

hg import patch_name.patch

But if I get an error abort: patch failed to apply, Mercurial creates the files *.rej.

Is there a way to show kdiff or vim-diif to resolve the conflict.

+5
source share
2 answers

There is no way to do this. The recommended approach is to open the file and the .rej file and manually combine in the rejected hunks.

+2
source

, hg . , hg import script, , , ? - :

#!/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
+2

All Articles