Looking to setup a mirror to a locally hosted svn repo, however it's expected that in the future the role of which repo is the mirror and which is the master will reverse.
Reading up on svnsync, there appears to be some suggestion that something happens with the 'svnsync init' command that is specific to the new mirror. I'm wondering if this will be an issue when changing which repo is the master and which is the mirror? It's not clear what exactly is set by this initial command. AFAICT it's only the last changed datestamp on rev 0, i.e. the initial create time of the source repository. It doesn't appear to copy the UUID, or provide an option to copy this, although maybe that's just because of the version I'm testing this on (1.4). What I'm looking to achieve is the following: Setup a remote read-only mirror for another team, and then at a later stage change to having this be the master and change our local svn repo to be a read-only mirror of the remote system. Some ASCII diagrams: Current: Team 1 /--------\ | Master | \--------/ Next step: Setup remote read-only mirror for team 2 Team 1 Team 2 /--------\ /--------\ | Master | ---------> | Mirror | \--------/ \--------/ Final stage: switch which is master and which is mirror Team 1 Team 2 /--------\ /--------\ | Mirror | <--------- | Master | \--------/ \--------/ While there seems to be plenty of documentation on setting up the mirror using svnsync, I haven't seen anything on whether anything special needs to be done to convert the mirror to a proper repo. Based on what I want to do, below are the steps that I think I need to follow. Would appreciate any pointers to something that I've missed or any gotcha's that I've overlooked. First stage: setting up the mirror 1) Create a svnsync user on both local and remote systems (might as well create it now on the local system) 2) Create a svn repository on the remote system svnadmin create /var/svn/mirror 3) Setup pre-revprop-change and pre-commit scripts to let only svnsync user edit the mirror repo /var/svn/mirror/hooks/pre-revprop-change #!/bin/sh USER="$3" if [ "$USER" = "svnsync" ]; then exit 0; fi echo "Only the svnsync user can change revprops" >&2 exit 1 /var/svn/mirror/hooks/pre-commit #!/bin/sh REPOS="$1" TXN="$2" USER=`/usr/local/bin/svnlook author -t "$TXN" "$REPOS"` if [ "$USER" = "svnsync" ]; then exit 0; fi echo "This is a mirror repository only, please commit to the master" exit 1 4) From the local system init the repository with svnsync svnsync init --username svnsync svn+ssh://remote/var/svn/mirror file:///var/svn/master 5) Synchronise the repositories svnsync synchronize --username svnsync svn+ssh://svns...@remote/var/svn/mirror 6) Put the local repo into read-only mode temporarily and repeat step 6 (since otherwise it would read-only for many hours) Do this by setting at the top of the scripts /var/svn/master/hooks/{pre-commit,pre-revprop-change} echo "Repository temporarily read only contact blah if this is an issue" exit 1 7) Add post-commit and post-rev-changes to forward and future changes to the master repository to the /var/svn/master/hooks/post-commit /usr/local/bin/svnsync synchronize --username svnsync svn+ssh://svns...@remote/var/svn/mirror & /var/svn/master/hooks/post-rev-change REV="$2" /usr/local/bin/svnsync copy-revprops --username svnsync svn+ssh://svns...@remote/var/svn/mirror $REV & 8) Copy the repo UUID from the master to the mirror Otherwise users can't checkout the mirror, do a svn --relocate and commit to the master Local system svnadmin dump -r0 /var/svn/master | head -n 3 > saved-uuid Remote system svnadmin load --force-uuid /var/svn/mirror < saved-uuid Switching the role of mirror and master 9) Set current master to read-only i.e. Take the pre-commit and pre-rev-prop from step 3 and add them to the master hooks directory 10) Add scripts to the mirror to forward changes made to the former master repo /var/svn/mirror/hooks/post-commit /usr/local/bin/svnsync synchronize --username svnsync svn+ssh://svns...@local/var/svn/master & /var/svn/mirror/hooks/post-rev-change REV="$2" /usr/local/bin/svnsync copy-revprops --username svnsync svn+ssh://svns...@local/var/svn/master $REV & 11) Remove the changes made to the post-commit and post-rev-change scripts on the original master These were change changes made in step 7 12) Remove the tests is pre-revprop-change and pre-commit on the mirror for the user svnsync These were the tests added in step 3 to only allow svnsync to update the mirror repository Once removed the former remote mirror is now expected to be the target repository for future commits. Have I covered everything here? Is there something that "svnsync init" in step 4 does to the mirror repository that will have to be undone before it can be used as a normal repository and also replicated on the original master before it can be used as a read-only mirror? -- Regards, Darragh Bailey Systems Software Engineer Hewlett Packard Galway Ltd. Postal Address: Hewlett Packard Galway Limited, Ballybrit Business Park, Galway Registered Office: Hewlett Packard Galway Limited, 63-74 Sir John Rogerson's Quay Dublin 2 Registered Number: 361933