Subversion Setup


Table of Contents

linux-live developers central svn setup 
setup access to the linux-live developers svn repository 
sf.net repository setup 
Trying History 
Subversion Repository 
Create a Repository 
Create a Subversion Project 
SVN for the CVS dummies 
Subversion 
Installing Subversion 
Creating a Repository 
Working With Subversion 
Advantages to Using Subversion 
Installing and configuring a Subversion server 
Version control 
Setup 

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