Add relate and mr-dependency draft kinds

Adds two draft kinds to publish: relate (link two issues) and mr-dependency (block one merge request on another). Both go through the same draft, approval and post path as the other kinds.

What it does

  • relate --project P --iid N --to-project P --to-iid N --link-type relates_to|blocks|is_blocked_by posts REST POST projects/:id/issues/:iid/links. It returns {id, iid, web_url, link_type}, with iid and web_url of the issue the draft names first.
  • mr-dependency --project P --iid N --blocked-by-project P --blocked-by-iid N resolves the blocking merge request's global id with a GET, then posts REST POST projects/:id/merge_requests/:iid/blocks. It returns {id, iid, web_url} of the blocked merge request.
  • Both take full project paths and plain iids. A bare number, #N or !N, the same object twice and an unknown link type are refused at draft time, and again at publish.
  • The draft body is one sentence built from the header (scripts/link-text.sh, sourced by both scripts). publish refuses a body that differs, so the text shown is the link made.
  • A blocks or is_blocked_by link and every merge request dependency need Premium or Ultimate. A host that answers 403 or names the license fails with that said. relates_to works on any tier.

Why REST

Both endpoints return the objects' own web_url, work on the same glab api path as the rest of publish, and need no global-id lookup for issues. The work item GraphQL linking mutation would also cover epics; that stays out of this change.

Checked

  • Selftests in tests/run.sh assert, against the glab stub, that each kind renders both ends, refuses each bare form, posts the expected request, refuses an edited body before any request, and names the tier on a 403. The script-set list gains link-text.sh.
  • One live post of each kind in a scratch project on gitlab.com (Ultimate), read back through the issue links and MR blocks endpoints. The scratch project is deleted.
  • Word budget stays under its ceiling.

Closes #25 (closed)

Merge request reports

Loading
Loading