BBC2-23 add bb pr edit#23
Open
b2l wants to merge 1 commit into
Open
Conversation
Update a PR's title and/or description via PUT /pullrequests/{id}. Flags:
--title (-t), --description (-d). Defaults to the PR for the current
branch.
Without flags, opens $EDITOR pre-filled with the current title (line 1),
a blank line, and the current description. First non-empty line on save
becomes the title; everything after the first blank line is the
description (standard git-style parsing). Empty editor output aborts
without a PUT.
No-op guard: only sends fields that actually differ from the PR's current
state. `--title "unchanged"` does not issue a PUT; editor close with no
changes prints "No changes to pull request #N." and returns cleanly.
Reviewer editing is deliberately out of scope — blocked on BBC2-43's
nickname → UUID resolution. Draft-state changes are out of scope too
(BBC2-25 handles draft → ready one-way; reverse is not supported by the
API).
Sends partial bodies (just title/description). The spec's doc comment is
vague but Bitbucket accepts them in practice — see docs/bb-notes.md →
"Updating a PR". If a future API change rejects partial bodies we'd need
to switch to GET-merge-PUT; the backend test layout makes that easy to
land without touching the command.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bb pr edit [id]that updates a PR's title and/or description viaPUT /pullrequests/{id}. Flags--title/-tand--description/-d. Defaults to the current branch's PR.$EDITORwith the current title on line 1, a blank separator, and the current description. First non-empty line on save becomes the title; everything after the first blank line is the description. Empty output aborts (no PUT).--title "same as before"doesn't issue a request; the editor closed unchanged printsNo changes to pull request #N.MERGED,DECLINED,SUPERSEDEDcleanly.pullrequestschema but Bitbucket accepts partial bodies in practice (seedocs/bb-notes.md→ "Updating a PR"). If a future API change rejects them, the switch to GET-merge-PUT is local to the backend.Test plan
bun test— 168 tests pass (5 new backend tests: title-only, description-only, both, 400 on closed PR, 404 on missing; 8 new unit tests forparseMessagecovering happy path, multi-paragraph, trailing-only descriptions, leading blanks, extra separators, CRLF, empty input, trimming)bun run lintcleanbunx tsc --noEmitcleanbb pr edit --helpshows correct helpManual test path
On a throwaway open PR (replace
<N>with its id):bb pr edit <N> --title "Updated title"— title changes, description unchanged.bb pr edit <N> --description "Updated description"— description changes, title unchanged.bb pr edit <N> --title "T" --description "D"— both change in a single PUT.bb pr edit <N> --title "<exact current title>"— expectNo changes to pull request #N., no API call.bb pr edit <N>— $EDITOR opens pre-filled with the existing title/description. Edit and save → PUT; close without changes →No changes to pull request #N.bb pr edit <N>→ delete all content → save. ExpectEdit aborted: title is empty.bb pr edit(no id) picks up the current-branch PR.bb pr edit <merged-or-declined-N>→ expectPull request #N is merged; cannot edit.(ordeclined).bb --json pr edit <N> --title "JSON"emits the full updated PR detail.Closes BBC2-23.