Feb 26, 2009

Set SVN properties for TYPO3 extensions

TYPO3 core uses certain coding conventions. One part of these conventions is Unix line ending and file information block form

Unix line endings

Unix line ending are standard in TYPO3. It is easy to enforce them with SVN. SVN has a property named 'svn:eol', which defines what line endings a file gets during checkout. For TYPO3 core and extensions this property should be set to LF. Here is how to do it from the command line (shell):
svn ps svn:eol LF class.tx_myext_whatever.php
All text files inside the extension should have this property.

File information block

File information block is located at the top of the file. Typically it looks like this:
* $Id: $
There can be also text and function list. But our attention now should be dedicated to the second line from the bottom. It is contains an important SVN property that shows who was the last updater of the file. Here is how it should like in the committed file:
* $Id: class.tx_realurl_advanced.php 16142 2009-01-28 13:43:57Z dmitry $
This line shows:
  • File name
  • SVN revision number
  • Date when this revision was made
  • SVN user name of the developer who committed the file
To automatically update this information, another SVN property should be set. Here is the way:
svn ps svn:keywords Id class.tx_myext_whatever.php
When properties are changed, the file becomes modified and should be committed. I usually commit such changes with the comment like "SVN property added".
Using properties is easy and helpful in several ways. It ensures that files look the same across platforms and provides quick information about file's last modification.

No comments:

Post a Comment