Herman J. Radtke III

Read more of my blog or subscribe to my feed.

Working with the PHP source tree

Written by Herman J. Radtke III on 02 May 2011

The svn repository for PHP is rather large.  Trying to checkout the entire repo is both time consuming and wastes a lot of space.  Most people, including myself, are only concerned with a subset of the repository.  One of the advantages svn has over git is the ability to do partial checkouts of the repository.  I am going to borrow from an old email Rasmus sent that details how to do a partial checkout of the PHP source code.I mostly work on pecl/memcache and pecl/gearman and send the occasional patch for a php core extension.  I will ignore any other branches of the PHP svn repository that I am not currently working on. Here is my checkout process:
  • svn co http://svn.php.net/repository --depth empty src
    • Checkout the intial, empty, repository
  • svn co http://svn.php.net/repository/php http://svn.php.net/repository/pecl --depth immediates src
    • Checkout the immediate files and directories in the php and pecl directories of the repository.  This will checkout empty directories for all the pecl extensions and empty directories for the php modules.
  • cd src/php/php-src
  • svn up branches tags --set-depth immediates
    • Checkout empty directories for all branches and tags under php-src.  Any branches or tags created in the future will automatically be created as an empty directory on a future svn update.
  • svn up trunk branches/PHP_5_3/ --set-depth infinity
    • Checkout all the source code for trunk and the PHP 5.3 development branch.
  • cd ../../pecl/
  • svn up gearman memcache --set-depth infinity
    • Checkout trunk, branches and tags for the pecl/gearman and pecl/memcache extensions
The great thing about this approach is that I can show and hide other parts of the PHP svn repository at will with only a few svn update commands.  I regularly add an remove other parts of the PHP svn repository at will.  Combined with http://lxr.php.net/, I can quickly find examples and code I am looking for.