简体   繁体   中英

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.

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM