[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: revision number
Re: revision number
Thu, 06 Jul 2006 12:19:23 -0400
Mozilla Thunderbird 1.0.6 (Windows/20050716)
-----BEGIN PGP SIGNED MESSAGE-----
[note: restoring info-cvs to recipient list]
> Thanks Jim. I actually wanted to increase 1 to my version number
> automatically every time when I check in the version file, rather than I
> add one manually to the version number. For example, if I have a version
> number defined as follows:
> #define SOFTWARE_VERSION_NUMBER VERSION_COUNT
> Can I check in this file and let the CVS adds one to the VERSION_COUNT?
> If there is a tag which could serve this purpose, could you please
> detailed which tag I could use?
Let me rephrase what you're asking, to see if I understand you correctly.
What you want is for VERSION_COUNT to be automatically incremented each
time any developer checks in any file. For example, we start off with
VERSION_COUNT being 1 when the project is created. You modify and check
in file1 and file2, and VERSION_COUNT becomes 2. I modify and check in
file3 and file4, and VERSION_COUNT becomes 3. Alice modifies and checks
in file2 and file3, and VERSION_COUNT becomes 4. I then add file5 and
VERSION_COUNT becomes 5.
If the above scenario is wrong, then please ignore the rest of this post
and correct my understanding.
If you're still reading, then that means my understanding is correct :=)
Offhand, I don't see how such a version count would be useful.
I don't think that could be accomplished very easily. The best approach
I can think of is to have a file which contains the VERSION_COUNT
definition. Your source code can then #include that file. For example,
the source code above would become:
#define SOFTWARE_VERSION_NUMBER VERSION_COUNT
version_count.h contains a single line:
const int VERSION_COUNT=1;
Write a script which invokes 'cvs update' on version_count.h, parses it,
increments the number and writes it back out. Either remember to invoke
that script before each checkin, or write another script that wraps
'cvs', and invokes that script on a commit.
Ah, here's a solution that may be simpler. One of the GNU coding
standards is to have a ChangeLog file, which gets updated each time a
developer checks anything in. Hook into the 'commitinfo' script, and
make sure that every commit includes ChangeLog (or whatever you want to
call the file). The ChangeLog file includes the RCS keyword $Revision$.
Each time the file is checked in, the revision number is automatically
incremented. However, it is in the RCS format of a.b (or a.b.c.d for
branches). This gets back to the purpose of the version count. If you
only need to be able to distinguish 'x' and 'y', then this should suit
your purposes. If, on the other hand, you need sequential numbers, then
you'll have more work to do, in which case the issue boils down to: why
do you want this, and how badly do you want it?
Dreampossible: Better software. Simply. http://www.dreampossible.ca
Consulting * Mentoring * Training in
C/C++ * OOD * SW Development & Practices * Version Management
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
Re: revision number, michael, 2006/07/02