Exposing SVN revision numbers.

Peter Corlett abuse at cabal.org.uk
Sat Oct 14 20:48:19 BST 2006


On Fri, Oct 13, 2006 at 05:04:41PM +0100, Edmund von der Burg wrote:
[...]
> * get $Revision$ from a specific file - sucks cos you need to keep
> changing that file.
> * grab it from the server - sucks cos it keeps changing.
> * get it as part of deployment - sucks cos it does not work in the sandbox.

You can run "svnversion ." against your checked-out copy to get a revision
number for your subtree. It doesn't increase with activity outside that
subtree.

I would typically have a $Id$ in each individual file, plus have "make dist"
(or whatever else you use to build a package) do "svnversion ." to generate
a release number for your bundle of files.

If the output of svnversion doesn't match /^\d+$/, then your working copy
doesn't actually correspond to any particular revision in the repository,
which can be used as a handy sanity check against building packages that
cannot be reconstructed from the repository alone.



More information about the london.pm mailing list