Fix two problems with post-review's SVN client support.

Review Request #1429 — Created Feb. 23, 2010 and submitted




I have run into two problems with post-review's support for generating diffs from a Subversion repository using the post-commit review model.

1) It is difficult to use post-review to create a post-commit review as the initial review of new code (i.e. where every file in the generated diff is a new file). The "svn diff" command post-review uses to generate its diff looks something like this::

    svn diff "<SVN repo URL>/<base path>/@OLD" "<SVN repo URL>/<base path>/@NEW"

This command results in an error saying that ``<SVN repo URL>/<base path>/`` didn't exist at revision ``OLD``, making it impossible for post-review to generate a diff in which all files are created. A simple work-around is to use a known-empty directory as the old URL. Subversion repositories are always empty at revision zero, so this diff uses the root of the repository at revision zero as the old URL to generate a the proper diff.

After this change, the post-review command to generate a post-commit review of a tree in Subversion would be ``post-review --revision-range 0:HEAD --repository-url=<SVN repo URL>/<path to tree>``. This would be far more convenient than using the new ``diff-filename``.

2) The "svn" command-line tool sometimes outputs several tabs in the headers of diff files. I'm not sure under which conditions this occurs, but the diff header lines look something like this::

    --- originalFilename\t(.../some/path)\t(revision n)
    +++ newFilename\t(.../some/path)\t(revision m)

This causes a string.split() call in post-review to return an array with more than two elements, which the calling code wasn't prepared to handle.
Tested both changes on a private Subversion server.
  1. Looks good, thanks! Committed to master (rdbfbd07)