Add support for patching using draft diffs in rbt patch.
Review Request #13153 — Created July 19, 2023 and submitted
rbt patch
could historically only fetch published diffs, and not draft
diffs. This meant that a user could not re-download an in-progress patch
from a review request, and automated build systems could not test or
inspect diffs prior to publishing.This change adds support for fetching draft diffs, when available. There
are two conditions in which we're fetching a draft diff:
We're fetching the latest diff (default). If found, a draft diff will
take precedence over any published diffs (as they are the latest),
and will avoid looking up diff revisions.We're fetching a specific diff revision (using
--diff-revision
),
and the diff revision in question is not published. We'll fetch the
draft, and if the revision matches, it'll be returned.Only the owner of a review request or a special user with the
can_edit_review_request
permission can fetch draft diffs. For other
users, only published diffs are considered, as normal (this is managed
by the Review Board API and not RBTools).
Tested patching/printing the following:
- Latest published diffs
- Latest draft diff
- Specific diff revision of published diff
- Specific diff revision of draft diff
- Invalid diff revision
Tested these as the owner, as a user with the special permission, and
as a standard user, ensuring the correct behavior.
Summary | ID |
---|---|
11ed91a3b575bba0b1f257e4ac865392cb6c92d2 |