[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r21578 - trunk/notes

From: Kamesh Jayachandran <kamesh_at_collab.net>
Date: 2006-09-21 08:01:54 CEST

What about adding FAQ item about, "rev prop change in master won't be
reflected in the mirror"?

With regards
Kamesh Jayachandran
rooneg@tigris.org wrote:
> Author: rooneg
> Date: Wed Sep 20 17:52:21 2006
> New Revision: 21578
>
> Log:
> Add some notes on how to use svnsync, since people seem to keep asking
> the same questions and it'd be good to have the answers written down.
>
> * notes/svnsync.txt: New file.
>
>
> Added:
> trunk/notes/svnsync.txt
>
> Added: trunk/notes/svnsync.txt
> URL: http://svn.collab.net/viewvc/svn/trunk/notes/svnsync.txt?pathrev=21578
> ==============================================================================
> --- (empty file)
> +++ trunk/notes/svnsync.txt Wed Sep 20 17:52:21 2006
> @@ -0,0 +1,99 @@
> + ==== What Is It? ====
> +
> +svnsync is a tool for creating and maintaining read-only mirrors of
> +subversion repositories. It works by replaying commits that occurred
> +in one repository and committing it into another.
> +
> + ==== Basic Setup ====
> +
> +First, you need to create your destination repository:
> +
> +$ svnadmin create dest
> +
> +Because svnsync uses revprops to keep track of bookkeeping information
> +it needs to be able to change revprops on your destination repository.
> +To do this you'll need to set up a pre-revprop-change hook script that
> +lets the user you'll run svnsync as make arbitrary propchanges.
> +
> +$ cat <<EOF > dest/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
> +EOF
> +$ chmod +x dest/hooks/pre-revprop-change
> +
> +$ svnsync init --username svnsync file://`pwd`/dest \
> + http://svn.example.org/source/repos
> +Copied properties for revision 0
> +$
> +
> +Note that the arguments to 'svnsync init' are two arbitrary repository
> +URLs. The first is the destination, which must be empty, and the second
> +is the source.
> +
> +Now you can just run the 'svnsync sync' command to synchronize pending
> +revisions. This will copy any revisions that exist in the source repos
> +but don't exist in the destination repos.
> +
> +$ svnsync sync file://`pwd`/dest
> +Committed revision 1.
> +Copied properties for revision 1.
> +Committed revision 2.
> +Copied properties for revision 2.
> +Committed revision 3.
> +Copied properties for revision 3.
> +...
> +
> + ==== Locks ====
> +
> +If you kill a sync while it's occurring there's a chance that it might
> +leave the repository "locked". svnsync ensures that only one svnsync
> +process is copying data into a given destination repository at a time
> +by creating a svn:sync-lock revprop on revision zero of the destination
> +repository. If that property is there, but you're sure no svnsync is
> +actually running, you can unlock the repository by deleting that revprop.
> +
> +$ svn pdel --revprop -r 0 svn:sync-lock file://`pwd`/dest
> +
> + ==== FAQ ====
> +
> +Q: So what can I do with this thing anyway?
> +
> +A: Well, anything that's read-only. As long as you don't commit changes
> + to the destination repository you're all set. This means destination
> + repositories are good for providing offsite mirrors, read-only mirrors,
> + etc.
> +
> +Q: What if I want to check out from a mirror, but commit to the master?
> +
> +A: That's possible, but requires some gymnastics. You see, each repository
> + has its own UUID, which is stored in the working copy, so if you check
> + out from the mirror, and then do a 'svn switch --relocate' to point to
> + the master it'll error out. To make this work you need to make sure that
> + the mirrors have the same UUID as the master. You can set a repository
> + UUID via the following technique:
> +
> +$ cat - <<EOF | svnadmin load --force-uuid dest
> +SVN-fs-dump-format-version: 2
> +
> +UUID: d48dd586-eb1d-0410-b581-e6e13afcedeb
> +EOF
> +
> + Once both the mirror and master repositories have the same UUID you can
> + safely check out from the mirror and commit to the master, all you have
> + to do is do a 'svn switch --relocate' to point your working copy to the
> + master before a commit. Note that you should NEVER commit changes to a
> + mirror other than via svnsync, so to avoid accidentally doing so you may
> + want to add a pre-commit hook script that disallows commits from users
> + other than the one you run svnsync as.
> +
> +Q: What version of Subversion is required to use svnsync?
> +
> +A: The source repository must be running Subversion 1.4 or newer, since
> + svnsync uses a new RA layer command that was added in 1.4. On the other
> + hand, the destination repository can be any version of Subversion, since
> + all svnsync is doing is committing changes using the regular RA APIs.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: svn-help@subversion.tigris.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Sep 21 08:01:36 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.