User Tools

Site Tools


middleware:subversion

Subversion

Installing the client

These instructions have been tested under Linux and FreeBSD

  1. Subversion requires Openssl, download and install the latest version before installing subversion.
    • tar xzf openssl-VERSION.tar.gz
    • ./config --prefix=/apps/local/openssl-VERSION shared
    • make && make install
    • ln -s /apps/local/openssl-VERSION /apps/local/openssl
  2. Download the latest subversion source from Documents & files: Source tarballs, we highly recommend installing the client from source. Packages and ports may seem easier, but the source contains all the dependencies you need. Be sure to also download the appropriate subversion-deps
  3. Unpack the archive and enter the newly created directory.
  4. Configure the make process:
    ./configure --prefix=/apps/local/subversion-VERSION --with-ssl
    • If you have trouble compiling with ssl support you may need to set some compile flags:
      export LDFLAGS=-L/apps/local/openssl/lib
      export CPPFLAGS=-I/apps/local/openssl/include
    • Version 1.4 seems to require the Apache APR libs to build. Not using 1.4 yet, so haven't looked into it.
  5. Build and install the binary:
    make && make install
    ln -s /apps/local/subversion-VERSION /apps/local/subversion
    • If you have trouble installing with ssl support you may need to set your library path:
      export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/apps/local/openssl/lib
  6. Add /apps/local/subversion/bin to your PATH.
  7. You are finished, to test your client you can list one of our anonymous read modules:
    svn list https://svn.middleware.vt.edu:8443/svn/middleware/crypt/trunk

    You will be prompted to trust the server certificate.

Subversion Client Settings

Password Settings

By default, Subversion will cache your password in cleartext in the directory ~/.subversion/svn.simple. This directory is protected by permissions, but if you want to disable password caching, put the following in your ~/.subversion/config:

[auth]
store-passwords = no

These settings are useful when using accounts that are shared by more than one user (e.g. mwebapp).

Keyword Settings

Like CVS, Subversion supports keywords that can be expanded in files, such as $Id$, $Date$, $Revision$, etc. By default, these properties (svn:keywords) are not set on files. To see which properties are set on a given file, use the following command:

svn proplist -v <file>

To set the keyword properties, use the following command:

svn propset svn:keywords "LastChangedDate LastChangedRevision LastChangedBy HeadURL Id" <file>

To automatically set the keyword properties on a svn add or svn import command, put the following in your ~/.subversion/config file:

[miscellany]
enable-auto-props = yes

[auto-props]
# this sets the properties for java files, but you can specify different files
*.java = svn:keywords=LastChangedDate LastChangedRevision LastChangedBy HeadURL Id

To replace ”@version $Revision$ $Date$” keyword strings that will be greater than eighty characters and will not pass checkstyle rules, issue the following command:

find ./ -type f -name "*.java" -exec perl -pi -e \
's/^.*\@version \$Revision.*\$.*\$Date.*$/ \* \@version \$Revision\$\n \* \$Date\$/' '{}' \;

To set keyword properties on existing files, issue the following command:

find ./ -type f -name "*.java" -exec svn propset svn:keywords "LastChangedDate LastChangedRevision LastChangedBy HeadURL Id" '{}' \;

See the Subversion manual for more information about properties.

Client Commands

Examples assume the following:

export SVN=https://svn.middleware.vt.edu:8443/svn
export REPOSITORY=middleware
  • Importing a new project to Subversion:
    svn import project_name $SVN/$REPOSITORY/project_name 
  • Checking out a project from Subversion:
    svn checkout $SVN/$REPOSITORY/project_name
  • Checking out only HEAD code from Subversion:
    svn checkout $SVN/$REPOSITORY/project_name/trunk project_name
  • Committing your local changes to Subversion:
    svn commit
  • Merging changes from Subversion to your local copy:
    svn update
  • Updating your local copy to a branch or tag:
    svn switch $SVN/$REPOSITORY/project_name/branches/branch_name
  • Branching from HEAD on the server:
    svn copy $SVN/$REPOSITORY/project_name/trunk $SVN/$REPOSITORY/project_name/branches/branch_name
  • Tagging from HEAD on the server:
    svn copy $SVN/$REPOSITORY/project_name/trunk $SVN/$REPOSITORY/project_name/tags/tag_name
  • Display information about checked out module:
    svn info
  • Resolve conflicts (after actually resolving them in the files!):
    # PATH can be a file or a directory
    svn resolved PATH
  • Change the name of a file in the repository:
    svn mv jbossall-client3_2_5.jar jbossall-client3_2_6.jar
  • Merge the differences between two files (using HEAD revisions):
    cd $WORKING_COPY
    svn merge $SVN_URL/$WORKING_COPY $SVN_URL/$NEW_COPY
  • Revert file back to server copy:
    svn revert <file>
  • Revert file back to older revision:
    svn merge -r HEAD:<rev> <file>
    svn commit <file>
  • Set executable property:
    svn propset svn:executable ON <file>
middleware/subversion.txt · Last modified: 2015/06/01 12:02 (external edit)