DocBlock and svn:keywords

Posted by Jad on September 04, 2007

In the application’s coding conventions (which I am almost done writing), I took the time to elaborate about code documentation and the use of phpDocumentor. Among the things discussed, there is the DocBlock, the header template of each PHP file and which looks something like that:

/**
 * Short description for file.
 *
 * Long description for file
 *
 * PHP 5
 *
 * Copyright (c) 2007, Company Name
 *                     Street address
 *                     City, State, Zip
 *
 *
 * @filesource   $HeadURL$
 * @copyright    Copyright (c) 2007, Company Name
 * @link         http://www.companywebsite.com CompanyName
 * @package      #### PACKAGE NAME ####
 * @sub-package  #### SUBPACKAGE NAME ####
 * @since        #.#.#  //Correct version number as needed
 * @version      $Revision$
 * @author       Your Name
 * @modifiedby   $LastChangedBy$
 * @lastmodified $Date$
 */
Now you might be asking yourself what are all those $HeadURL$, $Revision$, etc. Those are ‘keywords’ for Subversion which can be dynamically updated on every commit. By default, Subversion doesn’t substitute those keywords but you can easily set that directly from the shell using:
$ svn propset --recursive svn:keywords 'HeadURL Revision LastChangedBy Date' /path/to/repo
Or, in case you are using TortoiseSVN, from the right-click menu of your repository’s folder - TortoiseSVN > Properties > Add. You can then enter ’svn:keywords’ in the ‘property name’ field and ‘HeadURL Revision LastChangedBy Date’ in the ‘property value’ field. Don’t forget to check the ‘apply property recursively’, otherwise, make sure you are only setting it on a file not a directory.

From the svn propset help shell command:

The svn:keywords, svn:executable, svn:eol-style, svn:mime-type and svn:needs-lock properties cannot be set on a directory. A on-recursive attempt will fail, and a recursive attempt will set the property only on the file children of the directory.

Trackbacks

Use this link to trackback from your own site.

Comments

Leave a response

Comments