Quick SVN "mergeinfo" Log Inspector

Posted on

We use Subversion branches to separate development (dev) and production (trunk) code. Eventually we want to move these features and bug fixes from dev to trunk. I wrote this stupid simple script to figure out which revisions from dev have not been merged into trunk.

#!/usr/bin/env php
<?php

$repo  = '[SVN_REPO_URL]';
$dev   = $repo . '/dev/';
$trunk = $repo . '/trunk/';

$revs = shell_exec(sprintf('svn mergeinfo --show-revs eligible %s %s', escapeshellarg($dev), escapeshellarg($trunk)));
$revs = explode(PHP_EOL, str_replace('r', '', trim($revs)));

foreach ($revs as $rev) {
    system(sprintf('svn log -v -r %s %s', escapeshellarg($rev), escapeshellarg($repo)));
}