[Rd] pointers on including SVN revision number in package info?

Dirk Eddelbuettel edd at debian.org
Fri Jan 6 22:09:39 CET 2012


On 6 January 2012 at 20:37, Prof Brian Ripley wrote:
| The Subversion book?  The MASS/DESCRIPTION file has
| 
| gannet% svn proplist DESCRIPTION
| Properties on 'DESCRIPTION':
|    svn:keywords

Yep, I do the same for the $Date$ property in my DESCRIPTION files.  Upon
commit of the file (eg when incrementing the minor version), the date gets
updated automagically.  You have to set the Date property, which even has its
own sub-menu if you happen to use the psvn mode under the One True Editor (TM).
 
Eg for the most recent Rcpp:

   Date: $Date: 2011-12-25 14:14:33 -0600 (Sun, 25 Dec 2011) $

and the two $ signs give it away if you know these SVN tricks...

| Note this only tracks the version when DESCRIPTION is changed, not what 
| anything else is updated.  But then I change the DESCRIPTION file 
| immediately before release.

Correct.

The flipside is that you can also add $Revision$, $URL$, ... to each R source
file individually, and they all get their own stamps.  I luuuv monotonically
increasing SVN revs, but some git fanboy will surely chime in within the hour
and tell me that I am off my rocker. ;-)
 
| >    Or can people suggest other useful strategies for keeping track of
| > which development (micro-)version a random user might be working with?

You cannot do something simple

    Version: 0.2.3.$Revision$

because the $ will stay there, as discussed above. But you can filter.  In
the littler sources we do this with a helper script (which I include below).
That gets us this revision display with an autocreated header file:

   edd at max:~$ r --version | head -2
   r ('littler') version 0.1.5
   	   svn revision 185 as of 2011-09-17 09:35:56
   edd at max:~$ 

You can use the other magic keywords listed in section "Keyword Substitution"
in Chapter 3: "Advanced Topics" of the SVN book which Brian Ripley already
pointed to.

Dirk

-- 
"Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
dark to read." -- Groucho Marx



More information about the R-devel mailing list