Usage of hg commit –date (mercurial)

Recently, I was trying to move some stuff from RCS to mercurial. There does not seem to exist a converter and since it was only a few revisions, I decided to do it by hand. The problem arose how to set the commit date manually and google yielded a nice blog post that answered my question (refering to the formidable but less searchable hgbook).

So its basically:

hg commit --date "1234567890 0"

where 1234567890 is the seconds since epoch and 0 is the timezone. Unfortunally I was unable to comment on the above blog posting, which triggered this posting.
On unix (and bash) you can conveniently use the date command to do the conversion:

hg commit --date "$(date -u --date '2009-2-13 23:31:30' +'%s') 0"

The date command also solves the original posters question:

Actually, I regret that it isn’t possible to define a file that mercurial will use as date reference, something like hg commit -d date filexy.ext -m “commit with autodate from file xy” would be handy. This way, getting the filesystem metadata into a repository representation would be easier, but this might be a too specific request for a standard versioning system…

Just use:

hg commit -d "$(date -u -r filexy.ext +'%s') 0" -m “commit with autodate from file xy”