【问题标题】:In Mercurial on Windows how do I set (any) editor correctly? (Can't commit)在 Windows 上的 Mercurial 中,如何正确设置(任何)编辑器? (不能提交)
【发布时间】:2013-05-18 02:23:04
【问题描述】:

我在 Windows XP 上安装了 TortoiseHg。虽然我可以从命令行正常使用大多数hg 命令,但我不能使用hg commit(没有-m 选项),因为它无法启动我的编辑器。这就是发生的事情:

> hg commit
/c: /c: is a directory
abort: edit failed: notepad.exe exited with status 126

在 mercurial.ini 中,我将编辑器设置为: [用户界面] 编辑器 = notepad.exe

如果我自己在命令行中输入notepad.exe 甚至只是notepad,那么记事本就可以正常工作。将编辑器变量更改为其他变量(例如 foobar)确认 Mercurial 正在读取变量并尝试运行 foobar 并得到相同的结果 (foobar exited with status 126)。

我在使用 TortoiseHg GUI 的某些部分时也遇到了问题。单击时,“查看修订版”等上下文菜单选项不起作用。大概他们正在尝试启动编辑器但失败了。

这个问题在使用 Mercurial 大约 2 1/2 年的时间里一直存在,我已经尝试了所有我能想到的以另一种方式设置编辑器变量或将其设置到另一个程序的方法。当前使用 TortoiseHg 2.8 版(“与 Mercurial-2.6、Python-2.7.3、PyQt-4.9.6、Qt-4.8.4”)。

相关问题:
Using other editor with TortoiseHg
How do I specify a different editor for Mercurial on Windows?
Mercurial Editor: "abort: The system cannot find the file specified"

【问题讨论】:

    标签: configuration mercurial editor tortoisehg


    【解决方案1】:

    没多久我才意识到这个问题。 Mercurial 和 TortoiseHg 将我的 Editor 变量的值运行到命令解释器中,并且该解释器是COMSPEC 环境变量指定的任何一个

    显然,我一生中有一次将此变量设置为 msys shell C:\msys\bin\sh.exe(可能是徒劳地尝试解决与我在这里询问的问题不同的问题)。有趣的错误是因为 msys shell 被发送像/c notepad.exe 这样的参数作为参数引起的。

    如果 Mercurial 也决定也使用 COMSPEC,我不知道为什么要传递额外的 /c 开关(特定于 cmd.exe)。此外,在从 TortoiseHg 编辑设置时,我有些误导地告诉我,如果我的 mercurial 配置文件中的 Shell 值未指定,那么它在 Windows 上将默认为 cmd.exeShell 的值可能用于其他用途,例如“打开终端”上下文菜单。

    【讨论】:

      猜你喜欢
      • 2010-10-12
      • 1970-01-01
      • 2010-09-05
      • 2011-04-25
      • 2010-10-02
      • 2017-03-08
      • 1970-01-01
      • 1970-01-01
      • 2019-10-25
      相关资源
      最近更新 更多