User Tools

  • Logged in as: anonymous (anonymous)
  • Log Out

Site Tools


mantisbt:svn_config

This is an old revision of the document!


Subversion configuration for Mantis Developers

Author: Martin Fuchs

Subversion uses the concept of file “properties” (see also SVNBook - Properties) to record additional information for the files in the repository. A property in this context is just a key name with an associated value. Subversion can store any number of properties per file. In principle you can store any textual key/value information you want to add some meta information to your files. There are a number of reserved property names, Subversion uses internally to manage for example file types, file content encoding, executable flags, and keyword substitution. All this information is stored in the central Subversion repository on a file by file basis. You can configure them manually using the SVN command line or some graphical tool like TortoiseSVN or Subclipse. But this a quite error prone task, you can easily forget to set some property when checking in a new file. So you should setup your SVN client to do this automatically for you. When adding new files to the repository SVN sets the file properties automatically setting on file extensions. I will describe the preferred configuration of the local environment for Mantis Developers in the following. It sets the svn:eol-style for text files (non-binary files) and the svn:keywords property for all files eventually containing the $Id keyword.

On Windows the configuration is stored in the registry under the key KEY_CURRENT_USER\Software\Tigris.org\Subversion\Config. You should download the following file and launch it by double clicking to import the settings in the registry:

subversion_mantis_config.reg

REGEDIT4

[HKEY_CURRENT_USER\Software\Tigris.org\Subversion\Config\auto-props]
"*.php"="svn:eol-style=native;svn:keywords=Author Date Id Revision"
"*.txt"="svn:eol-style=native;svn:keywords=Author Date Id Revision"
"*.css"="svn:eol-style=native"
"*.js"="svn:eol-style=native"
"*.sample"="svn:eol-style"
"*.html"="svn:eol-style=native"
"*.htm"="svn:eol-style=native"
"*.htaccess"="svn:eol-style=native"
"*.png"="svn:mime-type=image/png"
"*.jpg"="svn:mime-type=image/jpeg"
"*.gif"="svn:mime-type=image/gif"

[HKEY_CURRENT_USER\Software\Tigris.org\Subversion\Config\miscellany]
"enable-auto-props"="yes"

Under Unix the configuration is located in the file “$HOME/.subversion/config” in your home directory:

$HOME/.subversion/config

### Set enable-auto-props to 'yes' to enable automatic properties
### for 'svn add' and 'svn import', it defaults to 'no'.
### Automatic properties are defined in the section 'auto-props'.

enable-auto-props = yes

### Section for configuring automatic properties.
### The format of the entries is:
###   file-name-pattern = propname[=value][;propname[=value]...]
### The file-name-pattern can contain wildcards (such as '*' and
### '?').  All entries which match will be applied to the file.
### Note that auto-props functionality must be enabled, which
### is typically done by setting the 'enable-auto-props' option.

[auto-props]
*.php = svn:eol-style=native;svn:keywords=Author Date Id Revision
*.txt = svn:eol-style=native;svn:keywords=Author Date Id Revision
*.css = svn:eol-style=native
*.js = svn:eol-style=native
*.sample = svn:eol-style=native
*.html = svn:eol-style=native
*.htm = svn:eol-style=native
*.htaccess = svn:eol-style=native
*.png = svn:mime-type=image/png
*.jpg = svn:mime-type=image/jpeg
*.gif = svn:mime-type=image/gif

For more information about the “enable-auto-props” and “auto-props” options also see the Subversion documentation:

SVNBook - Configuration options

automatic property setting

For convenience I did set up a cronjob, which checks the properties of all files in the repository trunk with the following commands:

find . -name \*.php -exec svn propset svn:eol-style native {} \;
find . -name \*.php -exec svn propset svn:keywords 'Id' {} \;
find . -name \*.txt -exec svn propset svn:eol-style native {} \;
find . -name \*.txt -exec svn propset svn:keywords 'Id' {} \;
find . -name \*.css -exec svn propset svn:eol-style native {} \;
find . -name \*.js -exec svn propset svn:eol-style native {} \;
find . -name \*.sample -exec svn propset svn:eol-style native {} \;
find . -name \*.htm -exec svn propset svn:eol-style native {} \;
find . -name \*.html -exec svn propset svn:eol-style native {} \;
find . -name .htaccess -exec svn propset svn:eol-style native {} \;
find . -name \*.png -exec svn propset svn:mime-type image/png {} \;
find . -name \*.jpg -exec svn propset svn:mime-type image/jpeg {} \;
find . -name \*.gif -exec svn propset svn:mime-type image/gif {} \;

Any change that should be applied is reported by an email, so it can be fixed by committing the property change. This doesn't mean developers should not themself set correct properties when checking in files by configuring their environment - it's just a means of additional security.

mantisbt/svn_config.1194718231.txt.gz · Last modified: 2008/10/29 04:31 (external edit)

Driven by DokuWiki