[PATCH][RFC] Support for keyword expansion

Bryan O'Sullivan bos at serpentine.com
Tue Sep 20 11:36:28 CDT 2005


On Tue, 2005-09-20 at 18:20 +0200, Goffredo Baroncelli wrote:

> > With mercurial, the ChangeSet id could be a useful expansion for
> > each executable, but since hg can be used to generate that information,
> > keyword expansion would just be a convenience. 
> 
> Please, I don't understand very well, could you clarify ?

Put something like this in a Makefile:

.PHONY: hg_changeset.c

hg_changeset.c:
	hg tip -q | sed 's,.*:\(.*\),const char *hg_changeset = "@cset \1" + 6;,' > $@

You now have a variable called hg_changeset that contains the changeset
key, while using the "strings" command to look for "@cset" will yield it
from an object file or binary.

The isolation of this in one file is a lot more useful than keyword
expansion scattered throughout the tree, which usually causes a vast
amount of pointless recompilation.

	<b



More information about the Mercurial mailing list