Subversion Mirroring
From DGC Wiki
This page describes how to use SVK to mirror subversion repositories for use in the field.
Created: Murray 23:25, 13 Jul 2005 (PDT)
Contents[hide] |
Overview
SVK is a perl program that allows you to make a mirror (copy) of a subversion repository, edit a copy of that repository on a remote machine, and then synchronize changes with the master repository. This program is used by Team Caltech to allow modification of code in the field using the following approach:
- A mirror of 'dgc/branches/wNtesting' (or any other copy of the DGC code) is created on the field server
- A local copy of the mirror is created on the field server to allow changes while the field server is offline
- Users check out a copy of the field repository and commit changes as usual, using 'svn'
- When the field server returns to campus, the field changes are copied back to the mirror copy, keeping all inforation about offline commits
- The field changes are then merged back into the repository trunk on grandchallenge
From a user's point of view, there is essentially no different between using the remote copy and using the standard repository.
Creating a branch
Creating a depot on the field server
This has already been done on the following computers
- Lawrencium
The first time that you use svk on the field server, you need to set up a 'depot', which is what svk uses to keep track of where its various mirrors are. In principle, this should only need to be done once.
- As root, use 'svk depotname' to edit the depot configuration file
root@fs# svk depotname
This shoould put you into an editor that shows the depots that are defined. You should edit this file to contain the following entry:
'': /dgc/subversion/svk
This will set up a depot (roughly, an svn repository) '//' to be in the location /dgc/svk/dgc. <li> Set the group ownership and permissions for the repository
root@fs# cd /dgc/subversion/svk root@fs# chgrp -R users . root@fs# chmod g+s . root@fs# chmod -R g+w .
</ul>
[edit]Creating a mirror on the field server
Now that the depot is initialized, you need to make a mirror of the svn repository on the field server. To ease remerging of the repository, you should make a unique branch for the code that will be taken to the field (wNtesting in the instructions below).
The following commands should be carried out by the system administrator at the beginning of each field test (before leaving the shop):
-
<li> Create a mirror of the desired branch on the field server:
root@fs# svk mirror svn+ssh://murray@gc.caltech.edu/dgc/subversion/dgc/branches/wNtesting //mirrors/wNtesting root@fs# svk sync //mirrors/wNtesting
<li> Create a local copy of the mirror, to be used for local editing
root@fs# svk cp //mirrors/wNtesting //branches/wNtesting
Using the field copy of the local repository
Once the steps above have been followed, the repository can be checked out on field computers using the standard svn commands, except using the path 'dgc/subversion/svk' instead of 'dgc/subversion/dgc.
-
<li> Assuming that the field server has been configured to respond as 'gc.caltech.edu', the following command can be used:
user@skynet2$ svn co svn+ssh://user@gc.caltech.edu/dgc/subversion/svk/branches/wNtesting dgc
Copying the changes back to the main server
At the end of the field test, changes must be copied back to the master server.
-
<li>Check to make sure there are no conflicts in the mirror (should be OK if nobody edited 'wNtesting' on campus):
root@fs# svk sync //mirrors/wNtesting root@fs# svk smerge -C //branches/wNtesting //mirrors/wNtesting
If there are conflicts, the local branch ('//branches/wNtesting') should be updated to resolve all such conflicts.
<li> Merge the changes in the field repository back into the mirror:
root@fs# svk smerge -lI //branches/wNtesting //mirrors/wNtesting
This should automatically synchronize the changes back to the master server (on grandchallenge). The '-lI' option copies the individual log messages into the log message for the server. Note: Make sure that you have read-write access on the grandchallenge when you synchronize the changes.
If it seems like it only remirrors the first change and then stops without an error message, make sure the branch you are copying back to isn't read only.
After this is completed, send email reminders to authors of wNtesting branch commits to merge their changes back into trunk. You can do this with
~/dgc/local/scripts user@grandchallenge$ ./email-merge.sh wNtesting