wiki:HowtoSVN

Version 1 (modified by Thanatermesis, 16 years ago) ( diff )

--

Howto of 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://thanatermesis.org
    
  • Download the sources of a project:
    svn co svn://thanatermesis.org/test1 destdir
    
    • We can use test1 for this example
    • svn co is the same as svn checkout
  • Update a project downloading the last possible version:
    svn update
    


For developers

  • See the differences within the repository
    svn diff
    
  • Send modifications of the files or 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 it in the next commit
    svn add file
    svn add directory
    svn add images/*.png
    
  • Delete files
    svn delete file
    svn delete images/
    svn delete test*.c
    
  • Move files
    mkdir data
    svn move images data/images
    
  • Revert modifications ( Revert modifications to a file, don't need 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 don't know how to make this <---
    svn status
    svn help merge
    svn help resolved
    
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.