Question

I'm wondering how do you deal with displaying release revision number when pushing live new versions of your app?

You can use $Rev$ in a file to get latest revision, but only after you update the file.

What if I want to update a string in one file every time I change any file in the repository/directory?

Is there a way?

Was it helpful?

Solution

Did you try to use hooks? They work on server-side only but may do the trick. Otherwise I would just call a script do update the revision if the keywords aren't suitable for you.

OTHER TIPS

The best way to do this is have a build script for releases that will determine the revision number using svnversion or svn info and insert it into a file. It's always helpful to have a script which:

  1. checks out a clean copy of the source into an empty directory
  2. uses svnversion or something similar to compute a build number
  3. compiles source into a product
  4. creates an archive (zip or tarball or whatever) of the product
  5. cleans up: deletes everything but the archive

Then you have a one-step process to create a release with an easily identifiable version. It also helps you avoid giving someone a build from your own working copy, which may have changes that were never checked into source control.

There is a simple tool in TortoiseSVN named SubWCRev.exe. It takes revision from path and create file from your own template. You can use it as prebuild command.

Automatically update the file as part of building/deploying the release.

On the one project where I had a reason do this, I cheated: it calls svnversion on itself when it starts up.

As alexander said, one way is to update the revision as part of the build process.

One method of doing this is to take your release builds from an automated build process triggered from your version control checkin, by using a tool such as buildbot.

A scenario might be to trigger the automated build using the post-hook script on your subversion repository. This causes your buildbot to update to the most recently checked in revision. Your build script (eg. Makefile) would use 'svnversion' (or 'svn info' and grep) to read the repository revision and write it into a header file before the build takes place.

After the successful build, automatically check this file back into the repository with a suitable comment about the release version.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top