The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

svn_binary_seach

VERSION

0.01

SYNOPSIS

 svn_binary_search -r rev:rev -c test_script [-n test_name] [-d outdir] [-q]

DESCRIPTION

Need to know when a feature was added to a project in your svn repository? When a regression test started failing? Write up a small script that tests your feature or failure, feed in a begin/end revision, and this script will run a binary search through those svn revisions in a checked-out working copy determine which revision changed the behavior.

OPTIONS

-r

Required. Specify a colon separated pair of revision numbers that inclusively bound your search.

-c

Required. Executable that will generate output to test your condition on various svn revisions of your project. EXAMPLES.

-n

Optional. Override the default file name (revision_) for generated files

-d

Optional. Override the default temp directory for generated files.

-q

Optional. Run quietly, surpressing output from svn up commands.

EXAMPLES

Before you begin, you must have a working copy of your repository checked out locally. svn must be in your path. It is recommended that you have a pristine copy checked out, with no local modifications.

The most important part of this tool is the test script that you provide. The script must generate all output to be compared to STDOUT. Any information sent to STDERR will be preserved in a log so you can further track down any build issues, etc.

A sample (sh) test script:

  make clean 1>&2
  sh configure 1>&2
  make 1>&2
  prove t/some_test.t 1>&2
  echo $?

Note that all but the last step redirect all their output to STDERR, including the run of the test itself: The only result that we care about is whether the test passed or not. While it would be tempting to just dump the output from prove and compare it, prove generates timing information which might change from run to run. The entirety of the text sent to STDOUT is used to compare the results, so construct your test carefully.

You can then run this with:

 svn_binary_search -r 920:967 -c your_script

As it runs, you'll see the output from the svn up commands, followed by, e.g:

 *** changed between r951 and r952

As it runs, output will be placed in a temporary directory (overridable on the command line with -d). Output will end up in files like:

 revision_920.log
 revision_920.out

Where the test name (which defaults to "revision", but can be overriden by the -n option) and the svn version number form the base name, and the extension is either .log (from STDERR) or .out (from STDOUT).

AUTHOR

Will Coleda, <coke at cpan.org>