Section 8.3. Using Autoversioning with WebDAV


8.3. Using Autoversioning with WebDAV

The graphical file browsers on many operating systems allow you to mount WebDAV shares as remote directories that can be accessed the same as local files. This includes (but is not necessarily limited to) the following GUI file managers:

  • Microsoft Windows Explorer (although older versions of the OS might need software installed)

  • Macintosh OS X (albeit without any SSL support)

  • The Nautilus file manager, available on Linux and most UNIX varieties

Because the Apache/WebDAV repository shares support standard WebDAV commands, this means that you can often mount a repository as a remote directory. Of course, in such a situation, the file managers don't know anything about Subversion, and can't support any Subversion-specific manipulation (like commits, updates, or properties). However, when a repository is accessed this way, Subversion does support a limited form of file modification, known as autoversioning.

Autoversioning allows users to open repository files directly from a mounted filesystem directory, edit the file, and then save it back to the repository (although some WebDAV clients might require you to copy the file to the local filesystem before you edit it, then copy it back after the edit). When the modified file is saved or copied back to the share, it automatically performs a commit, with a generic log message. In this way, users with little or no understanding of version control are able to edit files in the repository without the steep learning curve of the Subversion client. It also allows you to access and modify Subversion repositories from client machines that don't (or can't) have a full Subversion client installed.

Unfortunately, opening and saving repository files via a WebDAV share can be a problem if there are multiple people modifying the repository in parallel. If you open a file on your local system and another developer commits changes before you save your modified version back, that other developer's changes will be overwritten, not merged. Fortunately, this problem should be fixed in the upcoming 1.2 release of Subversion, which will support file locking that should work with autoversioning.

Enabling Autoversioning

By default, autoversioning is not allowed. The server will just reject changes to files that it receives through standard WebDAV means. To enable autoversioning, you need to add the SVNAutoversioning directive to your repository's Location section, which would give you a location that looks something like the following example.

 <Location /repos>    DAV svn    SVNPath /var/svnrepos    SVNAutoversioning on </Location> 

Autoversioning on OS X

Autoversioning with the Macintosh OS X Finder is a bit more difficult than with MS Windows or Nautilus, because OS X tries to get a lock on each file before writing to it (which Subversion WebDAV doesn't support). There is a workaround, though. The Apache module mod_dav_lock allows you to add support for file locking to Apache, so that the lock requests aren't rejected.

Warning: Apache is the only thing locking the file here. Subversion doesn't understand locks, so a Subversion client can make a change to the file. If you are using mod_dav_lock, make sure that no one is going to be using a Subversion client at the same time. This problem should go away with version 1.2 of Subversion, though, because it will support locking.

To enable mod_dav_lock support for your Subversion repository, you need to first tell Apache to load mod_dav_lock (the specifics of this are very specific to an Apache install). Then, you just need to tell your Subversion repository location what file to use for its locks, as in this example <Location>.

 <Location /repos>    DAV svn    SVNPath /var/svnrepos    SVNAutoversioning on    DAVGenericLockDB /var/svnrepos/dav_locks </Location> 



    Subversion Version Control. Using The Subversion Version Control System in Development Projects
    Subversion Version Control. Using The Subversion Version Control System in Development Projects
    ISBN: 131855182
    EAN: N/A
    Year: 2005
    Pages: 132

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net