Fix up bugs in `rbt patch` with old-style review requests.
Review Request #10933 — Created March 2, 2020 and submitted
The new rbt patch implementation did a pretty good job of applying
commits from new-style review requests that have multi-commit history,
but it broke with old review requests that just have single diffs. This
change fixes up the issues I ran into:
- The code was never populating the
was given. It then would always use
commits, blowing up. I've
changed it to fetch the full diff data when there are no commits.
--squashedwas specified, we'd end up passing
the API request, which would then blow up.
- The code that determined whether to create the commit wasn't working
--squashed, because it was testing
patch_numas if it
was 0-indexed when in fact it's 1-indexed.
- Was able to apply patches from review requests without commit history.
- Was able to apply patches using
- Ran unit tests (there are some problems with the test suite right now
but those are unrelated to anything touched here).