How to work with the dCache internal SVN system
1. Creating an ssh key
If you don't have an ssh public key, generate one with the ssh-keygen command. For example:
ssh-keygen
or
ssh-keygen -t rsa -b 1024
You SHOULD give a non-blank, good pass-phrase when prompted for one.
By default, you will create two files in ~/.ssh. The file ending .pub is your ssh public key: you can send that to anyone. The one that does not end .pub is private, send that to noone.
2. Get access
Send your ssh public key and your preferred account name to support@…, requesting to be added or updated. We will only do this after your identity has been verified please also include like full telephone number, who you are, why you want access and when we can speak to you including your time zone.
3. Prepare your local environment
If your SVN account name is different from your local username, you can store the difference within your SSH configuration file ~/.ssh/config. The following is an example:
Host svn.dcache.org User pmillar
If you have kerberos installed on your node, for some reason this interfears with the use of protocol 2. This has effected DESY and FERMI users, to resolve this, you must add the additional value to the configuration file.
Protocol 2
This should prevent you getting log in failures with just the password.
And example ~/.ssh/config is shown here.
Host svn.dcache.org Protocol 2
then check out as
[root@ford oms]# svn co svn+ssh://omsynge@svn.dcache.org/store/tools/trunk A trunk/dcacheUpgrade A trunk/dcacheUpgrade/dcacheUpgrade_1_6-1_7 A trunk/dcacheUpgrade/dcacheUpgrade_1_6-1_7/glite-dcache-upgrade.spec A trunk/dcacheUpgrade/dcacheUpgrade_1_6-1_7/src A trunk/dcacheUpgrade/dcacheUpgrade_1_6-1_7/src/dCacheUpgrade_1_6-1_7.sh ...
Not this allows you to work as multiple users sharing an account.
4. Configure an ssh-agent
The ssh-agent is a daemon process that stores your authentication credentials (you public/private key-pairs). When ssh attempt to log into a remote site, it will try all the identities within the ssh-agent. Since these are stored unlocked, this allows you to log in without having to type in your pass-phrase.
Starting ssh-agent
All modern GNU/Linux distributes now start an ssh-agent for your X session. You can test this by typing the following command; if it returns a blank line then you are not running an ssh-agent.
echo $SSH_AUTH_SOCK
If you do not have ssh-agent running, you can start it with the following command:
eval `ssh-agent`
This will also create the necessary SSH_AUTH_SOCK environment variable, but only for your current shell (and it's children). To allow ssh-agent access elsewhere, simply copy the value of $SSH_AUTH_SOCK to that shell. For bash shell, the following command achieves this:
export SSH_AUTH_SOCK=/tmp/....
When you are finished, you should kill the ssh-agent using the following command:
eval `ssh-agent -k`
Uploading a key into ssh-agent
You should add you ssh key to an ssh-agent when using subversion. This allowing SVN interaction without having to type your pass-phrase.
You can see a list of all currently stored keys using the following command:
ssh-add -l
To add your key to the ssh-agent use the ssh-add command. When run without any arguments, it will add all keys with standard names. You can add specific ssh key by specifying the path as an argument to ssh-add.
ssh-add $PATH_TO_YOUR_PRIVATE_KEY
SSH-agent command wrapping
Sometimes you might want to interact with subversion without loading your SSH key into an SSH agent. This might be because you don't trust the computer's security, or that you prefer to keep the manual step of typing the pass-phrase (giving you a chance to realise the mistake you're about to check into SVN).
If this is so, you might like to type the pass-phrase in, but only once. For certain operations (such as svn diff), the subversion client will contact the server multiple times. Typing in the pass-phrase for each connection can become tiresome.
One potential solution is to start a ssh-agent for this one command, then kill it after the command has complete. The saw script provides a simple wrapper around any command. Simply prepend saw to the command.
Installing SVN
SVN client is available on SL3 from CERN but not SL3 from Fermi since we in the dCache development team use SL3 Fermi, if you are using SL3 you may need to add the following file.
#cat /etc/apt/sources.list.d/cern.list rpm http://linuxsoft.cern.ch dag/redhat/el3/en/i386 dag
If you are using SL3 please type
apt-get install subversion
for SL4 please type
yum install subversion
5.0 Browsing SVN with a web browser
The dCache SVN is viewable of a web interface.
5.1 Checking code out of subversion
The following locations are defined for subversion:
Command-line
The following will create a directory dCache and check-out every branch, including the Trunk, underneath that directory. This may not be what you want. where USERNAME is set to your user name on the SVN server.
svn co svn+ssh://${USERNAME}@svn.dcache.org/data/svn/dCache
The following command will create the dCache-trunk directory. It will check-out just the dCache trunk, storing it within the directory.
svn co svn+ssh://svn.dcache.org/data/svn/dCache/trunk dCache-trunk
5.2 Checking code out of subversion as an anonymous user
The following locations are defined for read-only subversion access
| dCache | http://svn.dcache.org/dCache |
| PNFS | http://svn.dcache.org/pnfs |
| dCacheBook | http://svn.dcache.org/Book |
| Chimera | http://svn.dcache.org/Chimera |
| Chimera ACLs | http://svn.dcache.org/Chimera-acl |
| dCap (trunk) | http://svn.dcache.org/dCache/trunk/modules/dcap |
| dCache tools | http://svn.dcache.org/dcache-tools |
| tsmcp | http://svn.dcache.org/tsmcp |
tsmcp is a store/retrieve utility for Tivoli Storage Manager
NB You will want to add /trunk to most of these URLs to get only the trunk version.
A comparison table between CVS- and SVN-commands.
| CVS command | SVN command | Example |
| cvs -d <repository> checkout | svn <repository> checkout <local dir name> | svn co svn+ssh://svn.dcache.org/store/dCache/trunk dCache-Build # otherwise checked out directory will be called trunk |
| cvs ci | svn ci | svn ci |
| cvs co | svn <tag repository > co | svn co svn+ssh://svn.dcache.org/store/dCache/tags/production-A-B-C |
| cvs co -r <rev> | svn co -r <rev> | svn co -r <rev> |
| cvs co -r <tag> | svn co | svn co |
| cvs rm | svn rm | svn rm BadClass.java |
| cvs tag | svn copy | svn copy svn+ssh://svn.dcache.org/store/dCache/trunk svn+ssh://svn.dcache.org/store/dCache/tags/production-A-B-C |
| cvs tag -B | svn copy | svn copy svn+ssh://svn.dcache.org/store/dCache/trunk svn+ssh://svn.dcache.org/store/dCache/branches/newCode |
| cvs tag -B | svn mkdir svn copy | svn mkdir svn+ssh://svn.dcache.org/store/dCache/branches/mine svn copy svn+ssh://svn.dcache.org/store/dCache/trunk svn+ssh://svn.dcache.org/store/dCache/branches/mine/newCode |
| cvs tag -d <tag> | svn delete | svn delete svn+ssh://svn.dcache.org/store/dCache/branckhes/MyNoSoCoolBranch |
| cvs diff | svn diff | svn diff |
| - | svn mv | svn mv BadClassName.java GoodClassName.java |
| rm WorkingClass.java; cvs update WorkingClass.java # revert changes | svn revert | svn revert WorkingClass.java |
Merge
svn merge svn+ssh://svn.dcache.org/store/dCache/tags/production-1-8-0-5/modules/dCache/diskCacheV111/namespace
svn+ssh://svn.dcache.org/store/dCache/tags/production-1-8-0-3//modules/dCache/diskCacheV111/namespace
Merge into current workspace
svn merge -c 8913 svn+ssh://svn.dcache.org/data/svn/dCache/trunk/modules/srm/src/org/dcache/srm modules/srm/src/org/dcache/srm
Diff between two tags
svn diff svn+ssh://svn.dcache.org/store/dCache/tags/b15-official-CCRC08-release-p3/modules/dCache/diskCacheV111/services/space svn+ssh://svn.dcache.org/store/dCache/tags/production-1-8-0-14/modules/dCache/diskCacheV111/services/space
Find the changed files between two revisions
svn diff --summarize -x -w -r N:M
Find commits in single branch only
svn log --stop-on-copy svn+ssh://svn.dcache.org/home/svn/store/Chimera/branches/Connectathon08/
Update Status
A Added
D Deleted
U Updated
C Conflicted
G Merged
A character in the first column signifies an update to the actual file, while updates to the file's properties are shown in the second column.
NetBeans
There is a plugin for NetBeans-5. Support for SVN is integrated into NetBeans-6.
Eclipse
There are two plugins to Eclipse that allow you to work with Subversion repositories: subversive and subclipse.
Both plugins use underlying Java SVN backends to do the actual work. There are two widely used backends: JavaHL and SVNKit.
With both plugins, SVNKit is the preferred option as it is pure Java whereas JavaHL uses native code via JNI to run. However, SVNKit does not support ssh-agents. To use keys stored in your ssh-agent within Eclipse, you must switch to JavaHL backend.
Both plugins are configured through the same method. Select Windows from the main menu, then select Preferences... This will open the preferences dialogue box. Open the Team part of the tree and select SVN. The right pane should show a configuration where you can select the SVN backend: either JavaHL or SVNKit.
Bear in mind that in order to use the JavaHL SVN-backend, you must install the corresponding JNI native library and configure Eclipse so its JVM has a java.library.path that includes the path to the JavaHL library.
Under Debian (and derivatives), the JNI library is packaged as libsvn-java (formally libsvn-javahl).
It is possible to configure eclipse to use a particular path by editing the file eclipse.ini, which is located in the root of distribution, adding a line like:
-Djava.library.path=/usr/lib/jni
after the -vmargs line.
Further information
- The subversion book.
- Last Modified : August 28,2007 by Owen
- Last Modified : April 24,2007 by Patrick
- Last Modified : November 8,2007 by Paul
- Last Modified : June 06,2008 by Owen
