As part of work on Duality SVN, I've been periodically reading the SVN redbook and other SVN documentation to find out how to get SVN to behave in ways that I like most so that my tool will make things significantly easier for myself in the long run.
Today, while working on adding files, I noticed an option: "--auto-props" that can be used in conjunction with svn add. From the documentation, when set, this will automatically add SVN properties to files based on some pattern-matching magic.
What's the point of this?
Well, SVN properties are extra tags which tell SVN what to do with your file.
For example, a handy little property I've been setting on all my source-files for the past few years since learning about it, is "svn:eol-style = native". This means that never again will you have problems with people running different operating systems to you checking out your file, and then having build errors or other oddities (i.e. MS Windows has a crappymatic "Notepad" text-editor builtin, but that is only able to display text files with Windows CRLF line endings or else it outputs everything in a very long line + some word wrapping).
Now, up till now, I've been going through setting these manually. That's fine if you're organised, but if you're setting up some automated tools, you're going to hope that they can do as much of the grunt-work that you normally would have to do as possible. So, having this option built into svn already is nice, as it means less time that needs to be spent coding it myself :)
One last word about setting this up
For this to work, you need to enable some pattern -> property mappings for SVN to use. By default (at least on Windows), there aren't any patterns active/available (they're all commented out).
To see this for yourself, take a look in %APPDATA%\subversion\config, or the equivalent for Linux, and look out for the [auto-props] section. Uncomment a few of those patterns, and add a few more for filetypes you use quite often.
That should do it!
No comments:
Post a Comment