Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will Mercurial automatically convert $Id$ to what Subversion does?

Tags:

mercurial

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?

like image 954
Darren Avatar asked Dec 13 '10 06:12

Darren


2 Answers

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.

like image 54
Bert F Avatar answered Nov 15 '22 09:11

Bert F


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.
like image 25
VonC Avatar answered Nov 15 '22 09:11

VonC