daniels
daniels

Reputation: 19243

Mercurial update source code with current revision numer

I there a way to update a source code file with the current revision number each time i do a commit? Something like, let's say that in my footer.php i have something like

Rev. number: {REVISION} 

And when i commit {REVISION} will be replaced with current revision number. I'm using TortoiseHG

Upvotes: 1

Views: 921

Answers (1)

Jacob Oscarson
Jacob Oscarson

Reputation: 6403

You can use RCS-type keyword expansion: https://www.mercurial-scm.org/wiki/KeywordPlan

But if your last changeset didn't include footer.php, then the keywords won't be expanded, so your probably better off having some build procedure write the current revision ID via hg id. There's an example on how to do this in the link above.

Upvotes: 2

Related Questions