WordPress Subversion Repository Guide

Subversion is the version-control system used by WordPress to manage plugins within its Repository. With Subversion you only commit the tested working tagged version of the plugin rather than various changes during development.

Install Subversion

sudo apt-get install subversion

Setup The Local Directory Structure

Create a document structure to store the Subversion copies of each WordPress plugin. My structure looks like this:

WordPress Plugin SVN Tree

Local SVN Update

These step should be completed for both new and already published WordPress plugins.

Within the /svn/ folder, checkout (co) a copy of a plugin.

cd /wordpress/svn/
sudo svn co http://plugins.svn.wordpress.org/wp-my-admin-bar/

SVN Checkout Example - Thumbnail

Within the plugin-name directory this will create a local directory structure that looks like:

List Of SVN Files

The Plugins Readme.txt File

A plugins readme.txt file is the key file to making plugins publish correctly. The readme.txt creates the description of the plugin and is what determines the plugin version available to the public.

  • The "Stable tag" is what "tags" the version of your plugin. The Stable tag must always be updated/changed when a new version of your plugin is published.

Stable tag in readme.txt file

The readme.txt file also lays out the different tabbed pages displayed on WordPress.org, such as: Description, Installation, FAQ, Screenshots, Other Notes, Changelog, and Other Notes. This is done based off the structure of the readme.txt file. [Clean Robots.txt Template]

Status Check

cd /wordpress/svn/plugin-name/
sudo svn status

Copy Development Plugin Files Into /trunk/

Change to the development plugins root directory /plugin-name/.

Copy a single file into /trunk/.

sudo cp readme.txt ../svn/plugin-name/truck/

Copy all plugin files into /trunk/.

sudo cp -r * ../svn/plugin-name/truck/

Ignore .git directory, copy all files into /trunk/

sudo cp -r `ls -A | grep -v ".git"` ../svn/plugin-name/truck/

Delete Old Files From /svn/

Change directory to ../svn/.

Remove both the /trunk/ and if needed the /tags/ version of the file.

sudo rm -r trunk/file-to-remove.php
sudo rm -r tags/0.0.0/file-to-remove.php

Delete the files using SVN

sudo svn delete trunk/file-to-remove.php
sudo svn delete tags/0.0.0/file-to-remove.php

If you Screwed Up /svn/trunk

Reset the /svn/trunk directory.

Change into the /svn/plugin-name/ directory, remove the trunk directory, the checkout a new copy of the trunk directory from the repository.

cd /wordpress/svn/plugin-name/
sudo rm -r trunk
sudo svn co http://plugins.svn.wordpress.org/wp-my-admin-bar/trunk

Re-copy changed files back into the /svn/plugin-name/trunk directory.

SVN Stat - Thumbnail

Tag New Local Versions

Once the local /trunk/ has an updated copy of the plugin, copy the contents of trunk to a locally tagged version. The tag name / directory, will match your plugin Version in your readme.txt file. If the Stable tag within the readme.txt is on Version 0.1 then your tagged directory name would be 0.1 as well.

cd /wordpress/svn/plugin-name/
sudo svn cp trunk tags/0.1
  • Remember: The tag version should relate to the "Stable tag" version number in the readme.txt file.

Add Files To Commit

cd /wordpress/svn/plugin-name/

Add all files.

sudo svn add --force * --auto-props --parents --depth infinity -q

Add a single file.

sudo svn add robots.txt

Commit The Update

Publish the plugin to the repository.

cd /wordpress/svn/plugin-name/
sudo svn ci -m 'Version 0.1'
  • Note: The area within the quote marks is a message to note what the update/version is about.

Commit Files To The Repository - Thumbnail

Enter the required login credentials to start the commit.

View The Plugin

Open the svn url to the plugin, example: http://plugins.svn.wordpress.org/wp-my-admin-bar/

Enter the /trunk/ and /tags/version-number directories to ensure everything committed correctly.

After a few minutes has passed, check the plugin version at WordPres.org, example: http://wordpress.org/extend/plugins/wp-my-admin-bar/

The new plugin version should nbe available for download.