Wednesday, December 12

Code Versioning with SVN

SVN is a code versioning tool, which has being gaining popularity over the more well known CVS.

Some SVN commands for server:

  • To run the SVN server serving out to your clients:
    • svnserve -d -r c:/svnrepos/ --listen-port 7788
      Start the daemon svn server, with repository under that directory, listening to port 7788.
  • To create a new project in the repository.
    • svnadmin create TestProject
  • In the project repository conf directory (eg. c:/svnrepos/TestProject/conf/),
    • Add users in 'passwd' file
      Example:
      jd = password
    • Add permissions in 'authz' file
      Example:
      [groups]
      tribe_r = user1,user2

      [/]
      @tribe_r = r
      jd = rw
  • Use TortoiseSVN to do an initial import.
    Example of an URL:
    • svn://localhost:3690/TestProject
  • When you need to do a migration (moving your repository to another computer, possibly with another ),
    • svnadmin dump c:/svnrepos/TestProject > TestProject.dumpfile
      This will create a dump file of the entire TestProject repository
    • svnadmin create TestProjectNew
      Create the new repository in the new computer.
    • svnadmin load TestProjectNew < TestProject.dumpfile
      With load, your project repository will be migrated successfully!
    • Copy the passwd and authz files directly to set up the same access rights.

For client:
  • Use TortoiseSVN to do a initial checkout with the same URL.
  • Thereafter users can commit and update with the same URL.
  • Client is as simple as that...

Resources:
  • Collabnet SVN - Download both server and client with tortoise GUI

1 comments:

Leena said...

Well written article.