【发布时间】:2011-11-04 07:43:22
【问题描述】:
我想在 Mercurial 中应用补丁:
hg import patch_name.patch
但如果我收到错误 abort: patch failed to apply,Mercurial 会创建 *.rej 文件。
有没有办法显示 kdiff 或 vim-diif 来纠正冲突。
【问题讨论】:
我想在 Mercurial 中应用补丁:
hg import patch_name.patch
但如果我收到错误 abort: patch failed to apply,Mercurial 会创建 *.rej 文件。
有没有办法显示 kdiff 或 vim-diif 来纠正冲突。
【问题讨论】:
没有办法做到这一点。推荐的方法是打开文件和 .rej 文件并手动合并被拒绝的块。
【讨论】:
我敢打赌 hg 返回一个错误代码。也许您可以将hg import 包装在一个shell 脚本中,该脚本捕获返回的错误代码并在出现错误时执行您想要的操作?比如:
#!/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
【讨论】: