This section is from the "Version Control with Subversion" book, by Ben Collins-Sussman, Brian W. Fitzpatrick and C. Michael Pilato. Also available from Amazon: Version Control with Subversion.
Throughout this book, Subversion uses URLs to identify versioned files and directories in Subversion repositories. For the most part, these URLs use the standard syntax, allowing for server names and port numbers to be specified as part of the URL:
$ svn checkout http://svn.example.com:9834/repos …
But there are some nuances in Subversion's handling of URLs
that are notable. For example, URLs containing the
file://
access method (used for local
repositories) must, in accordance with convention, have either a
server name of localhost
or no server name at
all:
$ svn checkout file:///var/svn/repos … $ svn checkout file://localhost/var/svn/repos …
Also, users of the file://
scheme on
Windows platforms will need to use an unofficially
“standard” syntax for accessing repositories
that are on the same machine, but on a different drive than
the client's current working drive. Either of the two
following URL path syntaxes will work, where
X
is the drive on which the repository
resides:
C:\> svn checkout file:///X:/var/svn/repos … C:\> svn checkout "file:///X|/var/svn/repos" …
In the second syntax, you need to quote the URL so that the vertical bar character is not interpreted as a pipe. Also, note that a URL uses forward slashes even though the native (non-URL) form of a path on Windows uses backslashes.
Subversion's file://
URLs cannot be
used in a regular web browser the way typical
file://
URLs can. When you attempt to view
a file://
URL in a regular web browser, it
reads and displays the contents of the file at that location
by examining the filesystem directly. However, Subversion's
resources exist in a virtual filesystem (see the section called “Repository Layer”), and your browser
will not understand how to interact with that
filesystem.
Finally, it should be noted that the Subversion client will automatically encode URLs as necessary, just like a web browser does. For example, if a URL contains a space or upper-ASCII character as in the following:
$ svn checkout "http://host/path with space/project/españa"
then Subversion will escape the unsafe characters and behave as if you had typed:
$ svn checkout http://host/path%20with%20space/project/espa%C3%B1a
If the URL contains spaces, be sure to place it within quote marks, so that your shell treats the whole thing as a single argument to the svn program.