20 June 2009

Mercurial and moving of files.

A problem, when you're using Mercurial forversioning is, that Mercurial only knows about files and there paths. This results in two types of trouble.
First you cannot commit an empty directory. It will be just ignored. To solve his, create a hidden empty file (one with a dot at the beginning of the name like '.hidden') and commit it.
Second you cannot just rename, or move a file. Mercurial will think, that there is a new file and the old one isn't available anymore and that fact crashes your commit. To solve this, Mercurial provides the command 'mv' (like the UNIX command). Just type
hg mv path/to/my/SourceFile path/to/my/DestFile
into your Terminal and you're moving or renaming it. Mercurial will then understand, that both files are the same.

No comments: