【问题标题】:Python custom Mercurial merge tool in process?Python自定义Mercurial合并工具正在进行中?
【发布时间】:2018-04-13 21:24:11
【问题描述】:

给定一个自定义的 hg 合并工具mymergetool.py

在 Linux 上,我可以这样做:

merge-tools.MyMergeTool.executable=mymergetool.py

在新进程中运行 python。

但是在 Windows 上必须将 python.exe 指定为可执行文件。 但是考虑到系统上可能不存在(我使用嵌入在应用程序中的 hg)

我希望能够做这样的事情

merge-tools.MyMergeTool.executable=python:mymergetool.py

它在与 hg 相同的进程中运行合并工具。

但是,在阅读 hg 的 filemerge.py 时,似乎在这种情况下不支持 python: 前缀。

有没有其他方法可以提供可以在进程中运行的自定义合并工具?(例如,使用挂钩或扩展)

我想这样做的原因

  1. 我不想在我的应用程序中发布 python.exe。 (次要)
  2. 在某些系统(例如 iOS)上,很难启动外部进程,因此在进程中运行自定义合并工具会使事情变得容易得多。

【问题讨论】:

  • 将这个功能添加到 mercurial 本身可能是最简单的......

标签: mercurial mercurial-hook mercurial-extension


【解决方案1】:

这在 Mercurial 4.7 和更新版本中现在是可能的。 MergeTool configuration documentation

(Release Notes)

一个指定一个python文件和一个python函数。

merge-tools.MyMergeTool.executable=python:mymergetool.py:mergefn

函数签名是这样的:

def mergefn(ui, repo, args, **kwargs):

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-03-14
    • 1970-01-01
    • 2014-05-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多