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

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"

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 Files\Notepad++\notepad++.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.

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 ?

Related

Mercurial commit fails: "The system cannot find the file specified", but it is not really specified

I can't commit a single file by Mercurial. Here are different variants of the command:
The variant with --traceback
C:\Users\543829657\workspace\dev.appl.ib.cbl>hg commit --traceback "--message=Ad
ded a task Xml2Java for creation request/response files" --user "Petr Gangnus <petr.gangnus#moneta.cz>" -- application/build.gradle
transaction abort!
rollback completed
Traceback (most recent call last):
File "mercurial\dispatch.pyo", line 160, in _runcatch
File "mercurial\dispatch.pyo", line 885, in _dispatch
File "mercurial\dispatch.pyo", line 646, in runcommand
File "mercurial\extensions.pyo", line 168, in closure
File "hgext\color.pyo", line 521, in colorcmd
File "mercurial\dispatch.pyo", line 976, in _runcommand
File "mercurial\dispatch.pyo", line 947, in checkargs
File "mercurial\dispatch.pyo", line 882, in <lambda>
File "mercurial\util.pyo", line 716, in check
File "mercurial\commands.pyo", line 1546, in commit
File "mercurial\cmdutil.pyo", line 2456, in commit
File "mercurial\commands.pyo", line 1540, in commitfunc
File "mercurial\localrepo.pyo", line 64, in wrapper
File "mercurial\localrepo.pyo", line 1508, in commit
File "mercurial\localrepo.pyo", line 64, in wrapper
File "mercurial\localrepo.pyo", line 1596, in commitctx
File "mercurial\extensions.pyo", line 168, in closure
File "c:/Users/543829657/workspace/mercurial-tools/commitsigs.py", line 357, in add
File "c:/Users/543829657/workspace/mercurial-tools/commitsigs.py", line 168, in opensslsign
File "subprocess.pyo", line 710, in __init__
File "subprocess.pyo", line 958, in _execute_child
WindowsError: [Error 2] The system cannot find the file specified
abort: The system cannot find the file specified
The variant with --debug
C:\Users\543829657\workspace\dev.appl.ib.cbl>hg commit --debug "--message=
Added a task Xml2Java for creation request/response files" --user "Petr Gangnus <petr.gangnus#moneta.cz>"
-- application/build.gradle
calling hook precommit.checkfiles: hghook_precommit_checkfiles.fixup_hook
checkfiles: removing tabs and/or trailing whitespace in changed files...
checkfiles: opts:
checkfiles: checked extensions:
checkfiles: ignored extensions: .sln .suo .vcproj .csproj .ui
checkfiles: ignored files:
checkfiles: check diffs only: False
checkfiles: use spaces: True
checkfiles: tab size: 4
checkfiles: considering files:
application/build.gradle
checkfiles: application/build.gradle ok
committing files:
application/build.gradle
committing manifest
committing changelog
transaction abort!
rollback completed
abort: The system cannot find the file specified
My colleagues and me had cleaned the project committed, re-cloned it, pulled changes or not, checked all python scripts and ssh keys for reachability... It should be OK, but it is not.
I have a suspision that while the error in the "--debug" variant appears after committing changelog, it could be something with it? I don't see any file that is named "changelog" in the project and there are three containing that word and they all are obviously old - cloned from repository.
About duplication of questions. It seems that that or similar message pops up in very many absolutely different situations:
Mercurial Editor: "abort: The system cannot find the file specified" - The commit fails in this very place of the same script, but... The stack itself is different, and there fails only the commit without the message. I have the message. And the author tries to use an alternative default editor and cannot - that is his problem, absolutely different from mine. I haven't changed the editor. I have not troubles with editor. I have installed hg, cloned project, changed one file and want to commit it - that is all.
TortoiseHg can't commit--"The system cannot find the file specified" - here the error message header is not "abort:", but "abort: Adding: "
android studio gradle refresh failed (The system cannot find the file specified) - here the commit is called from Android Studio and the file IS specified
"abort: The system cannot find the file specified" in Mercurial - the messages are almost the same, only the missing file IS specified by Mercurial. And the stack is different. And in my case I can update, whereas that author could not.
In others cases on SO with that error message it is not Mercurial what invokes the error.
I have looked at many similar cases on different sites, and I had not found the same problem. Always something important was different.
#Leon has supposed an interesting version below - that the reason is incorrectly set openssl/gnupg. I have checked installation of openssl, ran hg help commitsigs - and reading the ouput, noticed such interesting property as forcesign.
If the parametr is specified with a value of 1, the commit process will be
aborted and rolled back if the changeset cannot be signed for whatever reason
(bad setup, expired certificate and so on. The default is that the commit
will still be successful, but not signed.
Yes, it looks promising. ...But even setting that property to 0 changed nothing in the situation.
The commitsigs.py entries in your stack trace suggest that the problem is due to the Commitsigs Extension. Check that
you have gnupg or openssl installed on your system
you have a valid GPG key (in case of gnupg) or a X509 certificate (in case of openssl)
and Commitsigs is properly configured (run hg help commitsigs for details). In particular, the path to gnupg or openssl must be correctly specified, otherwise you may run into the described problem even when commitsigs.forcesign mode is disabled.

how to fix "AttributeError: 'module' object has no attribute 'set_binary' "?

i compiled mercurial successfully as follows:
...
copying build/scripts-2.7/hg -> /usr/local/bin
changing mode of /usr/local/bin/hg to 755
running install_egg_info
Writing /usr/local/lib/python2.7/site-packages/mercurial-2.8.1-py2.7.egg-info
as3:~/mercurial-2.8.1# cd ~
as3:~# hg clone http://hg.cat-v.org/werc/
Traceback (most recent call last):
File "/usr/bin/hg", line 25, in <module>
mercurial.util.set_binary(fp)
File "/usr/local/lib/python2.7/site-packages/mercurial/demandimport.py", line 103, in __getattribute__
return getattr(self._module, attr)
AttributeError: 'module' object has no attribute 'set_binary'
as3:~#
how to fix it?tks.
my python version:2.7.6
Note that you have installed mercurial from sources into /usr/local/bin, but the error message mentions /usr/bin/hg. It means you have a different version of mercurial main script installed under /usr/bin/hg, which then tries to use new mercurial library from /usr/local. The error occurs, because the 2 are incompatible.
To fix this, remove older mercurial from /usr/bin. You may need to call rehash in your shell as well, for it to pick it up, depending on the shell.
If mercurial does not work then, it means /usr/local/bin is not in your PATH. If that is the case you'll need to fix the PATH, or just symlink new hg, like so:
# ln -s /usr/local/bin/hg /usr/bin
But that will require root access, for example, calling it through sudo.

Fedora 18 & Sublime Text 2: Unable to delete file

I have Fedora 18 and Sublime Text 2
I can't remove file on my project from Sublime Text 2 UI.
Console displays this when I try to delete some file:
Traceback (most recent call last):
File "./sublime_plugin.py", line 337, in run_
File "./side_bar.py", line 19, in run
File "./send2trash/plat_other.py", line 153, in send2trash
File "./send2trash/plat_other.py", line 121, in find_ext_volume_trash
File "./send2trash/plat_other.py", line 115, in find_ext_volume_fallback_trash
File "./send2trash/plat_other.py", line 60, in check_create
File ".\os.py", line 157, in makedirs
OSError: [Errno 13] Permission denied: '/.Trash-1000'
I need you help :)
This is a bug of send2trash Python library. It happens because your file is in a mount point different from the trash folder.
If you have mounted / and /home in different partitions, send2trash library can't move the file to your trash folder (usually in /home/<user>/.local/share/Trash/). So the delete procedure tries to locate the hard link that contains your file; in this case, it's /. In this directory, it looks for Trash-<user id> folder.
The default behaviour of your Linux file manager is prompt for permanent delete, what not happens in Sublime Text. To workaround this, type in terminal
sudo mkdir /.Trash-<userid>
sudo chown <user> /.Trash-<userid>
Now you're able to delete files and recover then from this folder.

Trouble with Clone of BitBucket Repository with TortoiseHg

My company (fairly new and very small at this point) is setting up versioning software to handle source code for our clients' web sites. We have a bitbucket account and we're running mercurial on the server.
I'm having trouble setting up a clone of one of the repositories on my work station (standard Dell laptop). With other repositories there is no problem, but with one in particular, the clone seems to hang on a particular file.
I right click on the folder I want to use for my local version of the repository, select TortoiseHg and then select Clone from the sub-menu. From there I enter the BitBucket repository URL and click the Clone button. It asks me for my password, which I provide, and it connects without incident. But then, after it starts adding files, ever time it gets to file 155 it hangs until the server times it out. Then it fails and I have no repository.
I'm following the advice provided here on how to set it up: http://www.basarat.com/2011/01/setting-up-mercurial-repository-with.html
As I said - this works well with other repositories, just not the one. Any ideas on what I might try?
UPDATE: Upon suggestion from one of the comments I ran it through the command line with a traceback to get my error results so I could display them. This is what it came back with:
requesting all changes
adding changesets
adding manifests
adding file changes
transaction abort!
rollback completed
Traceback (most recent call last):
File "mercurial\dispatch.pyc", line 50, in _runcatch
File "mercurial\dispatch.pyc", line 471, in _dispatch
File "mercurial\dispatch.pyc", line 341, in runcommand
File "mercurial\dispatch.pyc", line 522, in _runcommand
File "mercurial\dispatch.pyc", line 476, in checkargs
File "mercurial\dispatch.pyc", line 470, in <lambda>
File "mercurial\util.pyc", line 401, in check
File "mercurial\commands.pyc", line 681, in clone
File "mercurial\hg.pyc", line 316, in clone
File "mercurial\localrepo.pyc", line 2212, in clone
File "mercurial\localrepo.pyc", line 1477, in pull
File "mercurial\localrepo.pyc", line 2083, in addchangegroup
File "mercurial\revlog.pyc", line 1233, in addgroup
File "mercurial\changegroup.pyc", line 31, in chunkiter
File "mercurial\changegroup.pyc", line 20, in getchunk
File "mercurial\util.pyc", line 913, in read
MemoryError
abort: out of memory

Issues with Trac (installed with BitNami)

I'm facing some problems after installing Trac on my Windows 7 Ultimate 64bits using BitNami.
The Issues are:
Subversion Control
During the installation process, when the BitNami setup asks for the project repository directory, it only accept if you write a path that doesn't exist, otherwise you can't continue. So i got forced to point the path to "C:\Repositories\TRAC" (a new folder) instead of "C:\Repositories\DBG" (where the repository of the project that i was creating really are). So, after the installation, I've changed the trac.ini file at the key
[trac]
repository_dir = C:\Repositories\TRAC
repository_type = svn
to
[trac]
repository_dir = C:\Repositories\DBG
repository_type = svn
And now, when I login to the DBG project in Trac, it warns:
Warning: Can't synchronize with the
repository (The 'repository_dir' has
changed, a 'trac-admin resync'
operation is needed.). Look in the
Trac log for more information.
When I go to cmd the following happens:
C:\Users\Fernando>cd\
C:\>cd C:\Program Files\BitNami Trac Stack\trac\Scripts
C:\Program Files\BitNami Trac Stack\trac\Scripts>trac-admin resync
Welcome to trac-admin 0.11.6
Interactive Trac administration console.
Copyright (c) 2003-2009 Edgewall Software
Type: '?' or 'help' for help on commands.
Trac [C:\Program Files\BitNami Trac Stack\trac\Scripts\resync]> resync
Failed to open environment. [Errno 2] No such file or directory: 'C:\\Program Fi
les\\BitNami Trac Stack\\trac\\Scripts\\resync\\VERSION'
Traceback (most recent call last):
File "c:\program files\bitnami trac stack\trac\lib\site-packages\Trac-0.11.6-p
y2.5.egg\trac\admin\console.py", line 177, in env_open
self.__env = Environment(self.envname)
File "c:\program files\bitnami trac stack\trac\lib\site-packages\Trac-0.11.6-p
y2.5.egg\trac\env.py", line 209, in __init__
self.verify()
File "c:\program files\bitnami trac stack\trac\lib\site-packages\Trac-0.11.6-p
y2.5.egg\trac\env.py", line 277, in verify
fd = open(os.path.join(self.path, 'VERSION'), 'r')
IOError: [Errno 2] No such file or directory: 'C:\\Program Files\\BitNami Trac S
tack\\trac\\Scripts\\resync\\VERSION'
C:\Program Files\BitNami Trac Stack\trac\Scripts>
What it should be?
2-Configuring Logo:
I can't find where to place my project logo to be shown in left-top corner!
at the header_logo key:
[header_logo]
alt = DBG
height = 50
link = http://localhost:801/trac/DBG
src = ITINT150.png
width = 150
i've placed the ITINT150.png file in the same folder as trac.ini for testing (obviously i wasn't going to leave it there), but trac doesn't find it, looking at the html code of the link tag generated, it points to: src="/trac/DBG/chrome/common/ITINT150.png", but where is this folder located, so i can place the image there?
Thanks in advance!
For the resync, the first argument to trac-admin is the trac environment directory. So run
trac-admin <path-to-trac-environment> resync
As of Trac 0.12, the above command changed to:
trac-admin <path-to-trac-environment> repository resync <repository-name or '*'>
For the logo, set the src to site/ITINT150.png, and put ITINT150.png into the <path-to-trac-environment>/htdocs directory.
I tried #retracile's solution but I received a "Command not found" message from trac-admin. This is what eventually worked for me:
trac-admin </path/to/trac/env> repository resync "*"
That last argument specifies the repository to resync and can be switched with the name of a specific repo (presumably with the quotes intact; I didn't try it) if you don't want to resync all repos. See here for details: http://trac.edgewall.org/wiki/TracAdmin