Subversion File Properties
All files in the SVN repository should have the Unix style (LF) line endings. This is controlled via the Subversion "eol-style=LF" property. In addition, most files (.php, .css, .js, .ini) should have the "keywords=Id" property set. This is what allows Subversion to record the "@version" tag in the Doc block at the beginning of each file. For example,
* @version $Id: index.php 14276 2010-01-18 14:20:28Z louis $.
You only need to set these properties when you create new files and add them to version control. If you are editing existing files that are already under version control, the properties should already be set correctly.
You can set file properties either manually or you can configure Subversion to do this automatically each time you add a file to version control.
Configuration for Automatic Properties
Subversion uses a configuration file to control automatic property settings. For Mac or Linux users, this file is called
~/.subversion/config. For Windows users, this file is called
C:\Users\<your user name>\AppData\Roaming\Subversion\config. For TortoiseSVN, you can edit the configuration file right from the program. Right-click on a project, select TortoiseSVN→Settings and click on the "Edit" button next to "Subversion configuration file:".
Edit the configuration file as shown below. At the end of the file, you will see a section called
[auto-props]. Be sure to set the
enable-auto-props = yes. Also, note that "Id" is upper-case "I" and lower-case "d".
### Section for configuring automatic properties. enable-auto-props = yes [auto-props] ... *.php = svn:eol-style=LF;svn:keywords=Id *.html = svn:eol-style=LF *.xml = svn:eol-style=LF *.ini = svn:eol-style=LF;svn:keywords=Id *.css = svn:eol-style=LF;svn:keywords=Id *.js = svn:eol-style=LF;svn:keywords=Id
You can test that the change was successful by creating a new file of the desired type and adding it to version control. Then examine the SVN properties for this file and you should see the new properties automatically. See below for instructions on examining the properties.
Manually Setting File Properties
You can of course manually set or check the properties for any file that is under version control. Here is how you do this in Eclipse, command line, or TortoiseSVN.
- Eclipse: Select the desired file in the PHP Explorer view and then select Team→Show Properties. The SVN Properties view will display. You can then right-click in the view and select Add a Property. Select the Property name from the list ("svn:eol-style" or "svn:keywords"). Then enter the property value in the Property content box ("LF" or "Id"). Press OK and the new property will show in the view. You can also delete or modify a property this way.
- Command Line: Enter the command
propset svn:keywords "Id" <file name>or
propset svn:keywords "Id" <file name>. You can also use the "propdel" command to remove properties.
- TortoiseSVN:Select the desired file in Windows File Explorer then right-click and select TortoiseSVN→Properties. This will open a Properties dialog that lets you add, remove, or edit properties. To add a property, select the desired property from the list and enter the value in the Property value box.