Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
557 views
in Technique[技术] by (71.8m points)

configuration - Mercurial Editor: "abort: The system cannot find the file specified"

I have a problem getting Mercurial to recognise my editor. I have a file, c:windows otepad.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 "mercurialdispatch.pyc", line 47, in _runcatch
  File "mercurialdispatch.pyc", line 466, in _dispatch
  File "mercurialdispatch.pyc", line 336, in runcommand
  File "mercurialdispatch.pyc", line 517, in _runcommand
  File "mercurialdispatch.pyc", line 471, in checkargs
  File "mercurialdispatch.pyc", line 465, in <lambda>
  File "mercurialutil.pyc", line 401, in check
  File "mercurialcommands.pyc", line 708, in commit
  File "mercurialcmdutil.pyc", line 1150, in commit
  File "mercurialcommands.pyc", line 706, in commitfunc
  File "mercuriallocalrepo.pyc", line 836, in commit
  File "mercurialcmdutil.pyc", line 1155, in commiteditor
  File "mercurialcmdutil.pyc", line 1184, in commitforceeditor
  File "mercurialui.pyc", line 361, in edit
  File "mercurialutil.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:PortableAppsNotepad++PortableNotepad++Portable.exe", but at this stage I would be happy with any editor!

HG debugconfig output:

c:wampwwwSiteAB.comweb>hg debugconfig
bundle.mainreporoot=c:wampwwwSiteAB.comweb
ui.username=killroy
ui.shell=true
ui.verbose=true
ui.visual="C:PortableAppsNotepad++PortableNotepad++Portable.exe"
ui.editor="C:PortableAppsNotepad++PortableNotepad++Portable.exe"
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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:

[ui]
editor = "C:Program FilesNotepad++
otepad++.exe" -multiInst -nosession

-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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...