Warning: Subversion is considered obsolete. Offical LARICS policy is to use git instead!
The primary goal of Subversion is to keep track of your source code. It can also handle binary files, but the repository size can grow quickly (and make our server run out of disk space) if you abuse this capability. When using the repository, please follow these simple rules:
1) Only import files you have created, NEVER import automatically generated files (e.g. build output of your code). When importing a project, ALWAYS clean it before the import!
2) Generally, import only text files (source code) and images. As a rule of thumb, if a file is bigger than 5MB, think weather it's really necessary to keep it in SVN.
If none of this makes sense, please read again, after reading the rest of the information on this page. If it still doesn't make sense, ask :)
Subversion is a free/open-source version control system. That is, Subversion manages files and directories, and the changes made to them, over time. This allows you to recover older versions of your data, or examine the history of how your data changed. In this regard, many people think of a version control system as a sort of “time machine”. (from The preface to "Version control with Subversion")
It can enable a group of developers to work on the same programming project in parallel, without destroying each other's changes, and to retrieve previous versions of files.
$ svn help
on your command line, to check if you have the Subversion client installed. If you don't, use
$ aptitude install subversion
to install it. (You will need to do this with root privileges).
After you have the client installed, you can make the initial project checkout. Type
$ svn checkout svn://flrcg-debian.flrcg.local/home/svn/larics/projectname/trunk projectname
to get your working copy of the project files. The folder 'projectname' is created automatically if it doesn't already exist. You can now go ahead and edit the project files. From your top-level project directory 'projectname', use
$ svn status
to get a list of files that have changed since your last checkout and
$ svn diff
to examine the changes, line by line.
Before committing your changes to the repository do
$ svn update
to incorporate any changes that others may have made since your last checkout. If there are no conflicts you can now commit your changes
$ svn commit -m "A short info about your changes."
$ svn mkdir <repo>/newProject -m "Creating dir for newProject." $ svn checkout <repo>/newProject /path/to/codebase $ svn add /path/to/codebase/* $ svn commit /path/to/codebase -m "adding initial codebase"
Taken from here.
Download and install the TortoiseSVN Subversion client. After installation, the client will integrate itself into Windows Explorer. You can access it with the right mouse button.
To check out a working copy of an existing project, just navigate to the folder where you want to put it, right-click and select the menu option 'SVN Checkout'. Enter the repostitory URL:
and just click on 'OK'.
To do an initial import of your project inside an existing repository, first use TortoiseSVN→Repo-browser and create the top-level directory layout for your project, e.g.
projectname/trunk projectname/branches projectname/tags
Before you import your project into a repository you should:
Now select the top-level folder of your project directory structure in the windows explorer and right click to open the context menu. Select the command
TortoiseSVN → Import… In the dialog you have to enter the URL of the repository into which you want to import your project. As soon as you press 'OK', TortoiseSVN imports the contents of your folder into the repository. Please note that the folder you imported is NOT under version control! To get a version-controlled working copy you need to do a Checkout of the version you just imported. You can only checkout to an empty folder, so you won't be able to checkout to the folder from which you've made the import (unless you delete it's contents first).
NOTE: The top-level directory will not be imported, i.e., in the example above, you would directly import three directories:
This is a very short “how I did it and it worked” to installing a Subversion server on a Debian Linux PC. For more information please consult the Subversion book.
1) Install Subversion (you will need root privileges)
$ aptitude install subversion subversion-tools
2) Start the server daemon process
$ svnserve -d
3) Create a user account for managing the Subversion repository and switch to that user
$ adduser svn $ su svn
4) Create a repository
$ svnadmin create /home/svn/larics
5) Add registered users to the repository
in /home/svn/larics/conf/svnserve.conf uncomment the line password-db = passwd in /home/svn/larics/conf/passwd add usernames and passwords
We are currently usig inetd to start the subversion daemon whenever a client requests a connection. To configure it, simply append the following line:
svn stream tcp nowait svn /usr/bin/svnserve svnserve -i
to the end of the
/etc/inetd.conf file. Of course, make sure that inetd is installed an running.
tmp/myproject/branches/ tmp/myproject/tags/ tmp/myproject/trunk/ src/ include/ Makefile README.txt ...
svn import tmp/myproject svn://flrcg-14.rasip.fer.hr/home/svn/larics -m "Initial import"
And that's all there is to it :) You can now check your project layout with
$ svn list svn://flrcg-14.rasip.fer.hr/home/svn/larics/myproject
You do not have a working copy of your project yet. Subversion is unaware of your
tmp/myproject folder and you may delete it if you wish. To obtain your working copy, you need to check out
myproject/trunk from the repository
$ svn checkout svn://flrcg-14.rasip.fer.hr/home/svn/larics/myproject/trunk myproject.
You now have a personal copy of the project in a new directory named 'myproject'.
NOTE: This might not be the best way to do it, as importing older repos into a newer version of SVN might cause problems.
Migrating repositories to a new server seemed simple for my particular use case. I was migrating from one Debian server to another.
1) Set up subversion on your new server 2) On the old server, backup the original repositories using svnadmin hotcopy, compress it for easier transfer to the new server
$ svnadmin hotcopy /path/to/repo /path/to/repo-bacup $ tar -cvf repo-bacup.tar repo-bacup/ $ gzip repo-bacup.tar
3) On the new server, fetch the bacups, extract and rename them
$ scp email@example.com:/path/to/repo-bacup.tar.gz . $ tar -xzvf repo-bacup.tar.gz $ mv repo-bacup repo
Your repositories should now be accessible from the new location.
Repositories can also be backed up using the dump command. This preserves the full revision history, but the dump files are pretty big.
$ svnadmin dump /path/to/old-repo > /path/to/old-repo.dump
To recover the repository, first create a new empty repository, and then import the dump:
$ svnadmin create /path/to/new-repo $ svnadmin load /path/to/new-repo < /path/to/old-repo.dump
and if you are lucky, that's it :)
If you are using sudo to create the dump, watch out because redirection does not work directly with sudo. You need to do
$ sudo sh -c 'svnadmin dump /path/to/old-repo > /path/to/old-repo.dump'