SVN Overview

Source: Version Control with Subversion (http://svnbook.red-bean.com/en/1.1/ch01s04.html)

Contents

Subversion (SVN)

Subversion (SVN) is a source code version control system that is rapidly replacing CVS in the open source community. It is licensed under an Apache/BSD-style open source license. In addition to the features carried over from CVS, in SVN directories, renamed files, and meta files are also versioned and commits are truly atomic--i.e., no part of the commit takes effect until the entire commit succeeds. SVN can be run under an Apache server or an independent server and a number of GUI clients are available for it. It is also compatible with Eclipse.

SVN maintains a history of file and directory versions. Files and directories are checked out of a central repository and into your local project work area. This is called your working directory. Changes are made to files in your working directory. Changes made to local files can periodically (and asynchronously) be committed to the SVN repository.

Why Revision Control

  • Centralized, server-based code repository.
  • Historical time-stamped record of revisions.
  • Synchronization of versions among developers.
  • Undoing of changes.
  • Multiple branches within a project.

Quick Start Example (http://svnbook.red-bean.com/en/1.1/ch01s07.html)

  • Create a repository ($ svnadmin create /path/to/repos)
$ ls /path/to/repos
conf/  dav/  db/  format  hooks/  locks/  README.txt
  • Create a project directory with top-level directories branches, tags, and trunks:
/tmp/project/branches/
/tmp/project/tags/
/tmp/project/trunk/
              foo.c
              bar.c
              Makefile
              …
  • Import the project directory into the repository ($ svn import /tmp/project file:///path/to/repos -m "initial import")
  • Check out a copy of the data into your project workspace ($ svn checkout file:///path/to/repos/trunk project)
  • Edit your working copy.
  • See the unified diff output of your changes ($ svn diff)
  • Commit your new version to the repository ($ svn commit)
  • Update your working copy with the latest repository version ($ svn update)

Resources