I want to have auto-generated version number in format of 'x.x.x' or something similar to 'git tag' in Perforce. Any ideas?
I was not aware git tag could produce automatically a version number.
You may allude to git describe
RCS can be a way to store, and then display the version, not to generate one.
Version number schemes are many (p4 uses its own), plus labels need to be cleaned up once in a while.
You will need some kind of script to generate one (the followinf comes from the p4 mailing list):
For the dweeb who insists that "every last change requires a new version stamp" I'd suggest the following: [Warning: this is Perforce-centric.]
- Your makefile could generate version.h by running a script that does something like this:
CHANGENUM=`p4 changes -m1 -s submitted //depot/main/...#have | cut -f2 -d' '`
echo "#define VERSION \"main codeline to change #$CHANGENUM\" " > $SRC/include/version.h
2 . Then you do a build and the version string (for anything that references
VERSION
) is automatically correct.
Of course, I'd do thisversion.h
trick for "official builds" and "overnight builds" and make the defaultversion.h
that developers use have a hard-coded string to the effect of "build from main codeline but not official - do not deploy".