Subversion

From Omnia
Revision as of 04:08, 11 December 2014 by Kenneth (talk | contribs) (→‎REPORT request failed - requested report is unknown)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Summary

Subversion Server - a version control system that is a compelling replacement for CVS in the open source community

TortoiseSVN - a Windows Subversion client

Subversion Book Online

Layout

Project
  branches
  tags
  trunk

Articles

Subversion 101 | Linux Magazine

svnserve Installation and Setup

Do I have to set up Apache to use Subversion? No. If you just want to access a repository, then you only need to build a Subversion client. If you want to host a networked repository, then you need to set up either Apache2 or an "svnserve" server.

svnserve, a custom server

Subversion URI: svn://host/path

How do I run svnserve as a service on Windows?
In versions after 1.4.0 see here
In versions before 1.4.0 use a :service wrappers":

  • SVNService is a free tool written by Magnus Norddahl
  • SrvAny is avaliable free of charge from Microsoft
Network Server Comparison [1]
Feature Apache + mod_dav_svn svnserve
Authentication options HTTP(S) basic auth, X.509 certificates, LDAP, NTLM, or any other mechanism available to Apache httpd CRAM-MD5 or SSH
User account options private 'users' file private 'users' file, or existing system (SSH) accounts
Authorization options blanket read/write access, or per-directory access control blanket read/write access
Encryption via optional SSL via optional SSH tunnel
Interoperability partially usable by other WebDAV clients not interoperable
Web viewing limited built-in support, or via 3rd-party tools such as ViewCVS via 3rd-party tools such as ViewCVS
Speed somewhat slower somewhat faster
Initial setup somewhat complex fairly simple

svnserve, a custom server [2] - The svnserve program is a lightweight server, capable of speaking to clients over TCP/IP using a custom, stateful protocol.

Start svn server and specity svn repository:

svnserve -d -r /usr/local/repositories

At the time of writing, the server only knows how to send a CRAM-MD5 authentication challenge.

Source Control with Subversion on Windows (Blog article) [3] - Includes a quick setup guide for Subversion server on windows.

svnserve Quick Installation

Source Control with Subversion on Windows:

  1. Install Subversion
  2. svnadmin create d:\$projects\$projectname
  3. svnserve -d -r d:\$projects
    • (Or use SC Service mode described below)
  4. Create a users database d:\$projects\$projectname\conf\passwd
    • Example:
      [users]
      aaron = mypassword
      This file can be modified on the fly (server does not need to be restarted)
  5. Edit d:\$projects\$projectname\conf\svnserve.conf and allow reading and writing to the users in the database we just created:
    • conf\svnserve.conf:
      [general]
      anon-access = none
      auth-access = write
      password-db = passwd
      realm = $projectname
  6. restart server

Subversion Startup Script

Make Subversion svnserve a Windows Service using SC

Windows Service Support for svnserve [4]

Where can I download the Windows 2000 Resource Kit tools? [5]

SC: Service Controller Query Tool - This tool provides a way to communicate with Service Controller (Services.exe) from the command prompt to retrieve information about services.

SC download [6]

C:\>sc create Subversion binpath= "C:\Program Files\Subversion\bin\svnserve.exe --service --root c:\svn"
        displayname= "Subversion Repository" depend= Tcpip
[SC] CreateService SUCCESS

If you mess up you can delete the service and recreate it. This may take some time for the service to be cleared, or a reboot may be required:

C:\>sc delete Subversion
[SC] DeleteService SUCCESS

Another option is to use the Microsoft "How To Create a User-Defined Service" artcile [7].

Installing Subversion with Apache

Install the appropriate packages:

yum install httpd subversion mod_dav_svn

To protect with SSL:

yum install mod_ssl

Create repository:

mkdir /opt/subversion
svnadmin create /opt/subversion
chown -R apache:apache /opt/subversion

Configure the apache subversion configuration.

/etc/httpd/conf.d/subversion.conf:

LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

<Location /svn>
        DAV svn
        SVNPath /opt/subversion

        AuthzSVNAccessFile /etc/svn-access

        AuthType Basic
        AuthName "SVN Repository"
        AuthUserFile /etc/svn-passwd
        Require valid-user
</Location>


Create access file /etc/svn-access:

[groups]
users = user1, user2

[/]
@users = rw


Create password file:

htpasswd -c /etc/svn-passwd user1
htpasswd /etc/svn-passwd user2

Restart apache:

service httpd restart

LDAP Example

yum install mod_authz_ldap
<Location />
        DAV svn
        SVNPath /opt/subversion/oeey

        AuthzSVNAccessFile /etc/svn-access

        AuthzLDAPAuthoritative on
        AuthzLDAPMethod ldap

        AuthzLDAPServer ldap.oeey.com
        AuthzLDAPUserBase ou=users,dc=oeey,dc=com
        AuthzLDAPUserKey uid
        AuthzLDAPUserScope base

        AuthType basic
        AuthName "svn"
        Require valid-user

        # Limit write permission to list of valid users.
        <LimitExcept GET PROPFIND OPTIONS REPORT>
                # Require SSL connection for password protection.
                SSLRequireSSL
        </LimitExcept>
</Location>

Sample Files

Sample original /etc/httpd/conf.d/subversion.conf:

LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

#
# Example configuration to enable HTTP access for a directory
# containing Subversion repositories, "/var/www/svn".  Each repository
# must be readable and writable by the 'apache' user.  Note that if
# SELinux is enabled, the repositories must be labelled with a context
# which httpd can write to; this will happen by default for
# directories created in /var/www.  Use "restorecon -R /var/www/svn"
# to label the repositories if upgrading from a previous release.
#

#
# To create a new repository "http://localhost/repos/stuff" using
# this configuration, run as root:
#
#   # cd /var/www/svn
#   # svnadmin create stuff
#   # chown -R apache.apache stuff
#

#<Location /repos>
#   DAV svn
#   SVNParentPath /var/www/svn
#
#   # Limit write permission to list of valid users.
#   <LimitExcept GET PROPFIND OPTIONS REPORT>
#      # Require SSL connection for password protection.
#      # SSLRequireSSL
#
#      AuthType Basic
#      AuthName "Authorization Realm"
#      AuthUserFile /path/to/passwdfile
#      Require valid-user
#   </LimitExcept>
#</Location>

Installing Latest on CentOS

Supported by two different sites: (both require quick registration)

Svninstall_centos5_wandisco.sh

1) Visit http://www.wandisco.com/subversion/os/downloads?type=centos 2) Select CentOS 5 - Subversion 1.6.15 3) Select "Download Subversion Server and Client Installer" 4) Fill in the registration information 5) A Link will arrive for the loading in your email 6) Download the svninstall_centos5_wandisco.sh file 7) Execute installation with "sh svninstall_centos5_wandisco.sh" 8) This will install the 1.6 server software, and apache module (optional)


See svninstall_centos5_wandisco.sh [8]

Authentication and Access Control

Authentication

For Basic Authentication:

AuthType Basic
AuthName "SVN Custom Repository"
AuthUserFile /opt/subversion/svn-custom-auth
Require valid-user

To create a password file:

htpasswd -c /opt/subversion/svn-custom-auth ken

To add/update users:

htpasswd /opt/subversion/svn-custom-auth ken

Access Control

Path-Based Authorization

For Access Control:

AuthzSVNAccessFile /opt/subversion/svn-custom-access

The Access file:

[groups]
servers = build, jira
internal = kenneth, rpalmer, dmartineau, rob, dandersen, kholm, brad, jcazier, lmanesse, cbluemel, asteele
pci = dmartineau, rpalmer, rob, dandersen, kholm, jcazier
contractor = yuriy

[/]
@internal = r
@servers = rw
@pci = rw

[/apps]
@contractor = rw

Command Line Subversion

Command Line References:

checkout

svn checkout [URL] [PATH]
svn co [URL] [PATH]

commit

svn commit
svn ci

copy

copy (tag / branch)

svn copy [SRC] [DEST]
svn cp [SRC] [DEST]

diff

diff: (show changes since base)

svn diff [FILE]

export

svn export [PATH1] [PATH2]
svn export file:///tmp/repos my-export

help

svn help
svn help <command>

info

info: (list repo source details)

svn info

list

list: (list files in revision)

svn list <path>
svn list -r [REV]

log

log: (show revision comments)

svn log           # show all logs
svn log .         # show logs only relevant to current path
svn log -l 1      # show logs limiting to the last entry
svn log -r HEAD   # show last commit
svn log -v        # show files changed
svn log -r [REV]  # show rev notes

merge

# You can see what will updated (without actually updating) by issuing:
svn merge --dry-run -r BASE:HEAD .
svn diff -r BASE:HEAD .

revert

svn revert [PATH]
svn revert -R [PATH]  # recursively revert
svn log -v -r 1:HEAD  # show every log

status

status: (show update/add status before commit)

svn status
# show status of what will be modified with update:
svn status --show-updates  # or short 'svn st -u'

update

svn update [PATH...]
svn update -r [REV]  # update to specified revision
svn update -r HEAD  # update to head

Branches and Tags

Layout: trunk branches tags:

  • trunk, meaning the directory under which the main project development occurs
  • branches, which is a directory in which to create various named branches of the main development line
  • tags, which is a directory of branches that are created, and perhaps destroyed, but never changed.

"The trunk, tags, and branches trio are sometimes referred to as “the TTB directories”." [9]

Trunk

The main branch of a project. Generally where daily commits go.

Tag

A tag is nothing more than a user friendly, easy to remember, revision number.

Branch

A parallel branch of a project, used when one does not want major changes to break the trunk.

Best Definitions:

  • trunk: the directory under which the main project development, and daily commits, occurs (currently dev)
  • branches: which is a directory in which to create various named branches of the main development line (ie. stable branch) Also used as a parallel branch of a project, used when one does not want major changes to break the trunk.
  • tags: which is a directory of branches that are created, and perhaps destroyed, but never changed. Usually flags a milestone. A tag is nothing more than a user friendly, easy to remember, revision number.

"In Subversion, there's no difference between a tag and a branch. Both are just ordinary directories that are created by copying. Just as with branches, the only reason a copied directory is a “tag” is because humans have decided to treat it that way: as long as nobody ever commits to the directory, it forever remains a snapshot. If people start committing to it, it becomes a branch." [10]

Standard setup:

trunk/
branches/
tags/

For example:

trunk/
branches/
  1.0/
    trunk/
    branches/
      1.0.5/
        trunk/
        branches/
        tags/
    tags/
      1.0.2/
tags/
  2007.11.01/
  2007.12.01/

Branching: [11]

  • The Never-Branch system
  • The Always-Branch system
  • The Branch-When-Needed system

Stable Branch:
"In software development it's common to have two “main” branches running side-by-side for very long periods. For example, suppose it's time to release a stable version of the 'calc' project to the public, and you know it's going to take a couple of months to shake bugs out of the software. You don't want people to add new features to the project, but you don't want to tell all developers to stop programming either. So instead, you create a “stable” branch of the software that won't change much." [12]

Cheap Copies:
"Subversion's repository has a special design. When you copy a directory, you don't need to worry about the repository growing huge—Subversion doesn't actually duplicate any data. Instead, it creates a new directory entry that points to an existing tree. If you're a Unix user, this is the same concept as a hard-link. From there, the copy is said to be “lazy”. That is, if you commit a change to one file within the copied directory, then only that file changes—the rest of the files continue to exist as links to the original files in the original directory." [13]

References:

Merging

Merging with TortoiseSVN

Merging a Range of Revisions

This method covers the case when you have made one or more revisions to a branch (or to the trunk) and you want to port those changes across to a different branch.

To merge revisions you need to go to a working copy of the branch in which you want to receive the changes, often the trunk. Select TortoiseSVN → Merge... from the context menu.

1. In the From: field enter the full folder url of the branch or tag containing the changes you want to port into your working copy. You may also click ... to browse the repository and find the desired branch. If you have merged from this branch before, then just use the drop down list which shows a history of previously used URLs.

2. Because you are porting a range of revisions from the same branch into your working copy, make sure the Use "From:" URL checkbox is checked.

3. In the From Revision field enter the start revision number. This is the revision before the changes you want to merge. Remember that Subversion will create a diff file in order to perform the merge, so the start point has to be just before the first change you are interested in. For example, your log messages may look something like this:

     Rev Comments
     39. Working on MyBranch
     38. Working on trunk
     37. Working on MyBranch
     36. Create branch MyBranch
     35. Working on trunk
     34. Working on trunk
              ...

If you now want to merge all the changes from MyBranch into the trunk you have to choose 36 as the From Revision, not 37 as you might think. If you select revision 37 as the start point, then the difference engine compares the end point with revision 37, and will miss the changes made in revision 37 itself. If that sounds complicated, don't worry, there is an easier way in TortoiseSVN ...

The easiest way to select the range of revisions you need is to click on Show Log, as this will list recent changes with their log comments. If you want to merge the changes from a single revision, just select that revision. If you want to merge changes from several revisions, then select that range (using the usual Shift-modifier). Click on OK and the revision numbers of the From revision and To revision in the Merge dialog will both be filled in for you.

When the Use "From:" URL checkbox is checked, only one Show Log button is enabled. This is because the Show Log dialog sets both From: and To: revisions, so you need to use the multiple selection method outlined above.

If you have already merged some changes from this branch, hopefully you will have made a note of the last revision merged in the log message when you committed the change. In that case, you can use Show Log for the Working Copy to trace that log message. Use the end point of the last merge as the start point for this merge. For example, if you have merged revisions 37 to 39 last time, then the start point for this merge should be revision 39.

4. If you have not used Show Log to select the revision range, then you will need to set the To Revision manually. Enter the last revision number in the range you want to merge. Often this will be the HEAD revision, although it doesn't need to be - you may just want to merge a single revision.

If other people may be committing changes then be careful about using the HEAD revision. It may not refer to the revision you think it does if someone else made a commit after your last update.

5. Click OK to complete the merge.

Merging Two Different Trees

This method covers the case when you have made a feature branch as discussed in the Subversion book. All trunk changes have been ported to the feature branch, week by week, and now the feature is complete you want to merge it back into the trunk. Because you have kept the feature branch synchronized with the trunk, the latest versions of branch and trunk will be absolutely identical except for your branch changes. So in this special case, you would merge by comparing the branch with the trunk.

To merge the feature branch back into the trunk you need to go to a working copy of the trunk. Select TortoiseSVN → Merge... from the context menu.

1. In the From: field enter the full folder url of the trunk. This may sound wrong, but remember that the trunk is the start point to which you want to add the branch changes. You may also click ... to browse the repository.

2. Because you are comparing two different trees, make sure the Use "From:" URL checkbox is not checked.

3. In the To: field enter the full folder url of the feature branch.

4. In both the From Revision field and the To Revision field, enter the last revision number at which the two trees were synchronized. If you are sure no-one else is making commits you can use the HEAD revision in both cases. If there is a chance that someone else may have made a commit since that synchronization, use the specific revision number to avoid losing more recent commits.

You can also use Show Log to select the revision. Note that in this case you are not selecting a range of revisions, so the revision you select there is what will actually appear in the Revision field.

5. Click OK to complete the merge.

In this case you will not need the feature branch again because the new feature is now integrated into the trunk. The feature branch is redundant and can be deleted from the repository if required.

Modify Commit Logs

How do I change the log message for a revision after it's been committed?

svnadmin setlog REPOS_PATH -r N --bypass-hooks FILE

Where REPOS_PATH is the repository location, N is the revision number whose log message you wish to change, and FILE is a file containing the new log message. If the "pre-revprop-change" hook is not in place (or you want to bypass the hook script for some reason), you can also use the --bypass-hooks option.

Jira: Edit change log after commit - doesn't carry over in JIRA

"If there is a change in the commit message, the only way to make JIRA pickup that change is to remove the Subversion indexes JIRA keeps around. this will force JIRA to reindex all the SVN logs from scratch and pickup the changes."

Replication with svnsync

svnsync

"svnsync is a tool for creating and maintaining read-only mirrors of subversion repositories. It works by replaying commits that occurred in one repository and committing it into another." [14]

svnsync was introduced in version 1.4 [15]

Documentation:

Turotials:

Example 1

svnsync

create your destination repository

svnadmin create dest
cat <<'EOF' > dest/hooks/pre-revprop-change
#!/bin/sh
USER="$3"

if [ "$USER" = "svnsync" ]; then exit 0; fi

echo "Only the svnsync user can change revprops" >&2
exit 1
EOF
chmod +x dest/hooks/pre-revprop-change
svnsync init --username svnsync file://`pwd`/dest http://svn.example.org/source/repos
svnsync sync file://`pwd`/dest

Example 2

Paul’s Journal » Blog Archive » using svnsync

$ export FROMREPO=svn://svn.example.com/
$ export TOREPO=svn://dest.example.com/
$ echo "#!/bin/sh" > hooks/pre-revprop-change
$ chmod 755 hooks/pre-revprop-change
$ svnsync init ${TOREPO} ${FROMREPO}

This will prompt you for the username, password, and also sets several revision properties on the $TOREPO, for revision zero. It doesn’t actually copy any of the data yet. To list the properties that it created, run:

svn proplist --revprop -r 0 ${TOREPO}
svn propget svn:sync-from-url --revprop -r 0 ${TOREPO}

Sync

svnsync --non-interactive sync ${TOREPO}

its not so easy to restart after an aborted sync. To fix this, we can safely just delete this lock:

svn propdelete svn:sync-lock --revprop -r 0  ${TOREPO}

live sync, on the FROMREPO server, I appended this to my hooks/post-commit file:

svnsync --non-interactive sync svn://dest.example.com/ &

Unfortunately, the post-commit hook won’t catch everything, so we also need to added this to the post-revprop-change hook:

svnsync --non-interactive copy-revprops  svn://dest.example.com/ ${REV} &

Example 3

Subversion supports read-only mirroring of repositories, using the svnsync utility.

Initialize a new, empty Subversion repository

   $ mkdir -p /ws/varnish/svnroot
   $ svnadmin create /ws/varnish/svnroot

Create an empty ‘pre-revprop-change’ hook. The svnsync utility requires a valid “pre-revprop-change” hook script in the target Subversion repository. It does not really matter if the hook does absolutely nothing. The only requirement is that it exists, and that it is executable:

   $ echo '#!/bin/sh' > /ws/varnish/svnroot/hooks/pre-revprop-change
   $ chmod 0755 /ws/varnish/svnroot/hooks/pre-revprop-change

Set up your environment for the conversion. It gets tedious having to type the same stuff multiple times, so it will be useful to have the source and target repositories available as handy shell variables:

   $ export TOREPO='file:///ws/varnish/svnroot'
   export FROMREPO='http://varnish.projects.linpro.no/svn'

Initialize the target repository of svnsync

   $ svnsync init ${TOREPO} ${FROMREPO}
   $ svn proplist --revprop -r 0 ${TOREPO}

After this step it should be possible to look at the “svn:sync-from-url” property of the target repository and see the stored URI of the source repository:

   $ svn propget svn:sync-from-url --revprop -r 0 ${TOREPO}
   http://varnish.projects.linpro.no/svn

Start the synchronization of the target repository

   svnsync --non-interactive sync ${TOREPO}

This should start pulling changesets over HTTP and committing them in the target repository.

The synchronization process may be interrupted and resumed later. It will keep pulling changes incrementally, from the point where it stopped.

Source: Mirroring the varnish-cache repository with svnsync « Blog Pseudoaccidentale

Issues

REPORT request failed - requested report is unknown

[subversion@hal subversion]$ svnsync sync --username svnsync file://`pwd`/cp
Authentication realm: <https://svn.oeey.com:443> OEEY SVN CP Repository
Password for 'svnsync':
svnsync: REPORT request failed on 'https://svn.oeey.com/cp'
svnsync: The requested report is unknown.

Solution:

"Means your server is version lower than 1.4.0 and doesn't know about the new commands." [16]
"I don't believe you can use svnsync against older repositories (I assume you're talking to the older repo using svnserve). They both need to be served by Subversion 1.4.x." [17]


References:

Replication with pushmi

pushmi

"Pushmi provides a mechanism for bidirectionally synchronizing Subversion repositories. The main difference between Pushmi and other replication tools is that Pushmi makes the "slave" repositories writable by normal Subversion clients. [18]

Backup

Upgrade Repository

When you upgrade the Subversion server software, make sure to upgrade the repository as well.

svnadmin upgrade [repopath]

NOTE: "svnadmin upgrade is just a shorthand for dumping your repository, creating a new one, and loading the dump. As a shorthand, it is likely to not to create as optimized a repository as the dump/load procedure" [19]

Issues

Problems installing on Windows 2000 Professional

Unable to start svnserve, missing MSVCP60.dll

Trying to start svnserve.exe (svnserve -d -r /svn) initially produced the following error:

svnserve.exe - Unable To Locate DLL
The dynamic link library MSVCP60.dll could not be found in the specified path [Image:subversion_server_missing_msvcp60_dll.png|right]

An answer was found in this article. The solution is to install the Visual C++ 6.0 VCREDIST.exe which was discussed in Microsoft KB article 259403. But this will not work on Windows 2000:

"Note This package does not install these components on computers that are running Microsoft Windows 2000 or Microsoft Windows Millennium (Me) systems. On computers that are running Windows 2000 and Windows Millennium, these components can only be updated through operating system updates and service packs for these operating systems."

I am running the latest service pack (SP4), so I am unsure why I wouldn't already have it.

The other option that is discussed is:

"find someone or some system that has msvcp60.dll and copy that file to c:\$windows\system32\ (where $windows is the directory that contains your Windows installation)."

I noticed my Windows XP Professional installation has this DLL. I think a manual copy is not a good solution.

This article indicates that if you select Windows 2000 Support Tools during Windows 2000 Server installation the DLL will be installed, or you can download it from Microsoft. I thought I would ignore the warning that this would not work on Windows 2000. Sure enough, it does not install the DLLs on Windows 2000.

I finally gave up and manually copied the DLL from my XP Pro box to my 2000 box. This cleared up the problem. Problem solved... with a band aid.

Unable to install TortoiseSVN - Windows Installer Error (Opps, my bad!)

My luck with Subversion on Windows 2000 has not been good.

When I attempt to install TortoiseSVN 1.4.1 (TortoiseSVN-1.4.1.7992-win32-svn-1.4.2.msi), I get the following error:

Windows Installer This installation package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer Package. [Image:tortoisesvn_windows_installer_error.png]

I checked the System Requirements: [20]

System Requirements
* Win2k SP4, WinXP or later
* IE5.5 or later
* Windows Installer version 3.1 or later

I know I have meet requirements 1 and 2, which seems to imply I must have an old windows installer. I am surprised this was not installed with the Windows Automatic Updates. I installed the Windows Installer version 3.1, and rebooted. This did not fix the problem as I am still getting "This installation package could not be opened".

AHHH! Turns out the problem was the MSI file was corrupted, or more accurately, on the page that shows the download items, I right clicked and told it to save the file. The link actually takes you to a second page, and not the file directly. I had downloaded just the HTML content for the file. My bad. Move along people, there is nothing to see here.

Using with Pound Loadbalancer

Basically you need to enable WebDAV support for Pound:

Listener HTTPS
  xHTTP 2
  ....

PROPFIND 501 Not Implemented

Log the X-Forwarded-For header in apache...

LogFormat "[X-Forwarded-For: %{X-Forwarded-For}i] %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "[X-Forwarded-For: %{X-Forwarded-For}i] %h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

REPORT Request Failed

Error: REPORT request failed on '/cp/!svn/vcc/default'  
Error: REPORT of '/cp/!svn/vcc/default': Could not read response body: Secure connection truncated (https://svn.oeey.com)

Unsure as to what causes this, but I am sure it is related to Pound timing out.

Bad Gateway on COPY

Error:

Server sent unexpected return value (502 Bad Gateway) in response to COPY

Cause:

  • "Some research will quite quickly identify the problem as related to the use of a reverse proxy (Forefront in my case) and problems when using https externally and http internally. " [21]

Solution:

  • add this line to your httpd.conf:
RequestHeader edit Destination ^https http early

Retrieval of mergeinfo unsupported

When trying to merge a branch back into the trunk:

Error:

Retrieval of mergeinfo unsupported by 'https://svn.t0e.org/tztk/branches/ken'

Cause:

  • merge tracking became available in version 1.5. Upgrade your server.


NOTE: Remember to upgrade the reposiotry when you upgrade SVN!:


Repository Upgrades - http://subversion.apache.org/docs/release-notes/1.5.html#repos-upgrades
The Subversion 1.5 server works with 1.4 and older repositories, and it will not upgrade such repositories to 1.5 unless specifically requested to via the svnadmin upgrade command. This means that some of the new 1.5 features will not become available simply by upgrading your server: you will also have to upgrade your repositories. (We decided not to auto-upgrade repositories because we didn't want 1.5 to silently make repositories unusable by 1.4 — that step should be a conscious decision on the part of the repository admin.)
After running svnadmin upgrade, you may wish to also run the svn-populate-node-origins-index program on the repository. Subversion 1.5 maintains a node-origins index for each repository, and builds the index lazily as the information is needed. But for old repositories with lots of revisions, it's better to create the index in one step, using the aforementioned tool, than to have live queries be slower until the index has built itself. See issue #3024 for details.

Files

Startup init.d script

#!/bin/bash
#
# chkconfig: - 99 01
# description: Subversion - version control application
#

# Source function library.
. /etc/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up. If networking isn't up, don't start.  Why?
# because we are useless without a network connection.
if [ ${NETWORKING} = "no" ]; then
        echo -n "Networking is down!"
        failure
        exit 1
fi

COMMAND="/usr/bin/svnserve --daemon --root /opt/subversion/"

case "$1" in

  start)
    #
    # Start Subversion
    #
    echo -n "Starting Subversion..."
    su - subversion -c "$COMMAND"
    RETVAL=$?
    if [ "${RETVAL}" = 0 ] ; then
      success
    else
      failure
    fi
    echo
    exit ${RETVAL}
    ;;

  stop)
    #
    # Stop Subversion
    #
    echo -n "Stopping Subversion..."
    proccess=`ps ax | egrep  "${COMMAND}$" | tr -s " " | cut -d " " -f2`
    if [ "$proccess" = "" ]; then
      echo -n " No svnserve processes running!"
      failure
      echo
      exit 1
    else
      kill "$proccess"
      success
      echo
      exit 0
    fi
    ;;

  restart)
    $0 stop
    $0 start
    ;;

  status)
    proccess=`ps ax | egrep  "${COMMAND}$" | tr -s " " | cut -d " " -f2`
    if [ "$proccess" = "" ]; then
      echo "Subversion service is stopped."
    else
      echo "Subversion service is running."
    fi
    exit 1
    ;;

  *)
    echo "Usage: service subversion (start|stop|restart|status)"
    exit 1
    ;;
esac

exit 0