User Tools

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

Site Tools


mantisbt:svn_config

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 setting automatically 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:

Windows Registry Script

subversion_mantis_config.reg

REGEDIT4

[HKEY_CURRENT_USER\Software\Tigris.org\Subversion\Config\auto-props]
"*.php"="svn:mime-type=text/plain;svn:eol-style=native;svn:keywords=Author Date Id Revision"
"*.txt"="svn:mime-type=text/plain;svn:eol-style=native;svn:keywords=Author Date Id Revision"
"*.sgml"="svn:mime-type=text/sgml;svn:eol-style=native;svn:keywords=Author Date Id Revision"
"*.dsl"="svn:mime-type=text/xml;svn:eol-style=native"
"*.ent"="svn:mime-type=text/xml;svn:eol-style=native"
"*.css"="svn:mime-type=text/plain;svn:eol-style=native"
"*.js"="svn:mime-type=text/plain;svn:eol-style=native"
"*.sample"="svn:mime-type=text/plain;svn:eol-style"
"*.html"="svn:mime-type=text/plain;svn:eol-style=native"
"*.htm"="svn:mime-type=text/plain;svn:eol-style=native"
"*.htaccess"="svn:mime-type=text/plain;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"

Note: Windows also support the same config file as Unix. You may found in the %AppData%\Subversion\config in the user's application data folder.

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

Unix configuration file

$HOME/.subversion/config

[miscellany]
enable-auto-props = yes

[auto-props]
*.php = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords=Author Date Id Revision
*.txt = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords=Author Date Id Revision
*.css = svn:mime-type=text/plain;svn:eol-style=native
*.sgml=svn:mine-type=text/sgml;svn:eol-style=native;svn:keywords=Author Date Id Revision
*.dsl=svn:mime-type=text/xml;svn:eol-style=native
*.ent=svn:mime-type=text/xml;svn:eol-style=native
*.js = svn:mime-type=text/plain;svn:eol-style=native
*.sample = svn:mime-type=text/plain;svn:eol-style=native
*.html = svn:mime-type=text/plain;svn:eol-style=native
*.htm = svn:mime-type=text/plain;svn:eol-style=native
*.htaccess = svn:mime-type=text/plain;: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 a script running the following commands:

find . -name \*.php -exec svn propset svn:eol-style native {} \;
find . -name \*.php -exec svn propset svn:keywords 'Author Date Id Revision' {} \;
find . -name \*.txt -exec svn propset svn:eol-style native {} \;
find . -name \*.txt -exec svn propset svn:keywords 'Author Date Id Revision' {} \;
find . -name \*.sgml -exec svn propset svn:mime-type text/sgml {} \;
find . -name \*.sgml -exec svn propset svn:eol-style native {} \;
find . -name \*.sgml -exec svn propset svn:keywords 'Author Date Id Revision' {} \;
find . -name \*.dsl -exec svn propset svn:mime-type text/xml {} \;
find . -name \*.dsl -exec svn propset svn:eol-style native {} \;
find . -name \*.ent -exec svn propset svn:mime-type text/xml {} \;
find . -name \*.ent -exec svn propset svn:eol-style native {} \;
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 {} \;l
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 them self set correct properties when checking in files by configuring their environment - it's just a means of additional safety.

mantisbt/svn_config.txt · Last modified: 2014/02/27 03:06 by Bascy

Driven by DokuWiki