new fetch-diff tool - does what it says

Review Request #1467 — Created March 9, 2010 and discarded

Information

RBTools

Reviewers

fetchdiff.py: support specifying diff revision

========================================================================
add fetch-diff

Add fetch-diff, a tool to grab raw diffs from Review Board using the
same authentication and server-guessing as post-review. For now, only
grabs the latest diff.
========================================================================
(end commit log)

Here is a little something to motivate "library-izing" rbtools. I was asked to run an automated build against a review request (our internal Review Board), and I thought, "wouldn't it be great if I could feed the builder a request number instead of making a patch and pointing it at the full path to the patch?". Well, now I can :-).

It is probably more interesting to diff the new script against postreview.py. The only altered functions (I outright dropped a lot of stuff) could be reverted (i.e. use the postreview.py versions in new, shared code); they just need some options to be set to empty instead, to fix missing variable errors.

Please let me know if the 'git format-patch' patches are wanted (i.e. to preserve the history, tiny though it is).
Works against our internal server, using both git-svn and svn repositories to find the server information; both '#' and '#:#' request formats tested. Also this was posted using postreview.py including http://reviews.reviewboard.org/r/1465 :-).
chipx86
  1. There's definitely a lot in common between these scripts.
    
    I love the idea of the script. Let me tell you what I'm planning on for RBTools, though, so you can plan accordingly.
    
    Once this 0.2 release comes out, I would very much like to start moving much of the logic out of post-review and into an important Python package (whether part of RBTools or not, I don't know just yet -- probably part of it for now).
    
    That Python package would have an API that sort of mirrors the web API (perhaps based partially on datastore.js in Review Board).
    
    We would then have a new wrapper script in the same spirit as `git`. This would be `rb`. It would take the second parameter as the command name (in this case, fetch-diff) and wrap that. So, this new script would be named rb-fetch-diff, post-review would be rb-post-review (or maybe we'd rename it and deprecate the old name).
    
    Once we've done that, this script and post-review would each be much smaller and could share much of the code.
    
    I'd like to keep from adding anything new to RBTools right now until after the release, at which point we'll begin the process of doing this. Then, if you can update the script to work with those changes, we can get that included.
    
    How does that sound?
    1. +1 for `rb` wrapper script approach, fwiw!
  2.