Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display latest revision in a file?

Tags:

versioning

svn

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?

like image 560
mike Avatar asked Sep 20 '08 10:09

mike


3 Answers

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.

like image 55
benzado Avatar answered Sep 25 '22 01:09

benzado


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.

like image 45
DiGi Avatar answered Sep 25 '22 01:09

DiGi


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.

like image 44
unexist Avatar answered Sep 25 '22 01:09

unexist