feat(mr note): add 'create' subcommand with discussion-based notes

This MR introduces a new glab mr note create command which is, for now, almost a carbon copy of the glab mr note command but using Disucussions API rather than Note API (creates resolvable discussion threads).

The command supports --message and --unique. The shared logic for processing message input and ensuring the uniqueness of the messages is extracted into a helper. This also fixes an existing bug where the uniqueness logic didn't paginate through comments and hence didn't guarantee uniqueness.

The next MR will add --reply so we can reply to existing discussions, then I'll go with --file to implement diff notes.

Deprecating glab mr note for creating notes

I deprecated the original glab mr note for creating messages; it can still be used, but the help won't suggest it. The new glab mr note create has feature-parity (unique, opens editor, reads from stdin) already.

This is now the help for glab mr note

./bin/glab mr note --help

  Manage comments and discussions on a merge request.

  USAGE


    glab mr note [command] [<id> | <branch>] [--flags]


  COMMANDS

    create [<id> | <branch>] [--flags]          Create a comment or discussion on a merge request. (EXPERIMENTAL)
    list [<id> | <branch>] [--flags]            List merge request discussions. (EXPERIMENTAL)
    reopen  <discussion-id> [<id> | <branch>]   Reopen a discussion on a merge request. (EXPERIMENTAL)
    resolve  <discussion-id> [<id> | <branch>]  Resolve a discussion on a merge request. (EXPERIMENTAL)

Related: #1311 (closed)

Merge request reports

Loading