【问题标题】:Mercurial Editor: "abort: The system cannot find the file specified"Mercurial Editor:“中止:系统找不到指定的文件”
【发布时间】:2011-01-28 02:29:11
【问题描述】:

我无法让 Mercurial 识别我的编辑器。我有一个文件 c:\windows\notepad.exe 并在命令提示符下键入“记事本”。我可以通过使用“-m”参数来提供提交标题来提交。但是一个简单的“hg commit”就会出现错误。

调用“hg --traceback commit”:

Traceback (most recent call last):
  File "mercurial\dispatch.pyc", line 47, in _runcatch
  File "mercurial\dispatch.pyc", line 466, in _dispatch
  File "mercurial\dispatch.pyc", line 336, in runcommand
  File "mercurial\dispatch.pyc", line 517, in _runcommand
  File "mercurial\dispatch.pyc", line 471, in checkargs
  File "mercurial\dispatch.pyc", line 465, in <lambda>
  File "mercurial\util.pyc", line 401, in check
  File "mercurial\commands.pyc", line 708, in commit
  File "mercurial\cmdutil.pyc", line 1150, in commit
  File "mercurial\commands.pyc", line 706, in commitfunc
  File "mercurial\localrepo.pyc", line 836, in commit
  File "mercurial\cmdutil.pyc", line 1155, in commiteditor
  File "mercurial\cmdutil.pyc", line 1184, in commitforceeditor
  File "mercurial\ui.pyc", line 361, in edit
  File "mercurial\util.pyc", line 383, in system
  File "subprocess.pyc", line 470, in call
  File "subprocess.pyc", line 621, in __init__
  File "subprocess.pyc", line 830, in _execute_child
WindowsError: [Error 2] The system cannot find the file specified
abort: The system cannot find the file specified

我尝试设置 HGEDITOR 环境变量,在Mercurial.ini 文件中设置“visual =”和“editor =”。我只尝试了完整路径和命令。我还尝试将 notepad.exe 文件复制到当前文件夹和 mercurial 文件夹中。

理想情况下,我想在“C:\PortableApps\Notepad++Portable\Notepad++Portable.exe”这个位置使用编辑器,但在这个阶段我对任何编辑器都很满意!

HG 调试配置输出:

c:\wamp\www\SiteAB.com\web>hg debugconfig
bundle.mainreporoot=c:\wamp\www\SiteAB.com\web
ui.username=killroy
ui.shell=true
ui.verbose=true
ui.visual="C:\PortableApps\Notepad++Portable\Notepad++Portable.exe"
ui.editor="C:\PortableApps\Notepad++Portable\Notepad++Portable.exe"

【问题讨论】:

  • 你在使用win7 64bit吗?我遇到了类似的问题,并在bitbucket.org/tortoisehg/stable/issue/1361/… 开始了报告
  • 我似乎通过重新安装操作系统解决了我的问题。极端措施...
  • 我猜这迟早会发生!不过还是很烦。但是为什么它不能只执行我给它的可执行文件呢?

标签: configuration mercurial editor notepad++


【解决方案1】:

当您在 Mercurial.ini 文件中设置 editor = 时,您是在 [ui] 部分中进行的,对吧?

这样做之后可能会提供hg debugconfig的输出?

【讨论】:

  • 我已经添加了输出。但正如我所提到的,我尝试了各种不同的咒语,包括一个简单的“编辑器 = 记事本”,但都不起作用。能够查看它试图执行什么命令来打开编辑器将非常有用。也许这是某种路径修改问题?
【解决方案2】:

editor = notepad 不起作用表明您的环境有问题。由于从命令行运行记事本有效,我想知道问题是否与您的 python 安装有关。您的回溯让我认为您正在运行 hg 1.5,这是您发布时的最新版本。虽然我不认为它应该有所作为,但更新到 1.5.4 并没有什么坏处。

您正在从 C: 驱动器运行 Notepad++Portable。通常将 PortableApps 安装到可移动驱动器上。你确定 hg 应该看 C: 吗?我知道有时对于非特权用户来说,在本地安装它们会很方便。 Notepad++Portable 不会与 hg 搭配得特别好。您需要完全关闭 npp 并从 hg 生成它,否则提交将不起作用。如果可以的话,我会尝试运行完整版的Notepad++。这是我使用的:

[ui]
editor = "C:\Program Files\Notepad++\notepad++.exe" -multiInst -nosession

-multiInst 告诉 npp 为 hg 打开一个新实例。这样它就不会干扰您已经打开的任何 npp 窗口。这不适用于 PortableApps 版本。
-nosession 告诉 npp 不要打开您之前打开的任何文件,从而加快启动时间并减少混乱。当我写提交信息时,我想专注于我的信息,而不是被一堆不相关的标签分心。

【讨论】:

  • 这是正确的路径。我使用 PortableApps 以方便备份和传输。不要从记忆棒中使用。如果您调用主可执行文件(就像我一样),则没有多实例检查或问题。不过,我会试试你的参数。
  • 我使用了上述配置,减去将其更改为 Program Files (x86),因为我运行的是 Windows 7 64 位。完美运行,谢谢。我要补充一点,我遵循了用 notepad++“替换”记事本的指南,但这对 hg 来说并不透明,可能是因为 notepad++ 使用 Windows 目录中的存根程序来启动主可执行文件以响应打开“记事本”。 exe”。
猜你喜欢
  • 2015-09-09
  • 1970-01-01
  • 2019-08-03
  • 2014-03-16
  • 1970-01-01
  • 2013-11-21
  • 2023-03-17
  • 2017-12-21
相关资源
最近更新 更多