This post is not an SVK tutorial; it simply describes how I use SVK to keep multiple blogs up to date whilst very conveniently keeping track of individual local changes to each site. The approach is essentially vendor branches with a twist.

Initial setup

I’ll pretend that you have an SVK depot already.

  1. Download a version of wordpress and unpack it
  2. cd ~/wordpress
  3. svk import //vendor/wordpress -m ‘importing wordpress vendor version’
  4. svk cp //vendor/wordpress //template -m ‘create template’
  5. import desired themes to //vendor/themes
  6. svk cp //vendor/themes/ //template/wp-content/themes -m ‘added themes to template’
  7. import desired plugins to //vendor/plugins
  8. svk cp //vendor/plugins/ //template/wp-content/plugins -m ‘added plugins to template’
  9. svk cp //template //yoursite.com -m ‘my site’
  10. svk co //yoursite.com /web/yoursite.com (assuming this is where your webserver expects it)
  11. cd /web/yoursite.com
  12. svk mv wp-config-sample.php wp-config.php [*]
  13. edit wp-config.php to point to your database
  14. svk ci -m ‘know where to find my db now’

If you want a second site, repeat the last five steps above.

[*] If you want, you can do this step on //template, before you copy it to //yoursite.com, instead.

Updating to a new version

Whenever you want to update your blogs (say, when 2.0.5 comes out) you just import that version over the current vendor version and merge it into your template:

  1. cd ~/wordpress-2.0.5
  2. svk ci –import //vendor/wordpress -m ‘upgrade to 2.0.5′
  3. svk smerge //vendor/wordpress //vendor/example.com/ -m ‘upgrade to 2.0.5′

Then, for each site, perform the following two steps:

  1. svk smerge -t //yoursite.com -m ‘upgrade to 2.0.5′
  2. svk up /web/yoursite.com

Making local changes that persist across upgrades

Making local changes is a doodle. In fact, you’ve already done this. Whenever you upgrade, the changes to wp-config.php will keep the changes you made to it. Let’s pretend, however, that you’ve made a change to a theme or a plugin, or to wordpress itself, that you want available in all your sites. Here’s how you do that:

  1. run svk log //yoursite.com and note the revision number of the changeset you want
  2. svk merge -c $REV //yoursite.com //template -m ‘propagate good change’

Then, update each site from the template as shown above under Updating to a new version.

Leave a Reply