Subversion Overview

We are running an Subversion server at svn.ee.ethz.ch.

To use Subversion you will need most of the time the svn command which is installed on all of our UNIX platforms. On Windows we suggest using TortoiseSVN, also available in our Windows Environment.

Requesting a Subversion Repository

Please send a request to support@ee.ethz.ch with the name of the repository you wish to have. We will create the repository and send you the access credentials. You can then add coworkers by your own through http://svnmgr.ee.ethz.ch/.)--

We don't actually create new SVN repositories anymore. Please use Git on https://git.ee.ethz.ch. instead. As a D-ITET user you can log in there with your NETHZ credentials and create Git repositories by yourself.

Checking Out the Repository

When you have got a repository you can begin with these steps to start with your project:

  1. Create a subdirectory in your home directory, preferably with the same name as the repository, which would correspond to the name of one of your projects.

user@hostname:~>mkdir myproj

  1. Make first contact with the svn server, you will be asked to enter your password, which will be saved in a hidden .svn folder so you won't be asked anymore.

user@hostname:~>svn checkout https://svn.ee.ethz.ch/myproj
Authentication realm:  myproj
Password for 'muster':
Checked out revision 0.
user@hostname:~>ls -lA myproj
total 8
drwxr-xr-x   7 muster  myproj        512 May 27 18:11 .svn/

There is the .svn folder in which Subversion stores settings like the project repository, server and so on.

  1. Now you can create a structure inside this project. We recommend one like "trunk", "releases" and "tags". The first is for the main development (working directory), the second is for milestones of your development (fixed releases without known bugs) and in tags you can put in fixed steps in your development toward a new release. This is just a recommendation though.

An example of this (not the best way, but just to show how it would work):

cd myproj
mkdir trunk tags releases
svn add trunk tags releases
  1. A more elegant way to achieve the same by creating the structure directly on the Subversion-server:

user@hostname:~>cd myproj
user@hostname:~>svn mkdir trunk tags releases
  1. You can start now 'populating' the project directory:

user@hostname:~>svn checkout https://svn.ee.ethz.ch/myproj
A  myproj/trunk
A  myproj/revisions
A  myproj/tags

Note that here you do not create the subdirectories yourself, Subversion does it for you as defined on the server and the system adds necessary information in the .svn subdirectory too.

Adding Files To Your Repository

  1. We will now assume that you have got some Perl-files in your home, which you want to add to your trunk.

user@hostname:~>cp ~/perl/*.pl trunk

To let Subversion know that there are new files which need to be stored centrally, do the following:

user@hostname:~>cd trunk
user@hostname:~>svn add *
A         admin_portal.pl
A         adv_reg_portal.pl
A         assign_to_reviewer.pl
A         assign_to_tc.pl
A         attendees.pl
A         build_sessions.pl
A         change_cont_pass.pl
A         change_rev_pass.pl
A         change_tc_pass.pl
...

The 'A' stands for added (to Subversion).

  1. We assume now that you have edited some files and want to commit the changes centrally:

user@hostname:~>svn commit -m "Saving the first version" #-m is the comment for this revision
Adding         trunk
Adding         trunk/admin_portal.pl
Adding         trunk/adv_reg_portal.pl
Adding         trunk/assign_to_reviewer.pl
Adding         trunk/assign_to_tc.pl
Adding         trunk/attendees.pl
Adding         trunk/build_sessions.pl
Adding         trunk/change_cont_pass.pl
Adding         trunk/change_rev_pass.pl
Adding         trunk/change_tc_pass.pl
Transmitting file data ..............................................
Committed revision 1.

Deleting Files From Your Repository

  1. We could now delete the files in the trunk directory and a checkout or update would again fetch the files from the last revision:

user@hostname:~>rm -r trunk
user@hostname:~>svn checkout https://svn.ee.ethz.ch/myproj/trunk/
A  trunk/logadmin.pl
A  trunk/submit_paper.pl
A  trunk/enroll.pl
A  trunk/include
A  trunk/include/header_one.inc
...
Checked out revision 4.
  1. Before editing files, you should always do a svn update to get the latest revision of the files.

user@hostname:~>vim trunk/admin_portal.pl
user@hostname:~>svn commit -m "saving admin_portal.pl" trunk
Sending        trunk/admin_portal.pl
Transmitting file data ...
Committed revision 5.

Note: Revision 5 is a set for the repository tree (for ALL the files) even if the only difference between revision 4 and 5 is in the file admin_portal.pl.

Generating Tags In A Repository

  1. We can now generate a 'tag' (a snapshot of the last revision):

#as a first important step, check-in all changed files of the trunk
user@hostname:~>svn commit -m "pretagging commit" trunk
#then do the tagging directly on the server
user@hostname:~>svn copy -m "tagging version release-1.0" https://svn.ee.ethz.ch/myproj/trunk \ https://svn.ee.ethz.ch/myproj/tags/release-1.0;

To remove a badly tagged version you can do this too directly server:

user@hostname:~>svn rm https://svn.ee.ethz.ch/myproj/tags/badlytaggedversion

To have a look which taged versions are available:

user@hostname:~>svn ls https://svn.ee.ethz.ch/myproj/tags/

12. To move whole branches from one place in the repository to another:

user@hostname:~>svn mv https://svn.ee.ethz.ch/myproj/trunk/test/subdir https://svn.ee.ethz.ch/myproj/trunk/plan/

Further Steps

This above were just basic steps to show you the concept behind Subversion. We recommend you to read the reference book called Version control with Subversion

Migrating a CVS to a Subversion Repository

After logging in on a Solaris-machine, execute the following command:

usr/pack/subversion-1.2.1-rp/cvs2svn/cvs2svn --create -s $URL_OF_NEW_SVN_REPO $URL_OF_OLD_CVS_REPO

Known Problems

GNOME keyring is locked and we are non-interactive


CategoryREVC

Services/VersionControlSystems/Subversion (last edited 2018-09-25 11:07:32 by pmeier)