SVN Properties and keywords

To set properties use the svn propset command.

For example,

svn propset Author 'David Precious'

SVN Keywords

There are some useful keywords which can be set, the value of which will be substituted for 'tags' in the file itself.

The keywords are updated when the file is committed to the repository.

Some of the useful ones are:

  • $Revision (or $LastChangedRevision or $Rev) which will expand to the revision number the file was last updated in, like: $Revision: 23 $
  • $Id which will expand to $Id: file.pl 23 2006-0901 13:05:51Z dave $
  • $LastChangedDate, or $Date - the date this revision was committed to the repo.
  • $LastChangedBy, or $Author - the name of the person who committed this version to the repo.

To set the keywords which should be replaced, use:

svn propset svn:keywords 'Id Revision' file.pl

Unless you use the svn propset command above, the anchors (e.g. ”$Id) will *not* be replaced with their value... SVN will not mess with your file unless you've explicitly told it to.

Changing commit log messages after commit

To change a commit log entry after the commit, use:

svn propset --revprop -r 25 svn:log 'new log entry'

This won't work by default, the pre-revprop-change hook must be created first.

Automatically setting props with auto-props

To have certain properties set automatically, you'll need to edit your SVN client config file - typically ~/.subversion/config for *nix boxen.

In the [miscellany] section, set enable-auto-props to true.

in the [auto-props] section (probably need to create it), have lines like PATTERN=PROPNAME=PROPVALUE[;PROPNAME2=PROPVAL2]

i.e.

[miscellany]
enable-auto-props = true

[auto-props]
*.pl = svn:keywords=Id Revision;svn:eol-style=native;svn:executable
*.pm = svn:keywords=Id Revision;svn:eol-style=native

The above example will make all Perl scripts added to the repository have the Id and Revision svn:keywords set automatically, they'll be marked executable (only the scripts (*.pl) not the modules (*.pm)), and SVN will remember that they are text files and that it should use whatever the client machines native line ending style is when they're checked out.

I originally thought that these settings went in the repository's config file (<repodir>/conf/svnserve.conf) but they don't. There doesn't seem to be too much easy documentation on this available.

Ignoring files

To ignore certain files in a directory (files which should not be under version control for whatever reason) use the svn:ignore property on the directory - the value should be a multi-line list of patterns to exclude, one pattern per line.

 
svn/propset.txt · Last modified: 2010/02/26 10:45 (external edit)
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki