Subversioned Wordpress Upgrade

2009 March 4 at 03:50 » Tagged as :wordpress, collaboration, microsoft,

They say, release early, release often and Wordpress is one software that seems to follow that mantra pretty well. Fortunately upgrading from one version of Wordpress to another is a painless task - unless of course you have a customized installation. Upgrading a customized installation can be made easier if you use subversion.

Normally, in order to upgrade, all you need to do is to delete the old stuff, copy over the set of scripts from the new version and invoke upgrade.php . But if you recursively delete all the old stuff you lose your version control info. So this is my approach to upgrading a customized WP installation which has been subversioned.

1) copy the files that you have modified into a safe place (themes and plugins will make up the bulk of this)

2) Download wordpress and unzip it, then change into the source directory and use rsync to copy over the new files while deleting obsolete files from the previous version. the --exclude '.svn' part will ensure that subversion info is not discard. If you are using another revision control system, you can use the appropriate directory here

rsync . /var/www/raditha/blog/ -avz --exclude '.svn' --delete

3) Then add new files into the repository with

svn add `svn stat | grep '^?' | cut -d' ' -f8`

4) copy back the themes and plugins (inclusive of the .svn folders).

4) delete the obsolete ones with:

svn rm `svn stat | grep '^!' | cut -d' ' -f8`

5) Merging - unfortunately there is no easy recipe for this, you need to manually Kompare , Meld or diff the files to see if your code needs to be merged.

6) commit.

7) run upgrade.php