what is the use of svn properties
I have read that using "svn propset", you can set properties for files and directories. What kind of metadata can be开发者_JS百科 attached to these properties? Has anyone used them? If so, please provide me with some examples.
Regards vadiraj
One that I use a lot is svn:executable
, which sets the "+x" permission on files on those OSs where such a thing exists:
svn propset svn:executable yes thefile.exe
There are svn specfic properties and then 3rd party / generic properties. The svn specific properties start with svn: and are used by svn itself.
The most common example that I set is svn:ignore, which tells subversion to ignore the directory/file from comparisons and committing into the subversion repo. We use it a lot with IDEs that generate files within the project structure so that you don't have to/want to commit them into the structure.
There is also svn:externals, which is essentially a symlink where you can reference a different subversion repo/directory that will be extracted as the current directory. This works for directories only.
There is also svn:eol-style, which can specify line breaks on a file.
One of the most powerful properties that I use is svn:externals
. This will allow you to share files/subdirectories from different locations in the repository (or even other repositories). It is very helpful to have this reuse available.
From the TortoiseSVN help:
Sometimes it is useful to construct a working copy that is made out of a number of different checkouts. For example, you may want different files or subdirectories to come from different locations in a repository, or perhaps from different repositories altogether. If you want every user to have the same layout, you can define the svn:externals properties to pull in the specified resource at the locations where they are needed.
Some people like to set the svn:keywords
property to get keyword substitution in their source files. This:
$ svn propset svn:keywords 'HeadURL Id'
for example, will replace $HeadURL$
in your source files with things like:
$HeadURL: http://svn.collab.net/repos/trunk/README $
and $Id$
with:
$Id: calc.c 148 2006-07-28 21:30:43Z sally $
Some people like these, some not.
There's also the svn:mime-type
property as discussed over here. This one can be quite useful for marking binary files that should not have their end-of-line markers adjusted to match the local convention.
精彩评论