Best practice to store Subversion revision info app-wise

37 Views Asked by At

Subversion has the $Rev$ keyword, that's replaced by in example $Rev: 1843 $ when a file with that keyword is committed. Subversion places on it the revision this commit created.

I'd like to use this info on my apps, so that after compiled an app stores its latest revision and reports it together with its version on about page.

What's the best practice to do it, considering that any file may be the latest committed?

I'm considering creating a method on the Core class that receives this string and parses the number from it, then each class would call this method on their constructor, passing the string handled by Subversion. Then on the method I store the greater number.

But this seems whacky, so I'd like to know if there's a better way to implement it.

Also, is there a keyword for the commit datetime?

1

There are 1 best solutions below

0
On

What's the best practice to do it, considering that any file may be the latest committed?

Just don't use file-specific keywords and have different sources of repository-wide information.

  • In case of "pure" SVN, you can, f.e., rely on svn info output for (preferrable clean) WC or even remote repository-URL, maybe on XML-output
  • If you can have TortoiseSVN, you have SubWCRev with it, with can do all dirty job of extracting all needed data from WC for you (you can even run it from post-commit hook and have always correct data-file automatically)

Also, is there a keyword for the commit datetime?

Alot of.

From a box you have Date|LastChangedDate, part of Id keyword is also date in different, than in Date, format.

Starting from SVN 1.8, you can define own custom keywords and have own date-string for your needs