Mercurial Editor:“中止:系统找不到指定的文件”
我在让 Mercurial 识别我的编辑器时遇到问题。我有一个文件 c:\windows\notepad.exe
并在命令提示符下键入“notepad”即可。我可以通过使用“-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 环境变量,设置“visual =
”和“editor =< /code>”在
Mercurial.ini
文件中。我尝试了完整路径以及仅命令。我还尝试将 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"
I have a problem getting Mercurial to recognise my editor. I have a file, c:\windows\notepad.exe
and typing "notepad" at the command prompt works. I can commit by using the "-m
" argument to supply the commit title. But a simple "hg commit
" brings up the error.
A call to "hg --traceback commit
" brings up:
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
I've tried setting the HGEDITOR environment variable, setting "visual =
" and "editor =
" in the Mercurial.ini
file. I tried full path as well as command only. I also tried copying the notepad.exe file into both the current folder as well as the mercurial folder.
Ideally I would like to use the editor at this location "C:\PortableApps\Notepad++Portable\Notepad++Portable.exe
", but at this stage I would be happy with any editor!
HG debugconfig output:
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"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
editor = notepad
不起作用表明您的环境存在问题。由于从命令行运行记事本可以工作,我想知道问题是否出在您的 python 安装上。你的回溯让我认为你正在运行 hg 1.5,这是你发布时最新的。虽然我不认为这会产生什么影响,但更新到 1.5.4 也没什么坏处。您正在从 C: 驱动器运行 Notepad++Portable。通常,人们将便携式应用程序安装到可移动驱动器上。您确定 hg 应该查看 C: 吗?我知道有时对于非特权用户来说在本地安装它们会很方便。 Notepad++Portable 与 hg 的配合不太好。您需要完全关闭 npp 并从 hg 生成它,否则提交将不起作用。如果可以的话,我会尝试运行完整版本的 Notepad++ 。这是我使用的:
-multiInst
告诉 npp 仅为 hg 打开一个新实例。这样它就不会干扰您已经打开的任何 npp 窗口。这不适用于 PortableApps 版本。-nosession
告诉 npp 不要打开您以前打开过的任何文件,从而加快启动时间并减少混乱。当我编写提交消息时,我想专注于我的消息,而不是被一堆不相关的选项卡分散注意力。That
editor = notepad
didn't work suggests something is wrong with your environment. Since running notepad from the command line works, I wonder if maybe the problem is with your python installation. Your backtrace makes me think you're running hg 1.5 which was current when you posted. While I don't believe it should make a difference, it couldn't hurt to update to 1.5.4.You're running Notepad++Portable from your C: drive. Usually one installs PortableApps to a removable drive. Are you sure hg should look at C:? I understand sometimes it can be handy for unpriviledged users to install them locally. Notepad++Portable won't play particularly nice with hg. You'll need to have npp completely closed and spawn it from hg or commits won't work. If you can, I'd try running the full version of Notepad++ instead. Here's what I use:
-multiInst
tells npp to open a new instance just for hg. That way it won't interfere with any npp windows you already have open. This does not work with the PortableApps version.-nosession
tells npp not to open any files you previously had open, speeding startup times and reducing clutter. When I'm writing a commit message, I want to focus on my message, and not be distracted by a bunch of unrelated tabs.当您在 Mercurial.ini 文件中设置
editor =
时,您是在[ui]
部分中进行操作,对吗?这样做之后可能会提供
hg debugconfig
的输出?When you set
editor =
in the Mercurial.ini file, you're doing it within the[ui]
section, right?After doing that maybe provide the output of
hg debugconfig
?