create new tag
, view all tags

ID/BD Subversion Guide

Please notify errors or missing information to Matteo Corti matteo.corti@id.ethz.ch

Table of contents


Web interface

The repositories can be accessed using ViewVC:



The client is included in almost any distribution. The sources can be downloaded from http://subversion.tigris.org


The client is available from sunfreeware.com


The command-line client is available under the cygwin environment or can be downloaded from http://subversion.tigris.org.

TortoiseSVN is nice GUI that integrates nicely with the Windows Explorer ( Download).

Mac OS X

The command line client can be installed via Fink or downloaded from http://metissian.com/projects/macosx/subversion/.

A tool to integrate it with the Finder is in development ( Info & download). You can install a precompiled binary ( SCFinderPlugin.plugin.zip 2006-01-12) by copying SCFinderPlugin.plugin to ~/Library/Contextual Menu Items/ and by restarting the Finder (command–option–esc).


Several plugins exist to integrate Subversion into common programming tools such as Eclipse or Emacs:

Client Configuration

You can configure your client to automatically tag files with the right properties (see properties).


  • Unix — system-wide: /etc/subversion/config
  • Unix — per-user: ~/.subversion/config
  • Windows: — system-wide: %ALLUSERSPROFILE%\Application Data\Subversion\config or REGISTRY:HKLM\Software\Tigris.org\Subversion\Config
  • Windows: — per-user: %APPDATA%\Subversion\config or REGISTRY:HKCU\Software\Tigris.org\Subversion\Config


Enable the following options in your client config file:

enable-auto-props = yes

*.c = svn:eol-style=native
*.cpp = svn:eol-style=native
*.h = svn:eol-style=native
*.dsp = svn:eol-style=CRLF
*.dsw = svn:eol-style=CRLF
*.sh = svn:eol-style=native;svn:executable
*.pl = svn:eol-style=native;svn:executable
*.txt = svn:eol-style=native
*.png = svn:mime-type=image/png
*.jpg = svn:mime-type=image/jpeg
 Makefile = svn:eol-style=native

Sample config file

Automatic login

Subversion authomatically stores your password in a local file. You can disable this behavior by setting store-passwords to no:

store-passwords = yes

Quick reference and howto

Initial check out

To check out a repository (neptun in our example) for the first time:

=$ svn checkout https://svn.id.ethz.ch/neptun=

Updating your working copy

To integrate the changes on the repository into your working copy

$ svn update

To revert your changes to the working copy

$ svn revert

Commit changes

To commit the changes on your working copy to the repository

$ svn commit

File manipulation

To add a file to the repository:

$ svn add

To remove a file from the repository:

$ svn delete

To copy a file:

$ snv copy

To move a file:

$ svn move

Note: these command affect your local working copy only. To make the changes to the repository you have to commit your working copy ( $ svn commit)


To check the status of the repository:

$ svn status

To list the differences between the working copy and the repository:

$ svn diff


Properties are additional information that is attached to a file. An example is the svn:executable property which tags the file as executable.

To list a file's properties:

$ svn proplist

To delete a property:

$ svn propdel

To set a property:

$ svn propset (e.g., $ svn propset svn:executable FILE)

To edit a property with an external editor:

$ svn propedit (e.g., $ svn propedit svn:ignore .)


  • Add a custom single line text property: $ svn propset copyright 'ETH Zurich' FILE
  • Add a custom binary property: $ svn propset picture -F logo.jpg FILE

Special properties

  • svn:executable: sets the executable bit on filesystems that support it
  • svn:ignore: specifies which file patterns to ignore for a given directory
  • svn:mime-type: file's Multipurpose Internet Mail Extensions (MIME) classification
  • svn:keywords: specifies for which keywords svn have to perform a substitution in the file (e.g., Date, LastChangedDate, Revision, Author, HeadURL and Id)
  • svn:eol-style: specifies which EOL style to use for the file ( native: the file will be checked out with the EOL markes native to system, CRLF: DOS, LF: UNIX, CR: old Mac OS)


svn:ignore is used to tell subversion which file are not to be considered (e.g., when doing a status query). Let's assume that we want to ignore file1 and file2 — because they are automatically generated — in our current directory:

$ svn propset svn:ignore 'file1
 file2' .

Please not that each ignored file has to be on a separate line.


If a file is changed in more than one location subversion will notify that there is a conflict. The user has than to choose which is the correct version and then tell subversion that the conflict is resolved using svn resolved [FILE]


We check out the same file on two machines (machine1 and machine2):

machine1: $ svn co https://svn.id.ethz.ch/repository/
A repository/file
 Checked out revision 1.

machine2: $ svn co https://svn.id.ethz.ch/repository/
A repository/file
 Checked out revision 1.

The file is then changed on the two machines:

machine1: $ echo "1" >> file
 machine2: $ echo "2" >> file

One of the machines commits the changes:

machine1: $ svn commit -m 'comment' file
 Sending        repository/file
 Transmitting file data .....
Committed revision 2.

On the other machine we updated the repository:

machine2: $ svn update
 C    repository/file
 Updated to revision 2.
in this case subversion is notifying the the current version is in conflict with version 2 on the server. We now have to choose which version is the correct one. Subversion creates four files to help us:
  • file: is an automatically merged version (changes are marked in the file)
  • file.mine: was the local copy before the merge
  • file.2: version on the server
  • file.1: the last common version
We can the edit file to be what we want and tell subversion that the conflict is resolved:
machine2: $ svn resolved file
 Resolved conflicted state of 'file'

Branching and merging

To create a new branch for a repository (or part of it):

$ svn copy trunk branches/new_branch

You can then work indipendently on the main trunk and the branches. To merge two versions use svn merge.


The main development trunk is stored in /myprogram. Now you want to make some major changes without making the main trunk unusable (you might want to apply some patches to myprogram while you are working on anothert branch).

You create a temporary branch:

$ svn copy myprogram myprogram-newfeature

After some time you decide that the new feature is stable enough to be included in the main trunk and decide to merge.

The first thing to do is to check the differences between the trunk and the branch

=$ svn diff -r VER1:VER2 https://svn.id.ethz.ch/myprog-newfeature https://svn.id.ethz.ch/myprog=

If you are satisfied with the changes you can issue the actual merge command:

=$ svn merge -r VER1:VER2 https://svn.id.ethz.ch/myprog-newfeature https://svn.id.ethz.ch/myprog=

The merge command acts locally: to make your changes definitive you have to commit.

If you are not interested in the -newfeature branch you can delete it with the delete command.

Q & A

Error 301

Q: Why do I get an error 301 when I access the repository?

$ svn co http://svn.id.ethz.ch/REPOSITORY
 svn: PROPFIND request failed on '/REPOSITORY'
svn: PROPFIND of '/REPOSITORY': 301 Moved Permanently (http://svn.id.ethz.ch)

A: We do not accept unencrypted connections: use HTTPS instead of HTTP.

No external editor

Q: Why does subversion need an external editor?

$ svn commit
 svn: Commit failed (details follow):
svn: Could not use external editor to fetch log message; consider setting the $SVN_EDITOR environment variable or using the --message (-m) or --file (-F) options
 svn: None of the environment variables SVN_EDITOR, VISUAL or EDITOR is set, and no 'editor-cmd' run-time configuration option was found

A: It is customary and good practice to include a comment with each commit. This can be done on the command line with the -m message option or using an editor of your choice. To use and external editor you have to:

  • set the SVN_EDITOR shell variable (e.g., on bash export SVN_EDITOR=xemacs or on [t]csh setevn SVN_EDITOR xemacs)
  • set the VISUAL or EDITOR shell variable

It is not advised to set disable comments in the client configuration.


Q: Are UNIX permissions preserved?

A: No but it is possible to tag a file as executable (see properties)

Differences between the repository and the working copy

Q: How can I see which are the changes that I made?

A: $ svn diff [filename]

Q: How can I see which are the changes on the repository from my last update?

A: $ svn diff -r HEAD [filename]

New files

Q: Why new files are not included in the repository?

A: To be included in the repository new files (or directories) must be explicitely included with the add command.

$ svn add [FILE]; svn commit -m 'adding some files...'

Locks I

Q: What does the working copy locked error mean?

A: Each time subversion performs an operation on the working copy logs what is done and locks the directory. If something happens (i.e., subversion crashes) the stale information remains in the .svn directory. The next time subversion will be invoked it will not perform the command until the lock is released. To release the lock:

$ svn cleanup

Locks II

Q: Is it possible to lock some files or directories?

A: If it is really necessary it is possible to lock changes to a resources (although not advised as a normal practice). Use svn lock to lock a file or directory and svn unlock to unlock it. ( Detailed information)

Topic revision: r1 - 2007-07-25 - MatteoCorti
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback