Difference between revisions of "Subversion"

From Organic Design wiki
(Adding liinks to SVN GUI's)
(Svn on OrganicDesign)
Line 1: Line 1:
[[Category:Projects]][[Category:peerix]]
+
== Svn on OrganicDesign ==
*http://svn.peerix.org/peerix
+
I'd like to make our [[OD/Wikia]] filesystem structure in ''/var/www'' into a Subversion repository so that we can work on the scripts and extensions locally and the check them in when running. Also by regularly updating the local structures we can maintain backups of the structure without having to transfer a large file every week. It doesn't need to be a web-browsable structure, but does need to require authentication for read access because the structure contains passwords.
*http://svn.organicdesign.co.nz/peerix
+
 
 +
The domain ''svn.organicdesign.co.nz'' is pointing at the server, and the necessary packages are installed but there is no repository configured as I'm unsure about how to set up a currently in-use directory structure as a repository.
  
=Overview=
+
== Command Overview ==
 
The typical work cycle looks like this:
 
The typical work cycle looks like this:
  
Line 34: Line 35:
 
  svn commit
 
  svn commit
  
=Usage=
+
== Usage ==
 
The most important command to know is how to get help;
 
The most important command to know is how to get help;
 
  svn help
 
  svn help
Line 122: Line 123:
 
  rm -rf /tmp/SERVER /tmp/CLIENT /tmp/MYTREE
 
  rm -rf /tmp/SERVER /tmp/CLIENT /tmp/MYTREE
  
==SVN GUI's==
+
== SVN GUI's ==
 
  Linux:  [http://www.alwins-world.de/wiki/programs/kdesvn/ kdesvn] (and many others)  
 
  Linux:  [http://www.alwins-world.de/wiki/programs/kdesvn/ kdesvn] (and many others)  
 
  Windows:  [http://tortoisesvn.net/downloads tortoisesvn]
 
  Windows:  [http://tortoisesvn.net/downloads tortoisesvn]
 
  Macos:  [http://www.apple.com/downloads/macosx/development_tools/svnx.html svnx]
 
  Macos:  [http://www.apple.com/downloads/macosx/development_tools/svnx.html svnx]
  
=External Links=
+
== See also ==
 +
*[http://www.howtoforge.com/debian_subversion_websvn Setting up websvn on Debian/Apache]
 
*[http://www.onlamp.com/pub/a/bsd/2005/08/11/FreeBSD_Basics.html?page=1 Secure subversion]
 
*[http://www.onlamp.com/pub/a/bsd/2005/08/11/FreeBSD_Basics.html?page=1 Secure subversion]
 
*[http://www.chiark.greenend.org.uk/~sgtatham/svn.html cvs to svn Experiences]
 
*[http://www.chiark.greenend.org.uk/~sgtatham/svn.html cvs to svn Experiences]
Line 135: Line 137:
 
*[http://svnbook.red-bean.com/nightly/en/index.html Subversion book]
 
*[http://svnbook.red-bean.com/nightly/en/index.html Subversion book]
 
**[http://svnbook.red-bean.com/nightly/en/svn.intro.html Subversion Quick-Start Guide]
 
**[http://svnbook.red-bean.com/nightly/en/svn.intro.html Subversion Quick-Start Guide]
 +
[[Category:Projects]][[Category:peerix]]

Revision as of 08:12, 24 September 2007

Svn on OrganicDesign

I'd like to make our OD/Wikia filesystem structure in /var/www into a Subversion repository so that we can work on the scripts and extensions locally and the check them in when running. Also by regularly updating the local structures we can maintain backups of the structure without having to transfer a large file every week. It doesn't need to be a web-browsable structure, but does need to require authentication for read access because the structure contains passwords.

The domain svn.organicdesign.co.nz is pointing at the server, and the necessary packages are installed but there is no repository configured as I'm unsure about how to set up a currently in-use directory structure as a repository.

Command Overview

The typical work cycle looks like this:

Update your working copy
svn update
Make changes
svn add
svn delete
svn copy
svn move
Examine your changes
svn status
svn diff
Possibly undo some changes
svn revert
Resolve Conflicts (Merge Others' Changes)
svn update
svn resolved
Commit your changes
svn commit

Usage

The most important command to know is how to get help;

svn help
svn help checkout # Help on check(ing)out project to CLIENT copy
svn help commmit  # Help on commit(ting) changes to SERVER

To obtain a log of the changes made in a svn project;

svn log -v http://[PATH TO SERVER SVN PROJECT]

To create a new repository on the server ready for importing a directory of files;

cd /tmp
mkdir SERVER
svnadmin create /tmp/SERVER/newrepos

This creates a concise database directory for the new repository on the SERVER in the directory called /tmp/SERVER;

ls -l /tmp/SERVER/newrepos
total 16
-rw-r--r--    1 User  wheel  379 Apr  3 13:58 README.txt
drwxr-xr-x    4 User  wheel  136 Apr  3 13:58 conf
drwxr-xr-x    2 User  wheel   68 Apr  3 13:58 dav
drwxr-xr-x   10 User  wheel  340 Apr  3 13:58 db
-r--r--r--    1 User  wheel    2 Apr  3 13:58 format
drwxr-xr-x   11 User  wheel  374 Apr  3 13:58 hooks
drwxr-xr-x    4 User  wheel  136 Apr  3 13:58 locks

Create an example directory for upload;

cd /tmp
mkdir MYTREE
echo '#!/usr/bin/perl -w\nprint "hello world";' > /tmp/MYTREE/helloWorld.pl
svn import /tmp/MYTREE file:///tmp/SERVER/newrepos/some/project

Listing the contents in the repository directory path;

svn list file:///tmp/SERVER/newrepos/some/project

To make a local copy you need to use the checkout command. This creates a new directory (default called newrepos) which is a local copy of newrepos.

mkdir CLIENT
cd CLIENT
svn co file:///tmp/SERVER/newrepos/some/project/  # fetches project/test.pl
svn co file:///tmp/SERVER/newrepos/some/          # fetches some/project/test.pl
rm -rf /tmp/CLIENT  
svn co file:///tmp/SERVER/newrepos/some/project/ /tmp/CLIENT # Creates CLIENT dir

Note: The directory the svn command is run in determines where the local checkout directories and files will end up.

Now that you have created a local copy all work should be conducted within it. There is a hidden directory called .svn which contains all the information required for the svn framework;

cd /tmp/CLIENT # Work in the local copy of svn

To update a file on your CLIENT directory;

cd /tmp/CLIENT
svn update # "." is updated 
cd /tmp
svn update /tmp/CLIENT # Specifying path

To add a new file to the local svn copy, first make a new file within the directory structure;

cd /tmp/CLIENT
echo '#!/usr/bin/perl -w\nprint qq(hello world!);' > /tmp/CLIENT/helloWorld2.pl
svn add helloWorld2.pl

The status command will identify differences between the CLIENT copy and the SERVER copy of the repoistory;

svn status /tmp/CLIENT

The following list provides the details of svn status output;

 L    abc.c               # svn has a lock in its .svn directory for abc.c
M      bar.c               # the content in bar.c has local modifications
 M     baz.c               # baz.c has property but no content modifications
X      3rd_party           # this dir is part of an externals definition
?      foo.o               # svn doesn't manage foo.o
!      some_dir            # svn manages this, but it's either missing or incomplete
~      qux                 # versioned as file/dir/link, but type has changed
I      .screenrc           # svn doesn't manage this, and is configured to ignore it
A  +   moved_dir           # added with history of where it came from
M  +   moved_dir/README    # added with history and has local modifications
D      stuff/fish.c        # this file is scheduled for deletion
A      stuff/loot/bloo.h   # this file is scheduled for addition
C      stuff/loot/lump.c   # this file has conflicts from an update
R      xyz.c               # this file is scheduled for replacement
    S  stuff/squawk        # this file or dir has been switched to a branch
 

To upload the CLIENT copy changes to the SERVER copy use the commit command;

svn commit /tmp/CLIENT
 

Cleaning up directories in /tmp;

rm -rf /tmp/SERVER /tmp/CLIENT /tmp/MYTREE

SVN GUI's

Linux:  kdesvn (and many others) 
Windows:  tortoisesvn
Macos:  svnx

See also