Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code review support #266

Closed
wants to merge 15 commits into from

Commits on Apr 5, 2021

  1. Save more informations in some forge objects

    In order to improve user experience and support new features like
    code-review or replies, some informations need to be added in
    issue / pullrequest objects and a new object pullreq-version has been
    created.
    
    * issue-post object:
      -> thread-id: id of a thread discussion
      -> reply-to:  id of the initial post in reply to
    
    * pullreq object:
      -> versions: list of version object
    
    * pullreq-post object:
      -> thread-id:   id of a thread discussion
      -> diff-p:      describe if this post is a diff post
      -> resolved-by: the user who resolved this thread
      -> reply-to:    id of the initial post in reply to
      -> head-ref:    head SHA for this post
      -> commit-ref:  commit SHA for this post
      -> base-ref:    base SHA for this post
      -> path:        file path where the diff is posted
      -> old-line:    the line where the diff is posted before changes
      -> new-line:    the line where the diff is posted after changes
    
    * pullreq-version: contains informations like the base and head SHA
    reference of a pullreq version.
    These informations are needed for eg. when we want to know for which
    version of a pullreq are diff posts.
    
    If an old forge database is detected, it will be upgraded to the new
    version 8.
    
    Signed-off-by: Julien Masson <[email protected]>
    JulienMasson authored and tarsius committed Apr 5, 2021
    Configuration menu
    Copy the full SHA
    e0e2c57 View commit details
    Browse the repository at this point in the history
  2. gitlab: use discussions API for issue/pullreq posts

    The discussions API provide more informations for each issue/pullreq
    post.
    
    We can use this API to retrieve the following informations:
    - Issue: thread-id, reply-to
    - Pullreq: thread-id, diff-p, reply-to, head/commit/base ref, path,
      old-line, new-line
    
    Source:
    https://docs.gitlab.com/ee/api/discussions.html
    
    Signed-off-by: Julien Masson <[email protected]>
    JulienMasson authored and tarsius committed Apr 5, 2021
    Configuration menu
    Copy the full SHA
    830d1f9 View commit details
    Browse the repository at this point in the history
  3. gitlab: fetch pullreq versions

    The gitlab API give the possibility to fetch versions for each diff
    from a pullreq.
    
    Source:
    https://docs.gitlab.com/ee/api/merge_requests.html#get-mr-diff-versions
    
    Signed-off-by: Julien Masson <[email protected]>
    JulienMasson authored and tarsius committed Apr 5, 2021
    Configuration menu
    Copy the full SHA
    32fb522 View commit details
    Browse the repository at this point in the history
  4. github: fill issue/pullreq/version objects

    With PullRequest and PullRequestReviewThread graphql object, we can
    set some fields of issue, pull-request and version objects.
    
    In order to access to some elements of PullRequestReviewThread, we
    need to toggle "Multi-Line Comments Preview":
    https://developer.github.com/v4/previews/#multi-line-comments-preview
    
    Source:
    https://developer.github.com/v4/object/pullrequest/
    https://developer.github.com/v4/object/pullrequestreviewthread/
    
    Signed-off-by: Julien Masson <[email protected]>
    JulienMasson authored and tarsius committed Apr 5, 2021
    Configuration menu
    Copy the full SHA
    7ec4933 View commit details
    Browse the repository at this point in the history
  5. pullreq: display version sections

    In the pullreq view, the version sections are now displayed instead of
    commits.
    
    These sections contains commits and diff changes for each version.
    The number of comments per commits or diff changes are also displayed.
    
    Example:
    Diff changes --> Latest Version:  (6 comments)
    Commits      --> 3634ab3 commit-A                     (4 comments)
    Commits      --> 0df0d75 commit-B                     (1 comments)
    Commits      --> 441de84 commit-C                     (1 comments)
    
    Press RET on "Diff changes" will show the diff of all the commits.
    Press RET on "Commits" will show the corresponding commit.
    
    Signed-off-by: Julien Masson <[email protected]>
    JulienMasson authored and tarsius committed Apr 5, 2021
    Configuration menu
    Copy the full SHA
    04f9931 View commit details
    Browse the repository at this point in the history
  6. Refactor and don't display diff posts in topic view

    In the topic view the diff posts should not be displayed.
    We only display posts/replies related to the topic conversation.
    
    Signed-off-by: Julien Masson <[email protected]>
    JulienMasson authored and tarsius committed Apr 5, 2021
    Configuration menu
    Copy the full SHA
    8b06cb7 View commit details
    Browse the repository at this point in the history
  7. Display replies in thread section

    The replies are now inserted in the correct thread section and are
    indented.
    
    Signed-off-by: Julien Masson <[email protected]>
    JulienMasson authored and tarsius committed Apr 5, 2021
    Configuration menu
    Copy the full SHA
    aacb2ee View commit details
    Browse the repository at this point in the history
  8. pullreq: display diff posts

    After RET in version section, the diff posts are now displayed in the
    magit diff buffer.
    
    Signed-off-by: Julien Masson <[email protected]>
    JulienMasson authored and tarsius committed Apr 5, 2021
    Configuration menu
    Copy the full SHA
    795a4e2 View commit details
    Browse the repository at this point in the history
  9. Use forge-diff-visit-file in hunk section

    Originally when pressing RET in a hunk section, it opens the file at
    the right position in the buffer.
    With a magit-diff buffer which contains diff posts, this feature is
    broken, the position in the file buffer is not correct.
    
    This patch handle this case when the magit-diff buffer contains diff
    posts.
    
    Signed-off-by: Julien Masson <[email protected]>
    JulienMasson authored and tarsius committed Apr 5, 2021
    Configuration menu
    Copy the full SHA
    e77e9ff View commit details
    Browse the repository at this point in the history
  10. forge-create-diff-post: New command

    This new command allow the user to create a diff post from a
    magit-diff buffer.
    The diff buffer has to be generated from a pullreq.
    This command is only supported by Gitlab and Github.
    
    Signed-off-by: Julien Masson <[email protected]>
    JulienMasson authored and tarsius committed Apr 5, 2021
    Configuration menu
    Copy the full SHA
    cecd093 View commit details
    Browse the repository at this point in the history
  11. forge-reply-post: New command

    This new command allow the user to reply to any post.
    This command is only supported by Gitlab and Github.
    
    Signed-off-by: Julien Masson <[email protected]>
    JulienMasson authored and tarsius committed Apr 5, 2021
    Configuration menu
    Copy the full SHA
    a41f705 View commit details
    Browse the repository at this point in the history
  12. gitlab: support pull single topic

    With a gitlab repo, it's now possible to pull a single topic.
    It can be either a pullreq or issue topic.
    
    Signed-off-by: Julien Masson <[email protected]>
    JulienMasson authored and tarsius committed Apr 5, 2021
    Configuration menu
    Copy the full SHA
    49c72a8 View commit details
    Browse the repository at this point in the history
  13. Clean-up "comment" functions

    In the code all the "comment" are treated as a post object.
    A post object can be found in a pull-request or an issue for eg.
    
    To avoid confusion it makes more sense to use "post" instead of
    "comment" in the function name when handling post object.
    
    Also forge-comment-at-point function has been removed since it's not
    used.
    
    Signed-off-by: Julien Masson <[email protected]>
    JulienMasson authored and tarsius committed Apr 5, 2021
    Configuration menu
    Copy the full SHA
    cfa9e4d View commit details
    Browse the repository at this point in the history
  14. github: handle diff post when deleting post

    Signed-off-by: Julien Masson <[email protected]>
    JulienMasson authored and tarsius committed Apr 5, 2021
    Configuration menu
    Copy the full SHA
    b89bd57 View commit details
    Browse the repository at this point in the history
  15. github: support edition of diff post

    When editing a diff post, the URL must be the following format:
    /repos/:owner/:repo/pulls/comments/:comment_id
    
    Source:
    https://developer.github.com/v3/pulls/comments/#edit-a-comment
    
    Signed-off-by: Julien Masson <[email protected]>
    JulienMasson authored and tarsius committed Apr 5, 2021
    Configuration menu
    Copy the full SHA
    db7aeca View commit details
    Browse the repository at this point in the history