Difference between revisions of "Subversion server"

From SourceWiki
Jump to navigation Jump to search
 
(34 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
[[Category:Version Control]]
 
[[Category:Version Control]]
  
The source server can be used to host your subversion reporitories.
+
=Introduction=
Contact JP Renaud or Gethin Williams...
+
 
 +
''Source'' can be used to host your subversion repositories. It uses the WebDAV protocol and is therefore '''available from a webbrowser anywhere in the world''' which is great for collaboration with people outside the department. However, we still keep a fine control of who can access the repositories and your repositories are '''not open to the world by default'''.
 +
 
 +
=Important: backup policy=
 +
 
 +
The hard drive on ''Source'' is backed up once a day incrementally and a full backup is performed every week using the department backup system. Additionally, we backup the repositories separately if activity has been noticed.
 +
 
 +
'''However, we cannot guarantee that a problem will not occur at some point.''' You are encouraged to use ''Source'' for your day to day work but please, keep important versions of your software backed up somewhere else too, just in case :-)
 +
 
 +
= Creating a repository =
 +
==First step==
 +
First contact an [[Help:Administrators|administrator]] to get a subversion account. They will create an empty repository for you and email you with login information.
 +
 
 +
For the sake of explanation, let's call your project ''myproject'' and the login you have been given ''mylogin''. You will also be given a password, just type it whenever the software asks you to.
 +
 
 +
The repository will be accessible from a web browser at the URL https://svn.ggy.bris.ac.uk/subversion/myproject/
 +
 
 +
==Adding extra users==
 +
If you collaborate with other developpers, you will need to ask for accounts for them too. At this stage, it's probably best to speak directly to the [[Help:Administrators|administrators]]. They will need to know the name and the institution of each new user. If you want to control access to specific parts of your project, i.e. some people can access some sections but not all, you will have to let them know too.
 +
 
 +
=Using the command line client=
 +
 
 +
==The ''svn'' command line client==
 +
The subversion command line client is called ''svn'' on Linux/Unix systems. It is available from most machines within the department. To check that you can use it, just type:
 +
 
 +
<pre>
 +
svn --version
 +
</pre>
 +
 
 +
If it is not available (the above command returns an error) and you don't have administrator rights on your machine, contact a [mailto:ggy-comp@bristol.ac.uk Computer Officer] to have subversion installed on your machine.
 +
 
 +
==Importating data in your repository==
 +
If the data that you want to import into the repository is in the folder ''mylocalfolder'', you need to send the data inside this folder to the subversion repository. We recommend that you import your data into the ''trunk'' section of the repository. Using a ''trunk'' will allow you to ''branch'' and ''tag'' later on in your development. Read the [[:Category:Subversion|Subversion pages]] for detailed information about this. The following instructions will import the whole content of ''mylocalfolder'' into the subversion repository:
 +
 
 +
<pre>
 +
cd mylocalfolder
 +
svn import . https://svn.ggy.bris.ac.uk/subversion/myproject/trunk --username mylogin -m "Initial import."
 +
</pre>
 +
 
 +
This will import the content of ''mylocalfolder'' into ''trunk'' in the repository and will use "Initial import" as the log message.
 +
 
 +
==Checking out a working copy==
 +
 
 +
To start working with Subversion, you first need to ''checkout'' your repository into a ''workingcopy'':
 +
 
 +
<pre>
 +
svn checkout https://svn.ggy.bris.ac.uk/subversion/myproject/trunk --username mylogin workingcopy
 +
</pre>
 +
 
 +
Now you can go into ''workingcopy'' and check that all is here:
 +
 
 +
<pre>
 +
cd workingcopy
 +
ls -a
 +
</pre>
 +
 
 +
If everything worked, you can now delete ''localfolder''. Note that in ''workingcopy'' and all its subfolders, you will find '.svn/' folders. They are used to track the changes you make to the working copy. You should never edit or delete these folders.
 +
 
 +
==Day to day work==
 +
 
 +
Now that your repository is setup and you have a working copy, read the [[Subversion day to day]] pages to understand how to use the repository for your daily work.
 +
 
 +
=Using TortoiseSVN on Windows=
 +
 
 +
==The TortoiseSVN shell extension==
 +
 
 +
[[Image:Tortoise1.JPG|frame|right|TortoiseSVN is available directly from Windows Explorer]]
 +
 
 +
On Microsoft Windows, it is possible to install a shell extension for Windows Explorer which makes all subversion commands directly avalaible from the normal Windows Explorer menus--you may right click, or go to the file menu.
 +
 
 +
TortoiseSVN is available from http://tortoisesvn.tigris.org.
 +
 
 +
Just right click anywhere or go the file menu to see whether it is installed on your machine.  If it is not available and you do not have administrator rights on your computer, please contact a [mailto:ggy-comp@bristol.ac.uk Computer Officer].
 +
 
 +
<br style="clear: right"/>
 +
 
 +
==Importating data in your repository==
 +
 
 +
[[Image:Tortoise1a.JPG|frame|right|Importing the contents of 'mylocalfolder' into the 'myproject' repository]]
 +
 
 +
Imagine that the data that you want to import into your repository is in the folder ''mylocalfolder''.  The repository was previously created, but empty.  We recommend that you import your data into the ''trunk'' section of the repository. Using a ''trunk'' will allow you to ''branch'' and ''tag'' later on in your development. Read the [[:Category:Subversion|Subversion pages]] for detailed information about this.  You should provide a log message when you make the import.
 +
 
 +
<br style="clear: right"/>
 +
 
 +
[[Image:Tortoise1b.JPG|frame|left|Authentication is asked for only at the point it is required.]]
 +
 
 +
TortoiseSVN will prompt you you when any authenication is needed.  Note that you may check the box if you would like TortoiseSVN to save your authentication for this particular session.
 +
 
 +
<br style="clear: left"/>
 +
 
 +
==Checking out a working copy==
 +
 
 +
To start working with Subversion, you first need to ''checkout'' your repository into a ''workingcopy'':
 +
 
 +
[[Image:Tortoise2.JPG|frame|right|Making a 'workingcopy' of the repository]]
 +
 
 +
Now you can go into ''workingcopy'' and check that all is here:
 +
 
 +
If everything worked, you can now delete ''mylocalfolder''. Note that in ''workingcopy'' and all its subfolders, you will find '.svn/' folders. They are used to track the changes you make to the working copy. You should never edit or delete these folders.
 +
 
 +
<br style="clear: right"/>
 +
 
 +
==Day to day work==
 +
 
 +
Now that your repository is setup and you have a working copy, read the [[Subversion day to day]] pages to understand how to use the repository for your daily work. Most instructions have been written for the command line client but you will find equivalent commands when your right click on a file or folder in windows explorer.
 +
 
 +
=Using websvn=
 +
 
 +
After importing data in your repository, you can browse it via a web interface called [http://websvn.tigris.org WebSVN]. On the source server, the WebSVN frontend is located at https://svn.ggy.bris.ac.uk/websvn. You will be asked for your login information and the repositories to which you have access will be visible.
 +
 
 +
==Changing login in WebSVN==
 +
 
 +
The login information is cached and if for some reason you want to login as another user ('''myotherlogin'''), use the following URL: http://myotherlogin@source.ggy.bris.ac.uk/websvn.
 +
The password for the new user will be asked before you can access the files.

Latest revision as of 09:58, 28 May 2012


Introduction

Source can be used to host your subversion repositories. It uses the WebDAV protocol and is therefore available from a webbrowser anywhere in the world which is great for collaboration with people outside the department. However, we still keep a fine control of who can access the repositories and your repositories are not open to the world by default.

Important: backup policy

The hard drive on Source is backed up once a day incrementally and a full backup is performed every week using the department backup system. Additionally, we backup the repositories separately if activity has been noticed.

However, we cannot guarantee that a problem will not occur at some point. You are encouraged to use Source for your day to day work but please, keep important versions of your software backed up somewhere else too, just in case :-)

Creating a repository

First step

First contact an administrator to get a subversion account. They will create an empty repository for you and email you with login information.

For the sake of explanation, let's call your project myproject and the login you have been given mylogin. You will also be given a password, just type it whenever the software asks you to.

The repository will be accessible from a web browser at the URL https://svn.ggy.bris.ac.uk/subversion/myproject/

Adding extra users

If you collaborate with other developpers, you will need to ask for accounts for them too. At this stage, it's probably best to speak directly to the administrators. They will need to know the name and the institution of each new user. If you want to control access to specific parts of your project, i.e. some people can access some sections but not all, you will have to let them know too.

Using the command line client

The svn command line client

The subversion command line client is called svn on Linux/Unix systems. It is available from most machines within the department. To check that you can use it, just type:

svn --version

If it is not available (the above command returns an error) and you don't have administrator rights on your machine, contact a Computer Officer to have subversion installed on your machine.

Importating data in your repository

If the data that you want to import into the repository is in the folder mylocalfolder, you need to send the data inside this folder to the subversion repository. We recommend that you import your data into the trunk section of the repository. Using a trunk will allow you to branch and tag later on in your development. Read the Subversion pages for detailed information about this. The following instructions will import the whole content of mylocalfolder into the subversion repository:

cd mylocalfolder
svn import . https://svn.ggy.bris.ac.uk/subversion/myproject/trunk --username mylogin -m "Initial import."

This will import the content of mylocalfolder into trunk in the repository and will use "Initial import" as the log message.

Checking out a working copy

To start working with Subversion, you first need to checkout your repository into a workingcopy:

svn checkout https://svn.ggy.bris.ac.uk/subversion/myproject/trunk --username mylogin workingcopy

Now you can go into workingcopy and check that all is here:

cd workingcopy
ls -a

If everything worked, you can now delete localfolder. Note that in workingcopy and all its subfolders, you will find '.svn/' folders. They are used to track the changes you make to the working copy. You should never edit or delete these folders.

Day to day work

Now that your repository is setup and you have a working copy, read the Subversion day to day pages to understand how to use the repository for your daily work.

Using TortoiseSVN on Windows

The TortoiseSVN shell extension

TortoiseSVN is available directly from Windows Explorer

On Microsoft Windows, it is possible to install a shell extension for Windows Explorer which makes all subversion commands directly avalaible from the normal Windows Explorer menus--you may right click, or go to the file menu.

TortoiseSVN is available from http://tortoisesvn.tigris.org.

Just right click anywhere or go the file menu to see whether it is installed on your machine. If it is not available and you do not have administrator rights on your computer, please contact a Computer Officer.


Importating data in your repository

Importing the contents of 'mylocalfolder' into the 'myproject' repository

Imagine that the data that you want to import into your repository is in the folder mylocalfolder. The repository was previously created, but empty. We recommend that you import your data into the trunk section of the repository. Using a trunk will allow you to branch and tag later on in your development. Read the Subversion pages for detailed information about this. You should provide a log message when you make the import.


Authentication is asked for only at the point it is required.

TortoiseSVN will prompt you you when any authenication is needed. Note that you may check the box if you would like TortoiseSVN to save your authentication for this particular session.


Checking out a working copy

To start working with Subversion, you first need to checkout your repository into a workingcopy:

Making a 'workingcopy' of the repository

Now you can go into workingcopy and check that all is here:

If everything worked, you can now delete mylocalfolder. Note that in workingcopy and all its subfolders, you will find '.svn/' folders. They are used to track the changes you make to the working copy. You should never edit or delete these folders.


Day to day work

Now that your repository is setup and you have a working copy, read the Subversion day to day pages to understand how to use the repository for your daily work. Most instructions have been written for the command line client but you will find equivalent commands when your right click on a file or folder in windows explorer.

Using websvn

After importing data in your repository, you can browse it via a web interface called WebSVN. On the source server, the WebSVN frontend is located at https://svn.ggy.bris.ac.uk/websvn. You will be asked for your login information and the repositories to which you have access will be visible.

Changing login in WebSVN

The login information is cached and if for some reason you want to login as another user (myotherlogin), use the following URL: http://myotherlogin@source.ggy.bris.ac.uk/websvn. The password for the new user will be asked before you can access the files.