<?xml version="1.0" encoding="utf-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Autoversioning</title> <link rel="stylesheet" type="text/css" href="styles.css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /> <style type="text/css"> body { background-image: url('images/draft.png'); background-repeat: no-repeat; background-position: top left; /* The following properties make the watermark "fixed" on the page. */ /* I think that's just a bit too distracting for the reader... */ /* background-attachment: fixed; */ /* background-position: center center; */ }</style> <link rel="home" href="index.html" title="Version Control with Subversion [DRAFT]" /> <link rel="up" href="svn.webdav.html" title="Appendix C. WebDAV and Autoversioning" /> <link rel="prev" href="svn.webdav.basic.html" title="What Is WebDAV?" /> <link rel="next" href="svn.webdav.clients.html" title="Client Interoperability" /> </head> <body> <div xmlns="" id="vcws-version-notice"> <p>This text is a work in progress—highly subject to change—and may not accurately describe any released version of the Apache™ Subversion® software. Bookmarking or otherwise referring others to this page is probably not such a smart idea. Please visit <a href="http://www.svnbook.com/">http://www.svnbook.com/</a> for stable versions of this book.</p> </div> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">Autoversioning</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="svn.webdav.basic.html">Prev</a> </td> <th width="60%" align="center">Appendix C. WebDAV and Autoversioning</th> <td width="20%" align="right"> <a accesskey="n" href="svn.webdav.clients.html">Next</a></td> </tr> </table> <hr /> </div> <div class="sect1"> <div class="titlepage"> <div> <div> <h2 class="title" style="clear: both"><a id="svn.webdav.autoversioning"></a>Autoversioning</h2> </div> </div> </div> <p> <a id="idm16866" class="indexterm"></a>While the Subversion client is not a full DeltaV client, and the Subversion server is not a full DeltaV server, there's still a glimmer of WebDAV interoperability to be happy about: <em class="firstterm">autoversioning</em>.</p> <p>Autoversioning is an optional feature defined in the DeltaV standard. A typical DeltaV server will reject an ignorant WebDAV client attempting to do a <code class="literal">PUT</code> to a file that's under version control. To change a version-controlled file, the server expects a series of proper versioning requests: something like <code class="literal">MKACTIVITY</code>, <code class="literal">CHECKOUT</code>, <code class="literal">PUT</code>, <code class="literal">CHECKIN</code>. But if the DeltaV server supports autoversioning, write requests from basic WebDAV clients are accepted. The server behaves as though the client <span class="emphasis"><em>had</em></span> issued the proper series of versioning requests, performing a commit under the hood. In other words, it allows a DeltaV server to interoperate with ordinary WebDAV clients that don't understand versioning.</p> <p>Because so many operating systems already have integrated WebDAV clients, the use case for this feature can be incredibly appealing to administrators working with non-technical users. Imagine an office of ordinary users running Microsoft Windows or Mac OS. Each user <span class="quote">“<span class="quote">mounts</span>”</span> the Subversion repository, which appears to be an ordinary network folder. They use the shared folder as they always do: open files, edit them, and save them. Meanwhile, the server is automatically versioning everything. Any administrator (or knowledgeable user) can still use a Subversion client to search history and retrieve older versions of data.</p> <p>This scenario isn't fiction—it's real and it works. To activate autoversioning in <span class="command"><strong>mod_dav_svn</strong></span>, use the <code class="literal">SVNAutoversioning</code> directive within the <code class="filename">httpd.conf</code> <code class="literal">Location</code> block, like so:</p> <div class="informalexample"> <pre class="programlisting"> <Location /repos> DAV svn SVNPath /var/svn/repository SVNAutoversioning on </Location> </pre> </div> <p>When Subversion autoversioning is active, write requests from WebDAV clients result in automatic commits. A generic log message is automatically generated and attached to each revision.</p> <p>Before activating this feature, however, understand what you're getting into. WebDAV clients tend to do <span class="emphasis"><em>many</em></span> write requests, resulting in a huge number of automatically committed revisions. For example, when saving data, many clients will do a <code class="literal">PUT</code> of a 0-byte file (as a way of reserving a name) followed by another <code class="literal">PUT</code> with the real file data. The single file-write results in two separate commits. Also consider that many applications auto-save every few minutes, resulting in even more commits.</p> <p>If you have a post-commit hook program that sends email, you may want to disable email generation either altogether or on certain sections of the repository; it depends on whether you think the influx of emails will still prove to be valuable notifications or not. Also, a smart post-commit hook program can distinguish between a transaction created via autoversioning and one created through a normal Subversion commit operation. The trick is to look for a revision property named <code class="literal">svn:autoversioned</code>. If present, the commit was made by a generic WebDAV client.</p> <p>Another feature that may be a useful complement for Subversion's autoversioning comes from Apache's <code class="literal">mod_mime</code> module. If a WebDAV client adds a new file to the repository, there's no opportunity for the user to set the the <code class="literal">svn:mime-type</code> property. This might cause the file to appear as a generic icon when viewed within a WebDAV shared folder, not having an association with any application. One remedy is to have a sysadmin (or other Subversion-knowledgeable person) check out a working copy and manually set the <code class="literal">svn:mime-type</code> property on necessary files. But there's potentially no end to such cleanup tasks. Instead, you can use the <code class="literal">ModMimeUsePathInfo</code> directive in your Subversion <code class="literal"><Location></code> block:</p> <div class="informalexample"> <pre class="programlisting"> <Location /repos> DAV svn SVNPath /var/svn/repository SVNAutoversioning on ModMimeUsePathInfo on </Location> </pre> </div> <p>This directive allows <code class="literal">mod_mime</code> to attempt automatic deduction of the MIME type on new files that enter the repository via autoversioning. The module looks at the file's named extension and possibly the contents as well; if the file matches some common patterns, the file's <code class="literal">svn:mime-type</code> property will be set automatically.</p> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="svn.webdav.basic.html">Prev</a> </td> <td width="20%" align="center"> <a accesskey="u" href="svn.webdav.html">Up</a> </td> <td width="40%" align="right"> <a accesskey="n" href="svn.webdav.clients.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">What Is WebDAV? </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> Client Interoperability</td> </tr> </table> </div> <div xmlns="" id="vcws-footer"> <hr /> <img src="images/cc-by.png" style="float: right;" /> <p>You are reading <em>Version Control with Subversion</em> (for Subversion 1.8), by Ben Collins-Sussman, Brian W. Fitzpatrick, and C. Michael Pilato.</p> <p>This work is licensed under the <a href="http://creativecommons.org/licenses/by/2.0/">Creative Commons Attribution License v2.0</a>.</p> <p>To submit comments, corrections, or other contributions to the text, please visit <a href="http://www.svnbook.com/">http://www.svnbook.com/</a>.</p> </div> </body> </html>