Wednesday, December 16, 2009

Mercurial error-- hg ... "abort: cannot follow nonexistent file: "

There is a simple solution near the end..

I don't know much about Mercurial, except that it's a free revision control system and included with NetBeans. I was playing with the GUI builder and didn't want to pollute a subversion-controlled project, but did want to be able to revert back if necessary, and somewhere saw that Mercurial didn't need a server.

Anyway, it was working fine, then I went away from my work for a week or so,
had some more stuff that needed to be checked in before I could test moving part of a module to another project.

.. but on trying to commit my changes in NetBeans, I got an error dialog with instructions to see the output window, which contained the arguments to hg plus the message
abort: cannot follow nonexistent file: src/com/foo/frop/
followed by one of the project files I was trying to check in.

I knew hg put its stuff in a tree somewhere, found it in NetBeansProjects/MyProject/.hg.
There is a file here for every src file in my project (filenames minorly encoded), plus a couple metadata files per directory. When I looked for the file hg complained about, it wasn't there.
Yet hg though it was checked in. How to convince it otherwise?

I didn't see any commands in the menus that looked promising,
google's first page of results were just statements that 'Mercurial is unfriendly'.
I really didn't want to spend a lot of time on this. Worst case I could create a new project and check it all in again. But I know how to mess with things which is generally the first step in reverse-engineering, so..


I moved the files out of the way,
and then Mercurial said they were gone.
I committed this change.
I moved the files back,
Mercurial said they were new.
I added them.

And I remembered something I might have done--I restored a MacBook from TimeMachine backup as a way to migrate to another machine. Possibly that Mercurial file was one of the last, or somehow that file feel in the cracks one of the times I aborted backups.

Ideally, hg or netbeans would provide some graceful recovery.

No comments: