wiki:HowtoSVN

Version 2 (modified by Thanatermesis, 15 years ago) ( diff )

--

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://elivecd.org
    
  • Download the sources of the subdir translations:
    svn co svn://elivecd.org/translations 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
    


For developers

  • See the differences between your copy and the original repository (if you have made any changes in the code)
    svn diff
    
  • Send modifications of the files (commit)
    svn commit -m 'Fixed the bug of double interfaces launched'
    svn commit evidence-gui* -m 'Commiting the evidence-gui files'
    
    • You need to add a comment with the -m option, it's important that you provide a good description in order to better understand the steps of the code, and browse better old versions and old modifications
  • Upload (add files/directories) it in the 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 files, compiled ones, etc... please clean up the directories that you are adding to the SVN before to import them, we dont want to have not-needed files in the SVN repository that will takes space on the server, making a svn repository slow, and that conflicts with our own builds. Thanks
  • 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), don't need internet connection, but it won't recover a deleted directory)
    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
    

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:
      [general]
      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
    
    [users]
    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 http://www.debian-administration.org website is very good, you can found a related article on http://www.debian-administration.org/articles/374


Note: See TracWiki for help on using the wiki.