Sergey11g
Sergey11g

Reputation: 1347

Mercurial insert CURRENT revision number in files on hg archive

I need the current version (version of the latest file) and it's tag to be included in files when I do hg archive. When using keywords extension in includes the latest version of each file, not the current version. Example:

repository contents:
file1  Jan 1st 2013 latest change tag v2.0
file2  Mar 1st 2013 latest change tag v1.0

What I need is to generate archive for v2.0 and automatically insert "v2.0" in each file, even if it hasn't been changed under 2.0 changeset.

Upvotes: 0

Views: 669

Answers (1)

Ry4an Brase
Ry4an Brase

Reputation: 78330

This is better done in your build/packaging/release system not in your source control system. Since you're using hg archive (great choice) then theres a .hg_archive.txt file that's available to your packaging scripts or you can pass it to your release script as a parameter.

You're better off putting something like VERSION_GOES_HERE in your files and when you're archiving do:

LATEST_TAG="$(hg log --template '{latesttag}' -r)"
perl -pie "s/VERSION_GOES_HERE/${LATEST_TAG"

Upvotes: 2

Related Questions