Added --repository-url flag to post-review for generating diff outside a working copy

Review Request #609 — Created Oct. 24, 2008 and submitted — Latest diff uploaded

Information

Review Board SVN (deprecated)

Reviewers

In review 588 (commit r1544) I added support for running post-review with Subversion outside of a working copy.  One downside to that patch was that it required a global setting for REPOSITORY_URL because the SCM Client type was determined before the command line options were read.  It also forced the use of Subversion if REPOSITORY_URL were set.

This patch moves the option reading code above the SCM Client construction and removes the global REPOSITORY_URL.  It adds two flags:
--repository-url (URL to a repository)
--repository-type (SCM name, e.g. svn, p4, perforce, etc.)
If the repository url is supplied, the repository-type and a revision-range must also be supplied.  The type is then used to explicitly create an SCM Client.  Otherwise, the previously-available for loop is still used to pick an SCM Client based on the results of the repository_info constructor.

This change requires that all command line parameters be registered regardless of available SCM client.  I have updated the help text of several to make clear that they are only available with certain SCM clients, and also added checks after the options are read that incompatible options have not been set.

repository-url is still only used with Subversion, but it should be easier to add code for other SCM types if that's desirable.

Is this a good direction for post-review?

----

10/29/08: In diff 2, I have removed the --repository-type option.
Fairly little.  I'll do more testing if there's interest in this change.
I have tested it on Redhat with Subversion 1.5.2 with the following commands:
./postreview.py -n ../style/
./postreview.py -n --repository-url=file:///usr/local/svn/ --revision-range=4807:4808
./postreview.py -n --repository-url=file:///usr/local/svn/ (fails: no --revision-range parameter supplied)

    Loading...