Subversion with Eclipse


Subversion on RH5 with Eclipse for svn+ssh

On the subversion server do the following steps.

 
Add new file in /etc/profile.d named svn.sh containing:
# svn initialization for svn+ssh
PATH="/svn/scripts:${PATH}"
Install CollabNet_Subversion version 1.1.4 (r13838) to /svn/CollabNet_Subversion
 
Add files to /svn/scripts as follows

filename:  svnserve

#!/bin/bash
SVN_HOME="/svn/CollabNet_Subversion"

#
# The SVN Repository can be anywhere you want.
# The file permissions need to be (group rw)
# Then everything runs as the user.
#
SVNRepository="/svn/repositories"

whoiam=$(/usr/bin/id --user --name)

export LD_LIBRARY_PATH=${SVN_HOME}/lib:${LD_LIBRARY_PATH}
${SVN_HOME}/bin/svnserve -t --tunnel-user=$whoiam -r ${SVNRepository}

 

filename: snvserve-sudo

 

#!/bin/bash
SVN_HOME="/svn/CollabNet_Subversion"

#
# The SVN Repository can be anywhere you want.
# The file permissions need to be (group rw)
# Then everything runs as the user.
#
SVNRepository="/svn/repositories"

whoiam=$(/usr/bin/id --user --name)
if "$whoiam" != "svnadmin"
then
#echo $whoiami
sudo -u svnadmin /svn/scripts/svnserve -t --tunnel-user=$whoiam -r ${SVNRepository}
else
#echo $whoiam
export LD_LIBRARY_PATH=${SVN_HOME}/lib:${LD_LIBRARY_PATH}
${SVN_HOME}/bin/svnserve $@
fi
 
On Development workstation:
See the link below to install the Collab plug-in for Eclipse
http://www.open.collab.net/downloads/desktops/installing_cdee.html?_=d
 

To Convert to SVN

1) Copy your workspace and delete old cvs projects: 
2) Startup eclipse selecting the new project.


3) Setup SVN SSH client
Select Window => Preferences =>Team => SVN
See the SVN Interface  drop-down labeled Client:
Select SVNKit not JavaHL

4) Set up the SVN repository
Select Window => Show Views =>  Others => SVN => SVN Repositories
Right Click in the SVN Repository window
Select New => Repository Location
Set the URL to:  svn+ssh://svnserverurl/project
Click on Finish

You should be prompted for you SSH Credentials:
Use you windows login and windows password. 
You should be prompted for you SVN Author Name.
Use your login name and select Save Author Name
Click on Finish

5) Check out the projects
Now go to the Navigator or Packaged Explore and check out SVN projects just like you would for CVS
but select “Import => SVN => Checkout Projects from SVN”
Select the repository you just created.
Now you should see the SVN Repository tree.

Expand the branches
Go into the branch you want,
Select the project you want.
Click on Next
Select Check out as project in the workspace
Click Finish.

6) Repeat for the any other projects you may want.

7) Now you should be able to, update, check-in, etc using the Team menu. Just as you would if you were using CVS
 

Changing SVN Password

We used svn+ssh (SVNKit) to access the Subversion repository. 
Changing your SVNKit password is a bit of a pain. Here is the process.

If you have not done so, edit the eclipse short cut you use to start eclipse.
Add a –keyring option so that your target looks like
C:\ecplise\eclipse.exe –keyring C:\dev\eclipse.keyring

If the keyring file C:\dev\eclipse.keyring  exists then delete it.
The next time you access Subversion you will be prompted for you password.

If you want to change your password again just delete the keyring file.

SVN - CollabNet Plugin

Overview

The CollabNet plugin for Eclipse is a great help for doing merges in an SVN repository.  It is recommended to install this plugin if you intend to do any merges.


Install Steps

The following steps can be found at: http://www.collab.net/downloads/desktops/installing_cdee.html?_=d 

 

  1. In Eclipse, select 'Help' -> 'Software Updates'
  2. Select 'Available Software' and click 'Add Site'
  3. Enter the following location: http://downloads.open.collab.net/eclipse/update-site/e3.4
  4. Click 'OK'
    1. Find the site you entered in the list (be sure it's for version 3.4) and check the box next to it.
    2. Find the http://subclipse.tigris.org/update_1.4.x site and select the check box next to it.
  5. Click 'Install'.
  6. Click 'Finish'.  It will say you have the latest versions but it will still do an install that you need.
  7. Select 'Unknown Unknown Unknown' certificates and click 'OK'.
  8. When asked to restart Eclipse, click 'Yes'.
  9. When Eclipse starts close the 'CollabNet' window.
  10. Select 'Window->Preferences'
  11. Navigate to 'Team' -> 'SVN' and change the 'SVN' interface to 'SVNKit (Pure Java) SVNKit v. 1.2.1.5297'.
  12. Click 'OK'.
 
 

SVN Notes

More Information about Subversion

 

SVN Merges & the Eclipse Plugin
The standard Eclipse distribution has a SVN plug-in (subclipse) that works fine for normal development work.
However we recommend that you upgrade to the CollabNet plug-in for doing merges.
The ColabNet plug-in has enhanced features for support the Subversion 1.5 merge features.

The ColabNet plug-in and the  subclipse plug-in are compatible (both actually come from ColabNet)

Head verses Trunk

In CVS the main branch is call HEAD. In Subversion the main branch is called trunk

To add to the confusion, SVN has Revisions.  These are like CVS revisions but rather instead of dot notations
they are just simple numbers.  The latest revision in SVN is called HEAD.

So to get the latest version from the main branch you should check out  the HEAD revision of the trunk.
But you could also the latest version of the a branch by checking out the HEAD revision.

The Anthill builds include a user editable property calls Revision. The default revision is HEAD. Generally you should never
have to worry about it. Just use  the default.

1 comment:

Ray said...

Hi,

Great post!
Very clear with some useful info (especially how to reset password which is not a trivial issue at all!)

Thanks.

Gal.