linux-live developers central svn setup 

setup access to the linux-live developers svn repository 

Accessing the linux-live developers svn subversion is as simple as ABC:

  1. decide where you want store you subversion files.

  2. mkdir/cd into it.

  3. issue the svn command to check it out.

That's it:

$ cd /export/repositories/svnwork
$ mkdir meta
$ cd meta
$ svn co https://live-developers.svn.sourceforge.net/svnroot/live-developers/meta/MetaBuild MetaBuild

Working History 

cd MetaBuild
# -- update trunk/template.MetaModule from v0.1-rc-2
$ svn status
M      trunk/template.MetaModule
svn commit --username=suntong001 --message "update template.MetaModule from v0.1-rc-2" trunk/template.MetaModule

When first commit, use the '—username' to specify your sf.net user name.

# -- house cleaning, remove packagelist & rename template.MetaModule
$ svn help
$ svn rm trunk/packagelist
D         trunk/packagelist
$ svn mv trunk/template.MetaModule trunk/metabuild
A         trunk/metabuild
D         trunk/template.MetaModule
$ svn status
D      trunk/template.MetaModule
A  +   trunk/metabuild
D      trunk/packagelist
svn commit -m "house cleaning, remove packagelist & rename template.MetaModule"

After the first commit, you don't need to specify '—username' any more. Also, you can use the short from '-m' for '—message'.

# -- release using "svn copy"
svn cp trunk tags/release-1.1.0
svn commit -m "- Mark release-1.1.0"
# -- backup the svn repository
rsync -av live-developers.svn.sourceforge.net::svn/live-developers/* /tmp/svn.repo/
# Dump complete subversion-repository to a file:
svnadmin dump /tmp/svn.repo | gzip > /tmp/svn.dump.live-developers.v26.gz
rm -rf /tmp/svn.repo

documented on: 2007-10-02

sf.net repository setup 

Goal 

How to host several projects (related or unrelated) in a single sf.net svn repository?

Solution 

cd /tmp
mkdir tmpsvn
mkdir tmpsvn/{trunk,tags,branches}
cp -p /path/to/template.MetaModule/* tmpsvn/trunk
svn import --username=suntong001 tmpsvn https://live-developers.svn.sourceforge.net/svnroot/live-developers/meta/MetaBuild -m "initial import from Meta Modules 0.1-rc-1"

Note that the project MetaBuild will be under the 'meta' directory in the sf.net "linux-live developers" repository. The 'svn import' will create those directories, you don't need to create them beforehand.

To check, browse to http://live-developers.svn.sourceforge.net/viewvc/live-developers/

It's OK to remove it now:

rm -rf tmpsvn

Help 

sourceforge.net Subversion Access Instructions https://sourceforge.net/docs/E09

documented on: 2007-09-22

Trying History 

Here is what I've tried locally before messing with the sf.net repository:

create the initial repository 

svnadmin create /tmp/svnroot
cd /tmp/svnroot

Subversion typically calls the repository repos. However I'm used to having a cvsroot around so I choose svnroot accordingly.

Once created, the directory structure will look like this:

$ ls -1F
README.txt
conf/
dav/
db/
format
hooks/
locks/

prepare a test project 

cd /tmp
mkdir tmpsvn
mkdir tmpsvn/{trunk,tags,branches}
echo aaa > tmpsvn/trunk/testf

populate the initial repository with existing project 

Now import the above prepared layout tree into the subversion repository:

$ svn import tmpsvn file:///tmp/svnroot/project_a/subproj1 -m "initial import"
Adding         tmpsvn/trunk
Adding         tmpsvn/trunk/testf
Adding         tmpsvn/branches
Adding         tmpsvn/tags
Committed revision 1.

Note that this will import all the content of tmpsvn, and not the top directory itself.

Now it's time to perform a real checkout.

$ mkdir workarea
$ cd workarea
$ svn checkout file:///tmp/svnroot/project_a/subproj1
A    subproj1/trunk
A    subproj1/trunk/testf
A    subproj1/branches
A    subproj1/tags
Checked out revision 1.
$ ls -a1F subproj1
./
../
.svn/
branches/
tags/
trunk/
$ diff /tmp/tmpsvn subproj1
Only in subproj1: .svn
Common subdirectories: /tmp/tmpsvn/branches and subproj1/branches
Common subdirectories: /tmp/tmpsvn/tags and subproj1/tags
Common subdirectories: /tmp/tmpsvn/trunk and subproj1/trunk

We can see that it is safe to trash the tmpsvn now.

subversion status checking 

$ svn list file:///tmp/svnroot/
project_a/
cd subproj1/
$ svn list
branches/
tags/
trunk/
$ svn status

— empty output now, meaning nothing changed

$ svn log
------------------------------------------------------------------------
r1 | tong | 2007-09-22 13:29:55 -0400 (Sat, 22 Sep 2007) | 1 line
initial import
------------------------------------------------------------------------
echo bbb > trunk/testf
$ svn status
M      trunk/testf

— svn reports that the file 'trunk/testf' has changed

$ svn diff trunk/testf
Index: trunk/testf
===================================================================
--- trunk/testf (revision 1)
+++ trunk/testf (working copy)
@@ -1 +1 @@
-aaa
+bbb
$ svn diff
Index: trunk/testf
===================================================================
--- trunk/testf (revision 1)
+++ trunk/testf (working copy)
@@ -1 +1 @@
-aaa
+bbb

commit the changes 

$ svn commit -m "testf changed"
Sending        trunk/testf
Transmitting file data .
Committed revision 2.
$ svn status
$ svn log
------------------------------------------------------------------------
r1 | tong | 2007-09-22 13:29:55 -0400 (Sat, 22 Sep 2007) | 1 line
initial import
------------------------------------------------------------------------
$ svn log trunk
------------------------------------------------------------------------
r1 | tong | 2007-09-22 13:29:55 -0400 (Sat, 22 Sep 2007) | 1 line
initial import
------------------------------------------------------------------------
$ svn log trunk/testf
------------------------------------------------------------------------
r2 | tong | 2007-09-22 14:08:24 -0400 (Sat, 22 Sep 2007) | 1 line
testf changed
------------------------------------------------------------------------
r1 | tong | 2007-09-22 13:29:55 -0400 (Sat, 22 Sep 2007) | 1 line
initial import
------------------------------------------------------------------------

— Strange! How would I know what's the last commit's changes?

Answer: use 'svn update' first, then 'svn log --limit 5'.

documented on: 2007-10-23

Subversion Repository 

http://wiki.archlinux.org/index.php/Subversion_Setup

Create a Repository 

svnadmin create /home/svn/repositories/test

Create a Subversion Project 

http://wiki.archlinux.org/index.php/Subversion_Setup#Create_a_Project

Directory structure for project 

Create the following directory structure on your development machine.

branches tags trunk

You can create them like this.

cd /path/to/directoryofchoice
mkdir branches tags trunk

Populate Directory 

Put your source files into the created trunk directory.

cp -R /home/cactus/project/test/code/* trunk

Import the Project 

svn import -m "Initial import" https://yourdomain.net/svn/test/

Test SVN Checkout 

cd /path/to/directory_of_choice
cd ..
rm -rf /path/to/directory_of_choice
svn co https://yourdomain.net/svn/test/

If everything worked out, you should now have a working, checked out copy of your freshly created SVN repo.

Enjoy!

This page was last modified 03:25, 24 January 2007.

documented on: 2007-09-21

SVN for the CVS dummies 

http://ralf.alfray.com/.izumi/LinuxTips.blog?s=20060904_svn_for_the_cvs_dummies

This is a very highly summarized overview of how to use Subversion for those of us who are used to CVS. Note that none of this is original, it is all extracted from the Subversion Book, available freely online.

So first let's install subversion, that's the easy part:

% apt-get install subversion

That's the only thing needed as root, unless you want the to use webdav or https over Apache, which I don't care for right now. For using subversion over my lan, I used svnserve.

Now, under whatever user is going to use the repository, we need to create the initial repository itself:

$ svnadmin create /home/user/svnroot

Subversion typically calls the repository repos. However I'm used to having a cvsroot around so I choose svnroot accordingly.

To serve this over the lan, we'll use svnserver. There are lots of possible configuration, including inetd and ssh-tunnel based. The basic command-line manual daemon will work just fine, see the link above for other methods:

$ svnserver -d -r /home/user/svnroot

Now that's all we need for administration, we can start fiddling with projects.

First, we need to understand what Subversion is and is not:

The only things in common between Subversion and CVS are that both do version control and they have similar patterns for basic operations, meaning the words import, add, update and commit are used to mean the same concepts (contrast this with Perforce where one performs syncs and submits.) The words branches and tags however do not mean the same thing. Nor is the repository concept the same.

So let's be blunt: if you want something that is exactly like CVS, then just stay with CVS. However a quick overview of Subversion instantly shows that it's worth spending the time to adjust to some of its own paradigms:

If you want to understand what this really means, I urge you to read the basic concepts and the branching and merging chapters of the book.

In contrast to CVS, the repository is a unique directory that contains all projects merged together. This is not like CVS where each project is its own little repository. The layout of projects inside the subversion repository is left to the user. There is a canonical layout advocated by the book and it can help to mimic those (so that others accessing your repository can recognize the layout immediately.)

The layout goes like this:

svnroot/projectA/trunk/file1.cc
svnroot/projectA/trunk/file2.cc
svnroot/projectA/branches/somebranch/...
svnroot/projectA/branches/anotherbranch/...
svnroot/projectA/tags/sometag/...
svnroot/projectB/trunk/...
svnroot/projectB/branches/onemorebranch/...
svnroot/projectB/tags

That is the top-level directories of the repository are the projects, which each contain trunk (main development line), branches (full copies of the trunk for branching) and tags (full copies of the trunk for tagging.) It is important to note that the names used (trunk, branches and tags) are pure convention, the names themselves are not special to subversion — we could use "premium, cheese and pythons" except for the fact the users would be totally lost.

Note than one key difference with CVS here is that all projects are just directories in the same repository and remember that revisions are just snapshots (aka sequence numbers of these snapshots) on the ''full' repository. So committing one file in one project essentially snapshots all projects at once. Although it may sound odd at first, one benefit of this is obvious: if one project is a main software and another one is a a common library used by many other projects, you get automatic synchronization between the main software and all its libraries. This makes it easier to create tags and branches that are consistent, where in CVS you'd have to manually tag or branch each individual project.

Another important difference with CVS is how to deal with branches and tags. Contrary to CVS, subversion doesn't have branches or tags per see at all. All it has is the concept of a repository snapshot at time T and a concept of a shadow copy (a.k.a. copy-on-write) which they call cheap copies in Subversion linguo. So really branches and tags are "full" copies of the repository within itself. So the idea is to have the following convention:

Remember that the "branches" and "tags" directories are pure conventions. So in fact you don't even need to bother creating them until you actually need them. And if you plan to never use branches or tags, there's not even the need to have a "trunk" directory in the first place.

So here's an alternate layout that might work better for me:

svnroot/trunk/projectA/...
svnroot/trunk/projectB/...
svnroot/stable/sometag/projectA/...
svnroot/stable/sometag/projectB/...
svnroot/unstable/...

The thing is that I generally don't need branches. However I use tags to mark releases and I have stable releases vs unstable releases.

So let's try this for my repository:

$ mkdir tmpsvn
$ mkdir tmpsvn/cs
$ cp -r /oldcvs/Project tmpsvn/cs/.
$ svn import tmpsvn file:///home/user/svnroot

Note that this will import all the content of tmpsvn, and not the top directory itself.

Now we can trash the tmpsvn and perform a real checkout. The thing is that whatever is checkout will be made a directory, just like a CVS project. So the following svn checkout will only yield workarea/cs/:

$ mkdir workarea
$ cd workarea
$ svn checkout file:///home/user/svnroot/cs
$ ls -la cs

However there's a problem here: the top-level of the checkout doesn't seem to have a .svn associated with it, so I can't act on it.

Seems like what I want is really to get svnroot:

$ svn checkout file:///home/user/svnroot
$ mv svnroot workarea

Note the URL-like argument above. If we want to use a LAN based svnserve server, we would probably do something like this:

$ svn checkout svn://hostname/path/relative/to/the/svnserve/argument

This gets tedious very fast. Of course once you have a working copy you no longer need the URL thing (i.e. just svn status, svn commit, etc.) But still, I miss my old $CVSROOT:

$ export S=svn://hostname/path
$ svn checkout $S/cs

Now back to my repository, I just realized I wanted the following layout:

svnroot/<language-name>/<project-name>

So in practice I'll have this:

svnroot/python/Rig2
svnroot/csharp/AppSkeleton
svnroot/csharp/DualTimeZone
svnroot/csharp/LibUtils/LibUtils{2,Test...}
svnroot/tags/...

Language name is going to be a full word (shell, python, ruby, csharp, php.) Oops above I started with "cs" instead of csharp. No biggie:

$ cd workarea
$ svn rename cs csharp
$ svn commit -m "Renamed cs to csharp"

And let's create a bunch of language directories since I'll need them:

$ svn mkdir python ruby shell php misc cpp
$ svn commit -m "Language top-level dirs"

However, once I get a bunch of other languages in my repository, I want to be able to only extract a part of it:

$ cd workarea
$ mkdir csharp && cd sharp
$ svn checkout file:///home/user/svnroot/csharp

-> creates a csharp directory here

$ mv csharp svn
$ pwd

-> workarea/csharp/svn

The good part here is that contrary to CVS I can screw up my layout and directory naming scheme and easily fix it. That means I can safely adopt my own repository layout and go back to the traditional trunk/branches/tags later if necessary. The other good part, as seen above, is that you can checkout just a part of an existing bigger repository and not pull everything at once — which incidentally can be used to mimic CVS's per-project repository paradigm.

documented on: 2007-09-22

Subversion 

http://www.linux.org/lessons/advanced/x991.html

Installing Subversion 

Users of Debian and Debian-based distributions (like Ubuntu) just need to issue the following command:

apt-get install subversion subversion-tools

Subversion packages are also included in Red Hat's Fedora Core distribution. If you have the 'yum' package management system installed, you can install subversion by issuing the command:

yum install subversion

There, of course, also exists the possibility of installing from source.

Creating a Repository 

First, I created a directory called 'dev' in /home/mike where I am going to keep the repositories for projects I work on. Essentially, what happens is that you have a directory where you're working and a directory where the repository stores that work for version control purposes. These are, of course, separate.

Let's say you've been offered a project to design a website for a restaurant called Larry's Clam Shack. If you want to use subversion for version control on the project, you need to first create a repository. To do this, issue the following command:

svnadmin create /home/mike/dev/clamshack

Once created, the directory structure will look like this:

drwxr-xr-x  2 mike mike 4096 2005-09-14 17:29 conf
drwxr-xr-x  2 mike mike 4096 2005-09-14 17:29 dav
drwxr-sr-x  2 mike mike 4096 2005-09-14 17:29 db
-r--r--r--  1 mike mike    2 2005-09-14 17:29 format
drwxr-xr-x  2 mike mike 4096 2005-09-14 17:29 hooks
drwxr-xr-x  2 mike mike 4096 2005-09-14 17:29 locks
-rw-r--r--  1 mike mike  379 2005-09-14 17:29 README.txt

According to the developers of, it's a good idea to set up your directory structure for optimum use of subversion. First, create a temporary directory (call it 'tmp' if you want) Then create this directory structure inside of 'tmp':

mkdir larrycs
mkdir larrycs/trunk
mkdir larrycs/branches
mkdir larrycs/tags

Now what we'll do is import this layout tree into the subversion repository 'dev':

svn import . file:///home/mike/dev/clamshack --message 'creating clam shack repository'

You'll see a message like this:

Adding         larrycs
Adding         larrycs/trunk
Adding         larrycs/branches
Adding         larrycs/tags
Committed revision 1.

You can verify that it got created by issuing the command:

svn list --verbose file:///home/mike/dev/clamshack

Feel free to remove 'tmp'. I did, anyway, because I get confused easily. I'm actually going to do my work in a directory which will get me the prize for originality: 'work' Now that you're ready to start using the repository. You need to go to the directory that corresponds to 'work' and "checkout" the repository. Once you're in your work directory, issue the following command:

svn checkout file:///home/mike/dev/clamshack

You should see the following:

A  clamshack/larrycs
A  clamshack/larrycs/trunk
A  clamshack/larrycs/branches
A  clamshack/larrycs/tags
Checked out revision 1.

Working With Subversion 

Now that you've got your work area set up, you are free to add files. If you look inside the directory that the checkout created, you'll find the layout we set up for subversion:

drwxr-xr-x  3 mike mike 4096 2005-09-13 18:51 branches
drwxr-xr-x  3 mike mike 4096 2005-09-13 18:51 tags
drwxr-xr-x  4 mike mike 4096 2005-09-13 18:59 trunk

It's in the 'trunk' directory where we'll be storing out files. For example, I first created a directory to save the documentation for the project then I added it to the repository:

svn add docs/

Then we would commit it to the repository. Doing a 'commit' is like saying: "Yes, I really want this in there".

svn commit -m "docs dir" docs/

In the docs/ directory, I created a file called 'notes' where I will jot down things that I have to remember about the project. After creating the first entry, I added it as well:

svn add notes

And then I committed it:

svn commit -m "notes file" notes

I assume you're getting the idea here.

Note You can leave off the -m "message here" part and your default text editor will pop up and ask you to write the message theright be a better idea to leave it off and use the text editor.

As you're working on your project, and you want to see what changes you've been making, you can issue the following command to see that:

svn log notes

If you're hard at work on your work copy and you want to look at the differences between what you've got and what you started with, you can issue a diff command:

svn diff notes

If you find that you're changes aren't what you really wanted, you can convert (or revert) back to the repository's copy with:

svn revert notes

Advantages to Using Subversion 

Since subversion was meant to be a substitute for CVS, its advantages are essentially fixes of what was lacking in CVS. For example, aborted commit actions in CVS sometimes result in the corruption of the repository. This doesn't happen with subversion. There is also better support for retaining version and history information of files when they are moved or renamed. It has also better built-in binary file support than CVS.

At any rate, whether you use CVS or subversion, there's no debate about the importance of some version control system for a programmer.

Copyright Linux Online Inc. Compilation (c) 1994-2007 Linux Online, Inc.

documented on: 2007-09-22

Installing and configuring a Subversion server 

http://www.linuxformat.co.uk/wiki/index.php/Subversion_-_Setting_up

(Original version written by Graham Morrison for Linux Format magazine issue 68.)

Version control 

Computers are networked together and development projects of hundreds or even thousands of people are actively sustaining themselves. Without online collaboration there would be no Linux.

The magic behind collaborative project development is called version control, and as the name suggests, it's software designed to keep track of every single change or revision. This is more complicated than it sounds. What do you do if there's more than one developer working on the same piece of code? Or if an addition breaks the project in some way? RCS, the original Revision Control System was designed to address many of these problems, and in its turn the Concurrent Versions System (CVS) was designed to plug some RCS holes. Specifically, CVS was intended to handle a whole project rather than separate files.

CVS uses a simple concept. A project's source-tree is stored on the server, known as the repository. Each developer then needs to checkout their own copies of this tree by downloading the source to their local machine, which becomes their working copy. Any changes a developer makes to their working copy need to be committed back to the repository. If more than one developer has altered a piece of code, creating a conflict that CVS cannot resolve, the code needs to be manually edited before the server will allow the commit.

68_tut_svn_02.png-thumb.png (http://www.linuxformat.co.uk/images/wiki/68_tut_svn_02.png)

CVS and SVN share the same development cycle.

  1. Original version of file in repository.

  2. File is checked out by two developers.

  3. Each developer edits a different part of the file.

  4. Both files are committed into the repository, merging both changes.

As you might expect, CVS is built using a client/server model. The server handles the content while the client requests changes to be made to the server's document tree.

CVS is basically a multi-document extension to RCS, and has inherited many of the problems associated with its progenitor, and even managed to add a few of its own. This is where Subversion comes in. Subversion was developed as a direct replacement for CVS, built from the ground up to solve many of CVS's problems. Top of its features list is version control for directories; not just files as with CVS. This makes a massive difference, as Subversion lets you manipulate directories in the same way you can files, moving, renaming, copying and deleting. The other big problem with CVS is also a direct result of its file based structure. It's possible to get half way through a commit and lose the connection. The result is that half the files from a developer may be updated, while the other half aren't, leaving the administrator with no way of knowing which files were updated and which weren't.

The solution, as provided by Subversion, is to make all changes to the repository 'atomic'. This means that all changes are updated as a single transaction, avoiding half updated errors and dual commits. This, along with other essential additions (resource cheap branching and tagging, excellent support for binary formats) makes upgrading to Subversion almost imperative for CVS users at some point in the not-too-distant future.

Setup 

Once installed, the first step to administering a subversion repository is obviously to create the structure and populate it with files. Subversion uses the Berkeley database which restricts installation to a local file system. This is because Berkeley relies on a file system that supports relatively advanced features not currently available over a network equivalent (such as Samba or NFS). Once a suitable location for the repository has been selected, a repository can be created using a command Subversion reserved for dramatic repository changes, called svnadmin.

To create your own repository called subres, execute the following from the directory you wish the repository to reside (I've used /usr/share):

$ svnadmin create subres

Managing a Subversion repository isn't all that different from managing a CVS one but as an administrator, the most important thing to understand is the Subversion file system. This isn't a file system in the same way you think of ext3 or Reiser, but instead, it's the file structure and organisation that SVN expects. The previous command generated this structure under the subres directory, which should now contain a couple of files and several directories.

There are five directories in total; conf, dav, db, hooks and locks. Conf contains a repository's specific configuration file called svnserver.conf. The dav directory contains the system's bookkeeping information, specifically used with the Apache access modules. The aforementioned Berkeley database system uses the db directory for all its files.

Hooks are scripts that can be triggered by a specific repository event. These events include commits, or version changes, and the hook directory contains an example script for each action that SVN implements. The locks directory is used for containing the locking data, responsible for tracking accesses to the repository.