eDeviser
eDeviser

Reputation: 1873

How to manage revision numbering in a SVN tag?

I wonder how to deal with the RN (revision number) in my software project. The RN is placed in a separate header file and is shown in the about view and looks something like this: v1.23.456

Normally I crate a tag like this:

1. Create the tag by:

svn copy http://myrepo/trunk http://myrepo/tags/1.23.456 -m"Tagged version 1.23.456"

2. Check out the tag and edit the RN:

svn co http://myrepo/tags/1.23.456
gedit revisionNumber.h

3. Check in the adapted RN:

svn ci revisionNumber.h -m"Adadpted RN"

--> It is a bad workaround to edit a tag. But I don not know another way to manage the RN. So my question is:

How to manage revision numbering in a SVN tag?

Upvotes: 4

Views: 178

Answers (2)

Doug Richardson
Doug Richardson

Reputation: 10811

You can do it one of two ways, depending on how you are building your released software.

Manual with post-commit enforcement

  1. Commit revisionNumber.h before you tag.
  2. Write a post-commit that only allows a tag to be made if revisionNumber.h is correct (it matches the tag). You can implement this in the post-commit hook using svnlook cat and grep.

The downside of this approach is that you still have to update the revision number in two places, but the post-commit hook at least makes sure you don't screw up.

Build Bot

This only applies if you have a build bot or build process.

  1. To create a tag, use your svn copy command to a tags folder.
  2. Write a post-commit hook that observes this folder and kicks off a build, providing the build with the tag.
  3. The build bot updates revisionNumber.h and produces the build.

In this approach, revisionNumber.h is never updated in your repository and so the version number is probably invalid most of the time. If you have code that depends on the revision number (i.e., it isn't for display only) this may not be a good solution.

Upvotes: 1

bahrep
bahrep

Reputation: 30662

One of the possible solutions is to edit the version with gedit revisionNumber.h and commit this change to trunk before tagging your release.

Use some -dev or -nightly labels for work in progress such as 1.23.456-dev. Remove -dev from the version and tag your release when ready.

BTW, look through Apache Subversion project's Making Subversion Releases guide. It may give you more information and will possible answer your other questions.

Upvotes: 2

Related Questions