HowToUseTheSubversionIdTag (diff)

You must first sign up to be able to contribute.

Changes from Version 1 of HowToUseTheSubversionIdTag

djjuhasz (IP:
09/16/08 22:38:25 (9 years ago)



  • HowToUseTheSubversionIdTag

    v0 v1  
     1Note: Most of this information is applicable to any OS, but some of the commands are specific to Linux - our OS of choice. 
     3When I was started working with symfony, I wanted to include the cool "SVN: $Id" tags that Fabien had in his phpdoc !DocBlocks at the head of each file. I did some google searching to find out how to get this working, but I didn't find any helpful information, and I eventually just gave up. Yesterday, the revision number suddenly "just worked" for one of my svn commits, much to my surprise - so I did some more investigation into what was going on, and thought I'd share what I found. 
     5Here's a typical file-level !DocBlock for our project (note: we are using the symfony [ alternative action class syntax] ): 
     9 * @package    qubit 
     10 * @subpackage repository 
     11 * @author     David Juhasz <david@a*********> 
     12 * @version    svn:$Id$ 
     13 */  
     14class RepositoryListAction extends sfAction 
     19The $Id$ bit is an [ svn keyword], which tells subversion to replace $Id$ with information about the current version of the file in the subversion repository. The gotcha is that you need to make sure that the "svn:keywords" property "Id" is set for the file in question, or else it won't work! 
     21If you have a file where the $Id$ tag is not getting replaced, use "svn propget svn:keyword <filename>" (at the commandline) to get the current keywords for the file in question. If the "Id" keyword is not in the list of returned values (or if you have no returned values) you can use "svn propset" or "svn propedit" to add the "Id" tag to the list of keywords (See: 
     23You can also setup your "~/.subversion/config" file "auto-props" setting so that all new files added or imported into your repository automatically have the "svn:keyword" property set (See: 
     25The replaced $Id$ looks something like this: 
     30 * @version    svn:$Id: listAction.class.php 1360 2008-09-10 00:21:46Z david $ 
     35Hope that saves someone some time and frustration!