SVN::Notify::Mirror

JohnPeacock on 2006-01-31T11:35:23

I've decided that I need to raise the profile of some of my CPAN releases. Being too lazy to maintain my own website, I thought I'd do it here instead.

Today's module is SVN::Notify::Mirror, which allows me to keep multiple working copies, on local and remote machines, automatically synced to changes in the repository. The latest version of the module even supports switching to a new tag, based on a regex.

It acts as a handler for the fairly magical SVN::Notify by David Wheeler, along with the even more magical SVN::Notify::Config by Autrijus Tang.

What these modules let me do is have a very simple to understand post-commit file that looks like this: #!/usr/bin/perl -MSVN::Notify::Config=$0 --- #YAML:1.0 '': PATH: "/usr/bin:/usr/local/bin" 'path/in/repository': handler: Mirror to: "/path/to/www/htdocs" 'some/other/path/in/repository': handler: Mirror to: "/path/to/remote/www/htdocs" ssh-host: "remote_host" ssh-user: "remote_user" ssh-tunnel: "10.0.0.2" ssh-identity: "/home/user/.ssh/id_rsa" 'some/project/tags': handler: Mirror to: "/path/to/another/dir" tag-regex: "RELEASE-"

For example, the config file above allows me to keep:

  1. The local "test" web server up to date with changes to one path
  2. A remote "test" web server up to date with changes to another path (via SSH)
  3. A "production" web server automatically switched to the latest "release" tag of the trunk code


I once commented (about SVK) that the best object oriented code doesn't actually appear to do anything. Everything just sort of works (the drawback to this is that it is hell on wheels to debug). That's what SVN::Notify and SVN::Notify::Config do so well. I am almost embarassed by how easy it was to extend SVN::Notify to support mirroring a repository path. Literally, the POD for my module is longer than the code. That's what standing on the shoulders of giants can do for you...

John