Skip to content
GitLab
Next
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • GitLab GitLab
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 44,763
    • Issues 44,763
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 1,331
    • Merge requests 1,331
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.orgGitLab.org
  • GitLabGitLab
  • Issues
  • #336596
Closed
Open
Issue created Jul 21, 2021 by Kassio Borges@kassio2️⃣Developer

Github Importer: thread diff notes

Problem statement

When importing a project from Github it imports merge requests diff notes, comments associated with a file diff, in a non-threaded way.

Github Gitlab
Update_README_md_by_anotherkassio___Pull_Request__1___anotherkassio_smallrepo Update_README_md___1____Merge_requests___Administrator___smallrepo___GitLab

Proposed solution

Each diff note is created by Gitlab::GithubImport::Importer::DiffNoteImporter, which fetches the data from Github's List review comments in a repository API. This documentation mentions that each diff note provides a in_reply_to_id, which can be used to create Gitlab discussions.

Implementation details

  • When the in_reply_to_id is empty
    • Create a new discussion_id
    • Map the pull_request_comment.id to the discussion_id created on redis (Github original id for the diff note). Example: 8 -> f9f509e301c2ff6112a365ca066cda63c183530c, where:
      • 8 is the original github id for the diff note;
      • f9f509e301c2ff6112a365ca066cda63c183530c is the discussion_id;
  • When the in_reply_to_id has a value
    • Use the github_id->discussion_id map to find the discussion id related to the in_reply_to_id;
    • Use the found discussion_id on the new diff note;
    • Add another entry to the github_id->discussion_id map to map the new diff note to the discussion_id, like 9 -> f9f509e301c2ff6112a365ca066cda63c183530c;
  • Currently there's no documentation wether the GithubImporter imports or not threaded notes, therefore an update on the documentation must be done (https://docs.gitlab.com/ee/user/project/import/github.html#import-your-project-from-github-to-gitlab);
  • Example of implementation master...githb-importer-threaded-diff-notes-proposal

Expected Result

Update_README_md___1____Merge_requests___Administrator___smallrepo___GitLab
Related Documentation
  • Update the User documentation https://docs.gitlab.com/ee/user/project/import/github.html
  • Update the Developer documentation https://docs.gitlab.com/ee/development/github_importer.html
Edited Oct 29, 2021 by Kassio Borges
Assignee
Assign to
Time tracking