11.07.2015 Views

Version Control with Subversion - Login

Version Control with Subversion - Login

Version Control with Subversion - Login

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Server ConfigurationOne of the most useful benefits of an Apache/WebDAV configuration for your <strong>Subversion</strong>repository is that the youngest revisions of your versioned files and directories are immediatelyavailable for viewing via a regular web browser. Since <strong>Subversion</strong> uses URLs toidentify versioned resources, those URLs used for HTTP-based repository access can betyped directly into a web browser. Your browser will issue an HTTP GET request for thatURL; based on whether that URL represents a versioned directory or file, mod_dav_svnwill respond <strong>with</strong> a directory listing or <strong>with</strong> file contents.Since the URLs do not contain any information about which version of the resource youwish to see, mod_dav_svn will always answer <strong>with</strong> the youngest version. This functionalityhas the wonderful side effect that you can pass around <strong>Subversion</strong> URLs to your peers asreferences to documents, and those URLs will always point at the latest manifestation ofthat document. Of course, you can even use the URLs as hyperlinks from other web sites,too.Can I View Older Revisions?With an ordinary web browser? In one word: nope. At least, not <strong>with</strong> mod_dav_svnas your only tool.Your web browser speaks ordinary HTTP only. That means it knows only how to GETpublic URLs, which represent the latest versions of files and directories. According tothe WebDAV/DeltaV specification, each server defines a private URL syntax for olderversions of resources, and that syntax is opaque to clients. To find an older version ofa file, a client must follow a specific procedure to “discover” the proper URL; the procedureinvolves issuing a series of WebDAV PROPFIND requests and understandingDeltaV concepts. This is something your web browser simply can't do.So, to answer the question, one obvious way to see older revisions of files and directoriesis by passing the --revision (-r) argument to the svn list and svn cat commands.To browse old revisions <strong>with</strong> your web browser, however, you can use thirdpartysoftware. A good example of this is ViewVC (http://viewvc.tigris.org/). ViewVCwas originally written to display CVS repositories through the Web, 7 and the latestreleases are able to understand <strong>Subversion</strong> repositories as well.Proper MIME typeWhen browsing a <strong>Subversion</strong> repository, the web browser gets a clue about how to rendera file's contents by looking at the Content-Type: header returned in Apache's responseto the HTTP GET request. The value of this header is some sort of MIME type. By default,Apache will tell the web browsers that all repository files are of the “default” MIME type,typically text/plain. This can be frustrating, however, if a user wishes repository files torender as something more meaningful—for example, it might be nice to have a foo.htmlfile in the repository actually render as HTML when browsing.To make this happen, you need only to make sure that your files have the propersvn:mime-type set. We discuss this in more detail in the section called “File ContentType”, and you can even configure your client to automatically attach propersvn:mime-type properties to files entering the repository for the first time; see the sectioncalled “Automatic Property Setting”.So in our example, if one were to set the svn:mime-type property to text/html on filefoo.html, Apache would properly tell your web browser to render the file as HTML. Onecould also attach proper image/* MIME-type properties to image files and ultimately getan entire web site to be viewable directly from a repository! There's generally no problem<strong>with</strong> this, as long as the web site doesn't contain any dynamically generated content.7 Back then, it was called ViewCVS.180

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!