Difference between revisions of "SVN Page"

From CUC3
Jump to navigation Jump to search
import>Am592
import>Am592
Line 24: Line 24:
   
 
(3) I found it convenient to define an environment variable pointing to my SVN directory on the WWMM server:
 
(3) I found it convenient to define an environment variable pointing to my SVN directory on the WWMM server:
  +
<pre>
 
''SVN=https://wwmm.ch.cam.ac.uk/svn/users/am592''
+
SVN=https://wwmm.ch.cam.ac.uk/svn/users/am592
 
export SVN
 
  +
</pre>
''export SVN''
 
 
 
You could just add those lines to your ''.bashrc'' file.
 
You could just add those lines to your ''.bashrc'' file.
   
Line 37: Line 36:
 
== Creating a Project ==
 
== Creating a Project ==
 
There seem to be a couple of ways of doing this. The method reccommended by the SVN book (Version Control with Subversion - O'Reilly) is to use ''svnadmin create''. This won't work as none of us users have access to the ''svnadmin'' command. The following works quite well:
 
There seem to be a couple of ways of doing this. The method reccommended by the SVN book (Version Control with Subversion - O'Reilly) is to use ''svnadmin create''. This won't work as none of us users have access to the ''svnadmin'' command. The following works quite well:
  +
<pre>
 
''$ svn mkdir $SVN/project1''
+
$ svn mkdir $SVN/project1
  +
</pre>
   
 
This will create directory ''project1'' in the repository. The ''svn mkdir'' command can also be used to make a directory in your working copy, but more on this later.
 
This will create directory ''project1'' in the repository. The ''svn mkdir'' command can also be used to make a directory in your working copy, but more on this later.
   
 
Now your project has its own directory on the SVN server. Let's get the files into it.
 
Now your project has its own directory on the SVN server. Let's get the files into it.
  +
<pre>
 
''$ ls my_code''
+
$ ls my_code
 
a.f90 b.f90
 
 
$ svn import my_code $SVN/project1
''a.f90 b.f90''
 
 
Adding my_code/a.f90
 
 
Adding my_code/b.f90
''$ svn import my_code $SVN/project1''
 
 
Committed revision 1.
 
  +
</pre>
''Adding my_code/a.f90''
 
 
''Adding my_code/b.f90''
 
 
''Committed revision 1.''
 
 
 
That's done. Notice that the project is called ''my_code'' in my directory but ''project1'' on the server. The names could be the same.</pre>
 
That's done. Notice that the project is called ''my_code'' in my directory but ''project1'' on the server. The names could be the same.</pre>

Revision as of 10:31, 27 October 2006

Catherine suggested that we put all the bits and pieces we learn about SVN in one place. A jolly good idea as I do tend to forget about things!


As a CVS user, migrating to SVN was not without it's hiccoughs. Let's begin with some technical details:

Setting up your SVN details

(1) If you've got an account on the SVN server at WWMM, you should have a certificate file need by SVN to authenticate a session. Let's call this file svn_cert.p12. Place it in a convenient place, say, $HOME/certificates/

(2) Now edit the file $HOME/.subversion/servers It should contain the lines:

[groups]
wwmm = wwmm.ch.cam.ac.uk
                                                                                
[wwmm]
ssl-client-cert-file = $HOME/certificates/svn_cert.p12
ssl-client-cert-password = <the password Catherine gave you>

I'm not sure if you have to put your password there, but if you do, SVN won't prompt you for a password each time you try to use it.

(3) I found it convenient to define an environment variable pointing to my SVN directory on the WWMM server:

SVN=https://wwmm.ch.cam.ac.uk/svn/users/am592
export SVN

You could just add those lines to your .bashrc file.

Now you are set.


Creating a Project

There seem to be a couple of ways of doing this. The method reccommended by the SVN book (Version Control with Subversion - O'Reilly) is to use svnadmin create. This won't work as none of us users have access to the svnadmin command. The following works quite well:

$ svn mkdir $SVN/project1

This will create directory project1 in the repository. The svn mkdir command can also be used to make a directory in your working copy, but more on this later.

Now your project has its own directory on the SVN server. Let's get the files into it.

$ ls my_code
a.f90  b.f90
$ svn import my_code $SVN/project1
Adding     my_code/a.f90
Adding     my_code/b.f90
Committed revision 1.

That's done. Notice that the project is called my_code in my directory but project1 on the server. The names could be the same.