Subversion is a source code repository. It was designed to replace CVS as the standard. Subversion has many advantages over CVS:
This section gives you an overview of some of the features the subversion command line client has in store. If you prefer graphical clients there are a lot of tools:
First step in preparing your repositories is usually creating the three top level directories
svn -m 'Creating top level dirs.' mkdir http://your-server-url/your-repository/trunk
You usually start by importing a non-versioned working directory as trunk of the development.
cd your-working-dir svn -m 'Initial import.' import . http://your-server-url/your-repository/trunk
Now check out what you just imported so that you have a proper working copy:
mv your-working-dir your-working-dir.old svn co http://your-server-url/your-repository/trunk your-working-dir
If you check with
You sould see a hidden
.svn directory. That indicates you have a proper working copy.
As a rule of thumb only sources should be checked in, not generated results. You can use the SVN property
svn:ignore to speficy patterns of files and directories that you don't want to check in.
Example for setting a single ignore:
svn propset -R svn:ignore '*.pdf' .
tells subversion to not check in any PDF file from the current location in the working copy. The
-R switch makes this setting recursively.
In most cases you want more than one file type to be ignored. In this case use the property editor to provide a list:
svn propedit svn:ignore .
The editor set in the environment variable
EDITOR opens and you can provide a list of patterns that should be ignored. Put each pattern into a separate line.
Examples of results you should not check in depending on your project type:
Check which properties are set with
svn proplist -v .
Don't forget to check in your
svn:ignore patterns. This way you make sure that other users have the same settings.
svn -m 'Added svn:ignore patterns.' ci .
On Debian you install subversion like this:
aptitude install subversion libapache2-svn
The second package makes subversion accessible via Web-DAV and an Apache HTTP server. Dependent packages will be installed automatically
Now you need to activate the user authentication and the DAV support of the Apache server:
a2enmod authz_user dav dav_svn
Prepare a repository directory. If you want to conform to the LSB the use
/var/lib/svn. I prefer to have everything that needs to backed up regularly unter
mkdir --parents /data/svn/MyProject svnadmin create /data/svn/MyProject chown -R www-data /data/svn/MyProject
If the password file does not yet exist create the first user with
htpasswd -cs /data/svn /etc/apache2/dav_svn.htpasswd <first user>
All users after the first one are created like
htpasswd -s /etc/apache2/dav_svn.htpasswd <user>
Start the Subversion daemon on the repository:
svnserve -d -r /data/svn/MyProject
<Location /svn/MyProject> Dav svn SVNPath /data/svn/MyProject AuthType Basic AuthName "Subversion repository: MyProject" AuthUserFile "/etc/apache2/dav_svn.htpasswd" Require valid-user Require group subversion SSLRequireSSL </Location>
In case you have a running SVN server from which to migrate, you can skip this step.
Since you probably do not want to pollute your workstation with something that should not run there I recommend creating a virtual machine with a Debian Linux on it and install the Apache server inside as described above.
In the software selection choose
to save installation time.
<code bash> apt-get install git-svn <code>
Follow this guide: http://john.albin.net/git/convert-subversion-to-git