How to use SVN

Because of the mass of bad and ugly Howto's of SVN found on the internet, and for the users of my SVN repository... i decided to write my own Howto

Basic Usage

  • First of all, install SVN ( subversion package )
  • Obtain a list of the possible projects to download from a SVN repository:
    svn list --verbose svn://
  • Download the sources of the subdir translations:
    svn co svn:// translations_svn
    • We have used translations for this example
    • We have called the destiny directory translations_svn
    • svn co is the same as svn checkout
  • Update a previous downloaded SVN copy:
    svn update
    • IMPORTANT: If you are a developer (that you change the source code and will send/commit it later), always update your directory/copy BEFORE to start working on it, also, it is recommended to not send your changes after hours or days of work, the reason of this is because if somebody else is working at the same time on the same sources, you or him will have a conflict with the sources when trying to send them. In the next section is explained an easy trick to resolve this easly.

For developers

  • See the differences between your downloaded SVN and the original sources in the repository (if you have made any modifications)
    svn diff
  • Send modifications of the files (also called commit)
    svn commit -m 'Fixed the bug of double interfaces launched'
    svn commit evidence-gui* -m 'Sending all the evidence-gui prefixed files'
    • You need to add a comment with the -m option, it's important that you provide a good description in order to know better what is about your modifications, and so to browse more easly changes in the repository when you are searching for specific things
  • Add files/directories that will be uploaded in your next commit.
    svn add file
    svn add directory
    svn add images/*.png
    • IMPORTANT: When you do svn add directory, it will be included ALL the files and subdirectories of this directory, this means that you will add a lot of files that are not needed, like .edj, elf or binary/compiled files, etc... PLEASE clean up the directories that you are adding to the SVN before to import them with this command, we dont want to have not-needed files in the SVN repository that will takes space on the server and our copies, making a svn repository slow, and that will also conflict with our own builds (like files that are compilable). Thanks
    • Note: If you copy a file to your directory and don't run this command, it will be not uploaded to the repository, this is very useful like if you compile a .edj file and you don't need to send it.
  • Delete files
    svn delete file
    svn delete images/
    svn delete test*.c
  • Move files
    svn mkdir data
    svn move images data/images
  • Revert modifications (Revert modifications (that are not commited yet), you can also use delete if you do it before to commit
    svn revert file
    svn revert directory
  • Verify the status of the repository and your working environment
    svn status
  • Fix your changes with another persons changes ( When you have worked in this file, another person has worked also, and there are differences between the new changes, you need to fix your code with the new commit of this person )
    ---> This section need to be edited, i have never tried these options <---
    svn status
    svn help merge
    svn help resolved
  • TIP about fixing changes (conflicts) between different codes:

If you have a conflict when trying to send your modifications, because somebody else has also send modifications in the file that are you working (and so, you have started to work in a version of the sources that is previous to his changes, in other words, you need to mix your changes with his changes), an easy way to do this is to; move your conflicting directory to elsewhere, like directory.mine, run svn update in order to get a new copy of that directory updated that include the changes that conflicts with yours, now run the tool meld with your modifications and the new directory (on this order), then you have in the left your changes that needs to be merged in the right, with this tool you can do it very easly and fast (try to press the keys shift, control, alt before to merge, to see more options). When you have finished to include your changes in the new directory, exit the application and commit the new directory like it was your original one, go to and if your changes looks correct, remove the old directory.

These are the definitions of the flags that you see when you download or update a SVN copy:

UUpdated file, changes made on the server
AAdded, file added to the copy of work
DDeleted, file deleted from the copy of work
RReplaced, (deleted and added again, normally diferent file)
GMerGed, the file from your copy of work and the repository has changed, but added successfully
CConflicting, the file downloaded has diferences with your file, you need to fix it manually

For Administrators and Servers

How to make a SVN server:

  • Verify if you have the svnserve command
  • Create a SVN repository ( we use in this example svnrepo in a home of a user created only for this )
    su svndevels
    cd /home/svndevels
    svnadmin create svnrepo
  • Edit the /etc/inetd.conf file and add this line:
    svn             stream  tcp     nowait  svndevels       /usr/bin/svnserve svnserve -i -r /home/svndevels/svnrepo
    • We have added -r /home/svndevels/svnrepo for when you check the repository from internet, you don't need to enter all /home/svndevels/svnrepo address, you have the repository directly from the simple host address
  • Create a new directory project
    svn mkdir file:///home/svndevels/svnrepo/project1 -m 'Creation of the directory'
  • Import the source code of a project on it
    svn import /home/svndevels/sourcecodes/source-evidence file:///home/svndevels/svnrepo/project1 -m 'Importing the sources of evidence to project-1'
  • Add users and give access to the repository (Important step for external connections)
    • Edit the configurations file
      vi svnrepo/conf/svnserve.conf
    • Un-comment the lines of need configuration for give a similar look:
      anon-access = read
      auth-access = write
      password-db = passwd
      • Important to not have spaces before the first character
      • Access type: read, write, none
      • Where:
        • anon-access is the access type of the non-identified users
        • auth-access is the access type for the identified users
        • password-db is the name of the file of contains the users and passwords
  • Now we edit the passwd file
    vi svnrepo/conf/svnserve.conf
    testuser = passme
  • Restart the inetd service now with root
    /etc/init.d/inetd restart
  • Redirect the port 3690 in TCP mode to your machine ( You can posible to use apache configuration, manage more easy diferents users and use the port 80 and accessing by http address, but this is not described in this howto )
  • Verify if the server works
    svn list --verbose svn://domain
  • I recomend to create a "test" project for make any test before to work directly on the real project

More information about SVN

The better documentation of SVN is in any case, the  Book of SVN, all things are described on this book with good sections, you learn and found really more fast with this book than using howto's found in internet, from my experience, i don't have found any real good howto about SVN in google and the only thing of i have done, is lost 4 hours for not obtain any thing

The website is very good, you can found a related article on