11.07.2015 Views

Version Control with Subversion - Login

Version Control with Subversion - Login

Version Control with Subversion - Login

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Repository Administrationmirror from another machine outside CollabNet's network, the synchronization mightfail (because the hostname svn is ambiguous). For this reason, it's best to use fullyqualified source repository URLs when initializing a mirror repository rather thanthose that refer to only hostnames or IP addresses (which can change over time). Buthere again, if you need an existing mirror to start referring to a different URL for thesame source repository, you can change the bookkeeping property which houses thatinformation:$ svn propset --revprop -r0 svn:sync-from-url NEW-SOURCE-URL \http://svn.example.com/svn-mirrorproperty 'svn:sync-from-url' set on repository revision 0$Another interesting thing about these special bookkeeping properties is that svnsyncwill not attempt to mirror any of those properties when they are found in the sourcerepository. The reason is probably obvious, but basically boils down to svnsync notbeing able to distinguish the special properties it has merely copied from the sourcerepository from those it needs to consult and maintain for its own bookkeeping needs.This situation could occur if, for example, you were maintaining a mirror of a mirror ofa third repository. When svnsync sees its own special properties in revision 0 of thesource repository, it simply ignores them.There is, however, one bit of inelegance in the process. Because <strong>Subversion</strong> revision propertiescan be changed at any time throughout the lifetime of the repository, and becausethey don't leave an audit trail that indicates when they were changed, replication processeshave to pay special attention to them. If you've already mirrored the first 15 revisions of arepository and someone then changes a revision property on revision 12, svnsync won'tknow to go back and patch up its copy of revision 12. You'll need to tell it to do so manuallyby using (or <strong>with</strong> some additional tooling around) the svnsync copy-revprops subcommand,which simply rereplicates all the revision properties for a particular revision or rangethereof.$ svnsync help copy-revpropscopy-revprops: usage: svnsync copy-revprops DEST_URL [REV[:REV2]]Copy the revision properties in a given range of revisions to thedestination from the source <strong>with</strong> which it was initialized.…$ svnsync copy-revprops http://svn.example.com/svn-mirror 12Copied properties for revision 12.$That's repository replication in a nutshell. You'll likely want some automation around such aprocess. For example, while our example was a pull-and-push setup, you might wish tohave your primary repository push changes to one or more blessed mirrors as part of itspost-commit and post-revprop-change hook implementations. This would enable the mirrorto be up to date in as near to real time as is likely possible.Also, while it isn't very commonplace to do so, svnsync does gracefully mirror repositoriesin which the user as whom it authenticates has only partial read access. It simply copiesonly the bits of the repository that it is permitted to see. Obviously, such a mirror is not usefulas a backup solution.In <strong>Subversion</strong> 1.5, svnsync grew the ability to also mirror a subset of a repository ratherthan the whole thing. The process of setting up and maintaining such a mirror is exactly thesame as when mirroring a whole repository, except that instead of specifying the source repository'sroot URL when running svnsync init, you specify the URL of some subdirectory<strong>with</strong>in that repository. Synchronization to that mirror will now copy only the bits that151

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!