SVN Destillate
- This is an extremely short quick introduction to Subversion.
- This introduction assumes you are familiar with UNIX and know how to adopt the examples for your needs.
- Further, this introduction assumes you are familiar with configuration management in general.
Basics
Subversion (SVN) is a version control system. A version control system performs the task of tracking changes and versions of files. Usually, version control systems are mainly used by software developers.
An SVN Repository is a kind of virtual server for version control.
When working with SVN, you'll work like this:
- Create a Sandbox.
- Make local Changes.
- Regularly Update your sandbox.
- Delete changes you don't feel content with.
- Commit changes you're content with.
- Repeat 2. through 5. as required.
For migrators from other version control / configuration management systems
- SVN is optimistic: No locking, SVN tries to solve conflicts using intelligent diffs first.
- One machine can hold several repositories.
- One repository can hold several modules.
- One module consists of any number of directories (perhaps submodules) and files.
A module is a project
(simply spoken).- A sandbox is a user's local recursive copy of a module's contents and version.
- All work is done in a sandbox.
- SVN works on binary files and only stores deltas. A tab or 8 spaces makes a difference.
- Successful usage of SVN is based on strict conventions for code style and SVN rules.
- SVN supports merging but not branching or tagging. Instead, SVN supports cheap copies, which can be used as a complete substitute for branching and tagging.
- SVN versions the repository, not single files or directories.
User Commands
- Create a sandbox
svn checkout svn+ssh://host/pathToModule
To execute the following commands, you must be in a sandbox.
- Update your working copy (sandbox)
svn update- Make changes
svn addsvn deletesvn copysvn move
- Examine your changes
svn statussvn diffsvn revert
- Merge others' changes into your working copy
- Commit your changes
svn commit
The golden rules
Only commit working changes.
Commit often, Commit early.
Write reasonable log entries.
Status Output
The characters printed by the command status have the following meaning:
- ? File unknown to SVN.
- A File locally added.
commit is required to permanently add the file to the repository. - C modified File updated performing a merge, but a conflict happened (automatic merge unsuccessful).
- D File locally deleted.
commit is required to permanently remove the file from the repository. - G modified File updated performing a merge.
- M File locally modified.
commit is required to permanently let the changes take effect. - R File Replaced (deleted locally, but a new repository version was created)
- U unmodified File updated.
Server Admin
- Create a repository
svnadmin create --fs-type fsfs /home/svnroot
- Create a module (way 1)
mkdir tmpdir
cd tmpdir
mkdir -p prjNam/{trunk,branches,tags}
svn import . file:///path/to/repos --message 'Initial repository layout'- Run svnserve (optional, only for svnserve access)
- Add the following lines to
/etc/services: svn 3690/tcp # Subversion
svn 3690/udp # Subversion
Add the following line to /etc/inetd.conf:
svn stream tcp nowait svnowner /usr/bin/svnserve svnserve -i
With svnowner being a user with appropriate permissions to access your repositories.