【问题标题】:how to apply patch in mercurial and show diff tool if failed apply如何在 mercurial 中应用补丁并在应用失败时显示差异工具
【发布时间】:2011-11-04 07:43:22
【问题描述】:

我想在 Mercurial 中应用补丁:

hg import patch_name.patch

但如果我收到错误 abort: patch failed to apply,Mercurial 会创建 *.rej 文件。

有没有办法显示 kdiff 或 vim-diif 来纠正冲突。

【问题讨论】:

    标签: python mercurial patch


    【解决方案1】:

    没有办法做到这一点。推荐的方法是打开文件和 .rej 文件并手动合并被拒绝的块。

    【讨论】:

      【解决方案2】:

      我敢打赌 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
      

      【讨论】:

        猜你喜欢
        • 2010-10-05
        • 1970-01-01
        • 2011-12-29
        • 1970-01-01
        • 2012-01-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多