Class: Gitlab::GithubImport::Importer::DiffNoteImporter
- Inherits:
-
Object
- Object
- Gitlab::GithubImport::Importer::DiffNoteImporter
- Includes:
- Import::PlaceholderReferences::Pusher
- Defined in:
- lib/gitlab/github_import/importer/diff_note_importer.rb
Constant Summary collapse
- DiffNoteCreationError =
Class.new(ActiveRecord::RecordInvalid)
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(note, project, client) ⇒ DiffNoteImporter
constructor
note - An instance of
Gitlab::GithubImport::Representation::DiffNoteproject - An instance ofProjectclient - An instance ofGitlab::GithubImport::Client.
Methods included from Import::PlaceholderReferences::Pusher
#map_to_personal_namespace_owner?, #push_reference, #push_reference_with_composite_key, #push_references_by_ids, #user_mapping_enabled?
Constructor Details
#initialize(note, project, client) ⇒ DiffNoteImporter
note - An instance of Gitlab::GithubImport::Representation::DiffNote project - An instance of Project client - An instance of Gitlab::GithubImport::Client
14 15 16 17 18 |
# File 'lib/gitlab/github_import/importer/diff_note_importer.rb', line 14 def initialize(note, project, client) @note = note @project = project @client = client end |
Instance Method Details
#execute ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/gitlab/github_import/importer/diff_note_importer.rb', line 20 def execute return if merge_request_id.blank? note.merge_request = merge_request # Diff notes with suggestions are imported with DiffNote, which is # slower to import than LegacyDiffNote. Importing DiffNote is slower # because it cannot use the BulkImporting strategy, which skips # callbacks and validations. For this reason, notes that don't have # suggestions are still imported with LegacyDiffNote if note.contains_suggestion? import_with_diff_note else import_with_legacy_diff_note end rescue ::DiffNote::NoteDiffFileCreationError, DiffNoteCreationError => e Logger.warn(message: e., 'error.class': e.class.name) import_with_legacy_diff_note end |