I am wondering if Mercurial by default converts $Id$ to the equivalent of Subversion which is something like this: test.php 110 2009-04-28 05:20:41Z dordal $. Does anyone know?
No, it won't, but you can enable it.
https://web.archive.org/web/20121007024058/
https://www.mercurial-scm.org/wiki/KeywordPlan
Why You Don't Need It
Keyword expansion is not supported in the core of Mercurial because it's of limited utility in a modern system and it's problematic from performance and binary integrity standpoints. For most human uses, one can simply ask the revision control system. And for situations where the revision control system is not available, the tag is very likely to be incorrect!
One common use that remains is automatically integrating version information into a software build. This is pretty easily accomplished without keyword substitution by doing something like the following in your Makefile:
...
Basic Emulation
If that's not enough for you, it is possible to emulate this behavior with an extension.
...
An example extension that provides $Author$ and $Date$ keywords is attached (keyword.py)
See also KeywordExtension.
https://www.mercurial-scm.org/wiki/KeywordExtension
Keyword Extension
This extension is distributed with Mercurial
Overview
This extension allows the expansion of RCS/CVS-like and user defined keys in text files tracked by Mercurial. Expansion takes place in the working directory or/and when creating a distribution using "hg archive".
Keywords expand to the changeset data pertaining to the latest change relative to the working directory parent of each file.
If you just want to version your entire repo, do not use this extension but let your build system take care of it. Something along the lines of ...
,,,
For speed and security reasons (avoidance of inadvertently expanded keywords) it is recommended to enable the extension per repo only in repo/.hg/hgrc, not globally, and to fine tune the [keyword] filename patterns with great care.
You have a similar feature with Keyword Extension (distributed with Mercurial)
This extension allows the expansion of RCS/CVS-like and user defined keys in text files tracked by Mercurial. Expansion takes place in the working directory or/and when creating a distribution using "
hg archive
".Keywords expand to the changeset data pertaining to the latest change relative to the working directory parent of each file.
For instance:
Id = {file|basename},v {node|short} {date|utcdate} {author|user}
would be expanded as:
$Id: demo.txt,v 2ad3dcb8d811 2007/07/17 12:00:47 blacktrash $
Note:
For speed and security reasons (avoidance of inadvertently expanded keywords) it is recommended:
- to enable the extension per repo only in
repo/.hg/hgrc
, not globally,- and to fine tune the
[keyword]
filename patterns with great care.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With