Reference: The SVN user manual

These instructions will create a repository on your local disk with capability to support multiple projects. I use the file structure layout recommended in the SVN user guide.

Using one common repository for all projects:

Pros:

  • One place to hold all your projects. One set of hook programs/scripts.

Cons:

  • Each project may have different event triggers (e.g. who gets emailed when a check in is made). Hook scripts need to manage these issues.
  • Revision numbers are global to the repository. So though no changes have been made to a project it will still get a new rev number if some other project gets checked in.

The recommended directory structure (in svnbook):

MyMainSvnDirectory/
    Proj1/
        trunk/
        tags/
        branches/
    Proj2/
        trunk/
        tags/
        branches/

Creating a Repository:
    svnadmin create MyProjects/

This will create the following under MyProjects/

MyProjects/
    README.txt
    conf
    dav
    db          – Holds the versioned filesystem
    format
    hooks

Initial import:

    svn import Proj1 file:///Full_Path/MyProjects/Proj1/ -m “Initial import”

This will copy files in Proj1 into the directory Proj1 in the repository. After the import is done the original directory is NOT converted into a working copy. You need to check out the code in a separate directory.

Checking out code:

    svn checkout file:///Full_Path/MyProjects/Proj1 WorkingDir

This will check out the latest committed copy of Proj1 into WorkingDir

Adding a new file:
   
    svn add filename

Do this from a checked out working directory

Deleting a file:
   
    svn delete filename

Examining changes:

    svn status
    svn diff

Resolving conflicts:
   
    svn update
    svn resolve

Commit changes:

    svn commit

Browsing the repository:
   
    svn list file:///Full_Path/MyProjects
    svn list file:///Full_Path/MyProjects/trunk

Creating a branch:

    svn copy file:///Full_Path/MyProjects/Proj1/trunk file:///Full_Path/MyProjects/Proj1/braches/branch1 -m “Creating a new branch”

Creating a tag works the same way except you copy to the tags directory.