This page is intended for any useful info for SVN

Info

Subversion Properties

Subversion uses properties to record meta data about files. This section describes the use of these properties in Struts.

  • svn:keywords - subversion supports keyword substitution. Need to set the svn:keywords property to space seprated list of the keywords and then add the keywords to the file.
  • svn:eol-style - determines the line ending character on a file.

Configuring the Client: Automatic Property Setting

You should be able to configure the client your using for svn to automatically set properties on newly added files. The following bits of the red book may help.

First you need to set the enable-auto-props to yes. Then in the auto-props section add properties for specified file patterns.

For example, in ~/.subversion/config:

[miscellany]
enable-auto-props = yes

[auto-props]
*.java = svn:eol-style=native;svn:keywords=Date Author Id Revision HeadURL
*.jsp = svn:eol-style=native;svn:keywords=Date Author Id Revision HeadURL
*.css = svn:eol-style=native;svn:keywords=Date Author Id Revision HeadURL
*.htm = svn:eol-style=native;svn:keywords=Date Author Id Revision HeadURL
*.html = svn:eol-style=native;svn:keywords=Date Author Id Revision HeadURL
*.xml = svn:eol-style=native;svn:keywords=Date Author Id Revision HeadURL
*.xsl = svn:eol-style=native;svn:keywords=Date Author Id Revision HeadURL
*.dtd = svn:eol-style=native;svn:keywords=Date Author Id Revision HeadURL
*.txt = svn:eol-style=native;svn:keywords=Date Author Id Revision HeadURL
*.properties = svn:eol-style=native;svn:keywords=Date Author Id Revision HeadURL
*.tld = svn:eol-style=native;svn:keywords=Date Author Id Revision HeadURL
*.ftl = svn:eol-style=native;svn:keywords=Date Author Id Revision HeadURL
*.fml = svn:eol-style=native;svn:keywords=Date Author Id Revision HeadURL

Struts Subversion Property Settings

Java Source Files

When adding a new java source file the following should be set up:

The new file should have the following properties:

  • svn:eol-style property set to native
  • svn:keywords property set to Date Author Id Revision HeadURL

The new file should contain the following keywords:

  • add the $Id$ keyword in the license comments at the top of the file
  • add @version $Rev$ $Date$ to the javadoc

Documentation

The *.xml documentation files have the following properties set:

  • svn:eol-style property set to native
  • svn:keywords property set to Date Author Id Revision HeadURL

Changing Properties on Existing Files

  • svn propset svn:eol-style native FILENAME
  • svn propset svn:keywords "Date Author Id Revision HeadURL" FILENAME

Updating the list of subprojects for the "current" checkout

The Struts code base takes advantage of a feature of Subversion termed "externals". The concept is similar to how a symbolic link works in the *nix worlds. With Struts, you typically checkout the source code by getting https://svn.apache.org/repos/asf/struts/current/, yet, if you look at this url with a browser, you'll only see 1 file. That's because of our use of svn:externals.

(All of this is in the online svn handbook -http://svnbook.red-bean.com/svnbook-1.1/)

Change directories to where the root of your checkout is.

 $ cd path/to/svn/struts/checkout

Ensure you have an environment variable setup for SVN_EDITOR.

 $ set
...
... (snip'd)
...
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
SHLVL=1
SVN_EDITOR=vi         <=== must have this (or emacs or vim or ??)
TERM=xterm-color
TERM_PROGRAM=Apple_Terminal
...
...

If you don't have it, set it.

 $ export set SVN_EDITOR=vi  (or emacs or vim or whatever)

Now let's edit svn:externals for the root of our checkout.

 $ svn propedit svn:externals .

NOTE - the "." is not a typo - that's how you tell it to edit the svn:external props

(if using vi, it will open up like this)

struts1   https://svn.apache.org/repos/asf/struts/struts1/trunk
struts2   https://svn.apache.org/repos/asf/struts/struts2/trunk
maven     https://svn.apache.org/repos/asf/struts/maven/trunk
sandbox   https://svn.apache.org/repos/asf/struts/sandbox/trunk
shale     https://svn.apache.org/repos/asf/struts/shale/trunk
site      https://svn.apache.org/repos/asf/struts/site

Make your changes, save and exit.

You can check what you've done

 $ svn diff .

Check in your changes

 $ svn commit -m "modified svn:externals for ???" .
  • No labels