Search code examples
mercurialtortoisehg

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


Solution

  • 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.