r21 - 24 May 2007 - 02:14:57 - VinubalajiGopalYou are here: OSAF >  Projects Web  >  ChandlerHome > DeveloperDocumentation > GettingChandler > SubversionGuidelines

Basics

The best source of Subversion info is from the online documentation and from the online book:

  • http://subversion.tigris.org/
  • http://svnbook.red-bean.com/

If you're using a command-line client:

  svn help

will list all the available commands. Command-specific help is available, too, e.g.

  svn help checkout

will give you information and usage for the checkout command.

Some SVN Clients

  • svn : svn command line client for OS X
  • svnX : GUI client for OS X (wrapper on top of svn command line here above so you also need svn if you want to use svnX...)
  • TortoiseSVN : GUI client, implemented as a windows shell extension
  • SmartSVN : Java-based GUI client for all platforms
  • Subclipse : An Eclipse plugin.

Here is a sample config file for your Subversion client. On linux and OS X this would go in ~/.subversion/config

  • config: Subversion config file

OSAF Repositories

Read-only Access

To browse the OSAF repositories use our WebSVN? service:

  • http://websvn.osafoundation.org

For anonymous svn checkouts, use the following URLs:

  • http://svn.osafoundation.org/chandler
  • http://svn.osafoundation.org/server
  • http://svn.osafoundation.org/docs

Example:

      svn checkout http://svn.osafoundation.org/chandler/trunk chandler

will check out the latest Chandler sources into the directory

chandler
. (See the next section for the meaning of the
trunk
in the URL here).

Read-write Access

To be able to commit changes, you will need ssh access, and can find our projects at:

  • svn+ssh://svn.osafoundation.org/svn/chandler
  • svn+ssh://svn.osafoundation.org/svn/server
  • svn+ssh://svn.osafoundation.org/svn/docs

Example:

      svn checkout svn+ssh://svn.osafoundation.org/svn/docs/trunk docs

will check out the latest revision of our documentation repository into

docs
.

Repository layout

Each repository has the following base directories:

  branches/
  tags/
  trunk/

The

trunk
directory is where the most recent activity is found;
branches
will contain a directory for each branch that has been defined and
tags
will contain a directory for each defined tag. The thing to remember in SVN is that a file has a reference (symlink if you like) in branches and tags until you commit a change so they take up no extra room in the repository.

NOTE: Never checkout a full SVN repository - you will download the entire repository - all branches and tags. Instead you should always specify a path within the repository, for example:

  svn co svn+ssh://svn.osafoundation.org/svn/chandler/trunk chandler

To get a specific branch, do this:

  svn co svn+ssh://svn.osafoundation.org/svn/chandler/branches/CHANDLER_0_5_MILESTONE 0_5_milestone

To find out what branch or tag is available, use the ls command:

  svn ls svn+ssh://svn.osafoundation.org/svn/chandler/branches
  svn ls svn+ssh://svn.osafoundation.org/svn/chandler/tags

What changes do I have pending?

The status or diff command will give all local files that have been added, deleted and/or modified. It will not show you any file in your working directory that has been added to the Ignore property. Note that a network connection is not required for these commands.

  svn status
  svn diff

Also

  svn diff --revision HEAD

will show the changes between your working directory and the most recent revision in the repository (where "most recent" means "most recent on the checked-out branch or tag").

Moving files

Unlike CVS, SVN allows you to move and rename files and directories:

  svn mv file1 file2

NOTE: Please check with MikeT before moving files or directories: Changes in the directory layout has to be coordinated with the various build scripts.

Copying and Splitting files

If you need to create a copy of a file or wish to create a new file that is based on another, use the cp command. This will allow the properties to transfer in svn:

  svn cp old file1
  svn cp old file2
  svn delete old
  <edit file1 and file2>
  svn commit

Command Examples

Result SVN Command CVS Command
Check out tree svn co repos/module cvs co repos module
Check out directory svn co -N repos/module/dir cvs co -l dir
Check in all changes svn ci -m "message" cvs ci -m "message"
Check in file(s) svn ci -m "message" file1 ... cvs ci -m "message" file1 ...
Switch to a branch cd dir/subdir; svn switch repos/branches/branchname/dir/subdir cd dir/subdir; cvs up -r branchname
Switch to HEAD cd dir/subdir; svn switch repos/trunk/dir/subdir cd dir/subdir; cvs up -A
Check for changes svn status (local and not destructive) cvs up (non-local and destructive)
Clear conflict status svn resolved file1 n/a
Remove local changes svn revert cvs -U
Check out a branch svn co repos/branches/branchname cvs co repos/module -r branchname

Generating a SSH key

To commit to SVN you need to have a SSH key. If you do not already have one, you can generate one using the following command:

  ssh-keygen -t rsa -b 2048

After generating your key, you then need to send bear (aka Mike Taylor) your public key (it's named id_rsa.pub)

SVN Sandbox

Use the following commands to get started with the svn sandbox:

  svn co svn+ssh://svn.osafoundation.org/svn/sandbox/user-name
  cd user-name
  svn export project-url project-name
  svn add project-name    
  svn commit -m 'my initial import'

user-name will be the user name you requested for the svn sandbox.

If using PuTTY? with TortoiseSVN?, do not choose putty.exe as your SSH client. Leave that field blank. Instead, use the name of the PuTTY? saved session as the name of the server. For example, "MyConnection" instead of "svn.osafoundation.org".

Building Subversion 1.4 from source

    sudo apt-get remove libsvn0
    sudo apt-get remove subversion
    sudo apt-get install libneon25 libneon25-dev
    sudo apt-get install libapr1.0-dev
    sudo apt-get install libaprutil1.0-dev
    sudo apt-get install libdb4.2-dev
    sudo apt-get install libdb4.2
    sudo apt-get install libsqlite3-0
    sudo apt-get install libsqlite3-dev
    sudo apt-get install libldap-dev
    sudo apt-get install libpq-dev
    sudo apt-get install libexpat1-dev
    wget http://subversion.tigris.org/downloads/subversion-1.4.3.tar.bz2
    tar vxf subversion-1.4.3.tar.bz2
    cd subversion-1.4.3
    ./configure --with-ssl
    make
    sudo make install

Questions

Using Subversion in a Distributed Fashion

Question

I would like to work on an open source project which uses a SVN repository at their site, but I would also like to keep my own local repository so that, among other things, I can commit and rollback changes as necessary until I've got something that is worth committing to the project's SVN or in case I don't have a commit access to the project, I can just create a patch from my local revisions and submit it to the project.

Answer

This and many other complex operations are possible using a distributed version control system. There has been a proliferation of distributed versioning tools and some of this tools allow you to use Subversion as the backend. Git, Mercurial, Bazaar, SVK, Darcs are the most popular distributed version tools and have support for SVN backend in some way.

SVK Distributed version control tool
SVK is one of the distributed program which allows to work with multiple branches locally and remotely. It is written in PERL. Though this tool works for normal operations, it fails to update to the latest in trunk if the changes in code involve deletion and too much reorganization. Recently I had some problems since the code had too much reorganization, but still svk is nicely written on top of subversion and provides all the robustness and reliability of Subversion.

Details about SVK usage can be found at Vinu's notes or Jared's notes or Grant's notes and the links at the bottom of those journal entries.

Git
GitUsage talks about Git and about the git-svn program, which allows bi-directional flow between git branches and SVN repositories. Git is a really powerful tool and is fast.

Darcs
Although this (InteroperabilityWithCvs) is written for darcs, it does address the kind of things I want to do. (I haven't fully absorbed it yet, but I think it will get me started. (And maybe I'll consider installing darcs.))-- RandyKramer - 24 Mar 2007

  • config: sample subversion config file
toggleopenShow attachmentstogglecloseHide attachments
Topic attachments
I Attachment Action Size Date Who Comment
elseEXT config manage 2.4 K 22 Mar 2007 - 16:20 MikeT sample subversion config file
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r21 < r20 < r19 < r18 < r17 | More topic actions
 
Open Source Applications Foundation
Except where otherwise noted, this site and its content are licensed by OSAF under an Creative Commons License, Attribution Only 3.0.
See list of page contributors for attributions.