Loading
feat(mr): list and discard pending review comments
Description
Adds --draft to glab mr note list and glab mr note delete so a pending review can be inspected and individual comments discarded from the CLI. Until now the only way to see or drop a pending comment was the browser.
glab mr note list --draftlists your pending review comments on the MR. Output shows the draft ID,file:linewhen the comment is on the diff, a(reply to …)marker for replies, and the body.--filestill narrows the result;--typeand--stateare rejected since drafts have neither.-F jsonreturns the raw draft objects.glab mr note delete --draft <id>discards one pending comment. It fetches the draft first so the confirmation prompt shows the body, and keeps the existing--yesrules and destructive annotation.mr note create --draftandmr note publishhelp now point at the two new flags.- General drafts come back from the API with an empty
positionobject rather than none, sohasFilePositionchecks for a file path instead of a nil pointer before printingfile:line.
Follows the plan in #8563 (closed).
Related Issues
Resolves #8563 (closed)
How has this been tested?
make lintandgo test ./internal/commands/mr/...pass.- New unit tests cover list with drafts, with
--file, with-F json, empty list, API error, and--draftcombined with--type/--state; delete with--yes, non-interactive without--yes, unknown ID, API error, and declining the prompt. - Manually against a test MR on
gitlab.com:
glab mr note create 1 --draft -m "first"
glab mr note create 1 --draft --file main.go --line 3 -m "second"
glab mr note list 1 --draft
glab mr note list 1 --draft --file main.go
glab mr note delete 1 --draft <id>
glab mr note list 1 --draftmake gen-docsregenerateddocs/source/mr/note/{create,delete,list,publish}.md.
Screenshots (if appropriate):
/assign-reviewer @phikai
Edited by Aditya Parida
