Using a SVN repository
Under Linux
Installation
It will depend of your distribution.
For gentoo:
emerge -av subversion
For Fedora:
yum install subversion
For Debian and (K/X/Edu)Ubuntu:
apt-get install subversion
For Mandriva:
urpmi subversion
Connecting to your repository
With command line
Go to a directory where you want to put the directory of all your project repository. Then, you just have to connect to the repository:
svn co http://www.sds-project.fr/svn/$YOUR_PROJECT$/ --username $YOUR_USERNAME$
With a graphical interface
With Eclipse
Use the SVN plugin for Eclipse: SubClipse.
Update your repository
If you want to fetch the new modification other users can have done in the repository, you need to upgrade your svn. For that, go to your repository directory and enter the following command:
svn update
Add a file in the SVN
To add a file (or a directory) to your repository, you go to the directory that contain the file and you just have to type the following command:
svn add file.txt
For example, to add a README file, you just have to type:
svn add README
Delete a file in the SVN
To delete a file (or a directory) that is already in the repository, you go to the directory that contain the file and type the following command:
svn delete file.txt
For example, to delete a README file, you just have to type:
svn delete README
Copy a file
You can copy a file from a directory of the svn to another directory on the same svn repository. For example, if you want to move the README file in the doc/ directory.
To move a file, you type the following command:
svn copy fichier.txt rep/
For example, for the README file:
svn copy README doc/
Move a file
If you want to move a file from a directory to another or to rename a file, you need to use the command move.
svn move fichier.txt fichier.old
svn move fichier.txt rep/
For example, to rename the README file to README.old:
svn move README README.old
For example, to move the README file to the doc/ directory:
svn move README doc/
Difference between remote and local repository
Before a commit or a update, if you want to know which files and directories change on the SVN between now and your last update, you can use the status command:
svn status
Cancel an add command
If you want to cancel the add of a file before you have commit, you can use
svn revert file.txt
Log Information about a file (or a directory)
When you need to know all the change in a file, you can use:
svn log fichier.txt
Upload all your work in the repository
Regularly, you need to send to the SVN server all your change in the repository that you have validate using the add command. For that, you need to use:
svn commit
Create a stable version (Advanced user)
When you think the developement work in trunk/ is good enough to be a release, you can create a new major version:
svn copy http://www.sds-project.fr/svn/$YOUR_PROJECT$/trunk http://www.sds-project.fr/svn/$YOUR_PROJECT$/tags/1.0
Then when you want to create a minor release:
svn merge http://www.sds-project.fr/svn/$YOUR_PROJECT$/trunk@head http://www.sds-project.fr/svn/$YOUR_PROJECT$/tags/1.0@head trunk/
Under Windows
You can install and use RapidSVN or directly integrate in your Explorer TortoiseSVN.
Copyright
This document has been write by Jonathan ROUZAUD-CORNABAS.
For any informations or re-use of this document, please mail the author (jonathan.rouzaud-cornabas AT ensi-bourges DOT fr).